Monday, 1 October 2018

How can I colour my sketch using pen tool within the limited edge boundaries using sobel edge detection/canny edge detection in ios swift?

I am using GPUImage to detect the edge and applying GPUImageSobelEdgeDetectionFilter or GPUImageCannyEdgeDetectionFilter . Now my requirement is

How can I take the coordinate points from that image so that I can make drawing within the closed boundaries.

Detect Edges from Image

   var image_p: GPUImagePicture?
   var filterImageview: UIImageView! // to display images

   let inputImage = filterImageview.image
    if let anImage = inputImage {
        image_p = GPUImagePicture(image: anImage)
    }

    let filter1 = GPUImageSobelEdgeDetectionFilter()//GPUImageCannyEdgeDetectionFilter()
    image_p?.addTarget(filter1)
    image_p?.processImage()

    let outputImage = filter1.imageFromCurrentlyProcessedOutput()
    filterImageview.image = outputImage

Now I am trying to detect the points so that i can create a separate layer for drawing within the closed boundaries..

  • For example 1. orgnl image 2. filtered sobelEdgeDetection/GPUImageCannyEdgeDetectionFilter image
    1. enter image description here 2. enter image description here

I am drawing color using pen tool. If i am coloring inside the circle while coloring, it should not come out of the circle boundary.. until i choose another touchpoints..

Based on touch point i want to color it within closed boundaries..

How could I apply it.. any ideas/help will be appreciated..



from How can I colour my sketch using pen tool within the limited edge boundaries using sobel edge detection/canny edge detection in ios swift?

No comments:

Post a Comment