Change object color with the same range

asked 2018-05-15 00:35:33 -0500

leminhbang gravatar image

updated 2018-05-15 20:58:47 -0500

Hi, I'm new, I have an application in android using opencv. I need to change the color of a object region and the ouput still have the same lightness (V channel) and contrast with the original image, it's mean the object region will have the new color from dark to light same as the input image. I have had detect the region need to change color (a mat of binary) using this solution https://github.com/opencv/opencv/blob....

I will summary the solution: when user touch on the image I will create a rectangle 8x8 arround the user touch point then I calculate the mean of H,S,V chabbels of the rect and then I specify the range of each channel. In which pixel has the value of each channle in the range I will regconize to the same color with the touch point need to change color.
Can anyone tell me the best way to apply the new color to the region I had detected. Thanks.

The example input image
image description

the result after I detect the skin of the dog
image description

edit retag flag offensive close merge delete

Comments

it seems, you came quite far here already, but now, it's a bit unclear, where your current problem is.

e.g. are you able to get the touch region ?

what do you have and what do you need ?

berak gravatar imageberak ( 2018-05-15 08:55:16 -0500 )edit

Hi Berak , I could able to get the region from the user (the rect 8x8 with the center is the user touch point) and then I have had detected the regoin where I think its the same color (you can see the second picture). So my question is how to apply a new color to that region and the result must be still the same lightness and contrast with the input image.

leminhbang gravatar imageleminhbang ( 2018-05-15 20:52:19 -0500 )edit