Ask Your Question
0

Detecting regions of same colour

asked 2017-09-13 02:01:20 -0600

updated 2020-12-09 08:33:02 -0600

Hello, Looking to talk through my approach. I want to allow a user to colour dolls using a greyscale photo. To do this, I need to identify the regions that could be a single colour: eg a shirt being separate to pants or face.

At first I thought I could run it through a Bilateral blur & Canny edge detection to separate different regions (Assuming there is a clear line between different areas), but due to imperfections in the photograph / lighting, I am not getting a perfect line for floodfilling, and starting to question if there's another way. I have experimented with many sets of Canny parameters and levels of morphology dilations / erosions, but struggling when it only takes a single pixel error to break the floodfill. Also, as dilations increase, it starts to 'bridge' across the corners.

I'm starting to experiment with contours - and thinking if I could extend the line formed by the last 2 points of a contour to see if they meet another contour within a certain distance or similar slope (if a long section is screened out by lighting).

Instead, I'm wondering if there's a way to implement this that doesn't rely on strong lines, maybe looking at 'textures' in each region. Or as an alternative - combine the edge detection with user input - eg user scribbles over areas of interest and program tries to combine that with edges to find the most likely region of interest (though not sure if there's an easy way to do that).

See below: left is source image, middle images show canny detection and final blue image shows contours. As an example of undesirable features: The canny has highlighted a specular shine on the hat (see yellow in 3rd image), and missed important edges eg the red borders of the spear I have highlighted in image 4.

image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-09-13 04:23:36 -0600

VxW gravatar image

updated 2017-09-13 04:24:09 -0600

this is not an easy task and still an open research question:

see: https://stackoverflow.com/questions/44991646/how-do-i-recolour-a-photo-using-opencv

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-09-13 02:01:20 -0600

Seen: 1,186 times

Last updated: Sep 13 '17