Info
This question is closed. Reopen it to edit or answer.
Switching Pixel Colors in an Image
1 view (last 30 days)
Show older comments
The question is how can I take an image file thats already loaded, scan through each pixel on all rows and columns and replace the amount of red with the number of blue ones, the green with the number of red ones, and the blue with the old green ones. What way would there be to do this?
0 Comments
Answers (1)
Image Analyst
on 21 Nov 2013
Try this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Recombine separate color channels into a single, true color RGB image.
rgbImageNew = cat(3, blueChannel, redChannel, greenChannel);
imshow(rgbImageNew);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!