I want to fill the color in white area for Paint based application so please give me suggestion for how to do this work..
Here's a quick application using Python and OpenCV (should be available on Android if you try hard enough):
"""Flood fills with random color on click. Press `q' to exit."""
import cv
import sys
import random
TOL = 10
TOL_BGR = (TOL, TOL, TOL, 0)
def click(event,x,y,flags,im):
if event == cv.CV_EVENT_LBUTTONDOWN:
b,g,r = [ random.random() * 255 for i in range(3) ]
cv.FloodFill(im, (x,y), (b,g,r,0), TOL_BGR, TOL_BGR)
im = cv.LoadImage(sys.argv[1], cv.CV_LOAD_IMAGE_COLOR)
cv.NamedWindow(__file__, 1)
cv.SetMouseCallback(__file__, click, im)
while True:
cv.ShowImage(__file__, im)
key = cv.WaitKey(33)
if chr(key & 0xff) == 'q':
break
cv.SaveImage('floodfill.png', im)
Every time the user clicks an image, the application flood-fills using the click location as a seed. The color is picked randomly. You can change the tolerances by modifying the value of TOL (or TOL_BGR). Here's the result after a couple of clicks:
The general algorithm is the same regardless of what technology you use.