Replace a particular color inside an image with another color(用另一种颜色替换图像中的特定颜色)
问题描述
I have one "room" image.
Now, user will click on any particular color suppose blue color in image.
And also user will select replaced color like "black" color.
So, all "blue" color inside the image will be replaced by "black" color.
Any one have idea for how to achieve this in iPhone?
Help is appreciated.
- You have to iterate through each pixel in the image and take its rgb values
- Check its rgb values matches your fromColor rgb values, if yes change the pixel value to your toColor rgb values.If not, just leave that pixel and go to next one..
Wrote a function from memory..errors possible..correct yourself
I hope you are not calling this function every time...It is a bit processor heavy..And if I was your processor, I wouldn't be happy with you..:)
这篇关于用另一种颜色替换图像中的特定颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!