Skip to content Skip to sidebar Skip to footer

How To Create A Magicwand In Android?

I want to create a magic wand tool in Android like it is implemented in Photoshop. Is there an opensource library to perform this work? And if not can anyone guide me on the right

Solution 1:

OpenCV has floodFill that with a little work can give you the magic wand functionality.

Solution 2:

basically you need acccess to the pixels of the image. You can do that in numerous ways -> Canvas. Then, your algorithm is a bit like the A* Pathfinding algorithm (but not really);

  1. set color-diff threshold
  2. define starting point
  3. check every pixel arround the starting point if it passes threshold. if yes -> save coords
  4. for every pixel that passed threshold, go to 2

the pixel-color difference that should pass the threshold is in essence the pythagoras theorem between the original starting point and the pixel you are comparing; d=SQRT((x2-x1)^2+(y2-y1)^2+(z2-z1)^2)

of course photoshop has a number extreme efficient algorithms, but essentially it boils down to above

Post a Comment for "How To Create A Magicwand In Android?"