I have an android app in which I am loading an imageview from gallery. This is typically that of any interior of a room. I have loaded the image in a canvas. Then what I am intending to do is - I will touch any point on the imageview. The color which I am touching(I am able to get the RGB value) should be replaced throughout that image with another color - say RED.It should be evenly replaced in the image. Now I am able to precisely replace the touched RGB color with RED, but it is appearing as splattered. What I want is wherever the touched color or its nearby hues appear in the image, it should be evenly replaced with - say RED. Please help me out in this logic.
Asked
Active
Viewed 601 times
1 Answers
0
You need to break the task into multiple subtasks.
- Determining the color of the pixel at the point pressed.
- Replace all similar pixels with a certain shift.
About how to replace the pixels are written here. Shift you should get from comparison formula.

Community
- 1
- 1

user2413972
- 1,355
- 2
- 9
- 25
-
Can you please explain what is meant by shifting the pixels? – sajay kumar Sep 18 '15 at 05:05
-
Color 120 -> 125; Color 122-> 127; Color 121-> 126; Etc – user2413972 Sep 18 '15 at 07:51
-
Thanks for your guidance so far. One last hurdle. I see in the post for shifting pixels -lots of comments and it was quite confusing. Can you please help me in in identifying a proper solution? What should I do with the lab value? How can I replace the lab value with red? Any help in this will be greatly appreciated. TIA. – sajay kumar Sep 18 '15 at 11:44
-
I gave a link to an example of the replacement color. There is an entire function. – user2413972 Sep 18 '15 at 12:53
-
No I was referring to the pixel shift example : http://stackoverflow.com/questions/9018016/how-to-compare-two-colors. The details in that are quite elaborate and I am not able to comprehend that. – sajay kumar Sep 19 '15 at 07:02
-
return ( Math.abs(_rA - da) <= (255 - tolerance) && Math.abs(_rR - dr) <= tolerance && Math.abs(_rG - dg) <= tolerance && Math.abs(_rB - db) <= tolerance ); – user2413972 Sep 20 '15 at 09:04
-
What is rA da, rR dr etc. and what value of tolerance. Sorry if i am troubling you too much, coz i am a novice to these concepts. – sajay kumar Sep 22 '15 at 11:21