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

后端 未结 1 950
鱼传尺愫
鱼传尺愫 2021-01-06 16:30

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

How ca

相关标签:
1条回答
  • 2021-01-06 17:16

    Hey Pradip you are looking for floodfill algorithm to be exact it will solve your problem.

    Floodfill Algorithm Brief Explanation -

    The flood-fill algorithm takes three parameters: a start node, a target color, and a replacement color. The algorithm looks for all nodes in the array that are connected to the start node by a path of the target color and changes them to the replacement color.

    Links for you R&D and also a demo in obejective-c.

    1. https://ilearnios.wordpress.com/2013/07/18/scanline-flood-fill-algorithm-with-or-without-tolerance-in-objective-c/
    2. https://lodev.org/cgtutor/floodfill.html
    3. https://github.com/Chintan-Dave/UIImageScanlineFloodfill (Great demo courtesy of Chintan-Dave)

      I have also used floodfill on my project just to remove background colors and found above links veryusefull. Hope it Helps

    0 讨论(0)
提交回复
热议问题