How can i Change pixel color?
Show older comments
Hello
I have a color image of type RGB and I need to change the color of each point (red, yellow, orange) to green. I hope that there is a programmatic solution to this problem.
5 Comments
jonas
on 7 Jul 2020
What do you mean "of each point"? Better upload an example image and explain what type of output you're looking for.
Ansam Nazar
on 7 Jul 2020
Mehmed Saad
on 7 Jul 2020
Edited: Mehmed Saad
on 7 Jul 2020
Suppose i have a picture of size 400x400. When i import it in MATLAB (using imread or directly) the matrix size will be 400x400x3 uint8. Now the 3rd dimension depicts R,G and B. Now you can apply conditions on these three colors for 1 pixel and change there values as you want
For example True red is [255 0 0], now apply a check that if this condition satisfies change pixel to
[0 255 0]
jonas
on 7 Jul 2020
Better replace loop by logical indexing and upload an example image.
Mehmed Saad
on 8 Jul 2020
jonas is right, understand the code and try to replace for loops with logical indexing
Accepted Answer
More Answers (0)
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

