I have an rgb image how can i select the blue color plane from the RGB color space?
4 views (last 30 days)
Show older comments
i have this code but it show the error
redPlane1 =rgbImage1(:, :, 1);
greenPlane1 = rgbImage1(:, :, 2);
bluePlane1 = rgbImage1(:, :, 3);
rgbImage2(:, :, 3) = bluePlane1;
bluePlane1 = rgbImage1(:, :, 3);
bluePlane2 = rgbImage2(:, :, 3);
averageBlue = (double(bluePlane1) + double(bluePlane2)) / 3.0;
rgbImage2(:, :, 3) = uint8(averageBlue);
0 Comments
Answers (2)
Star Strider
on 9 Oct 2015
What was the error?
One problem is that I do not see that you have defined ‘averageBlue’ in the code you posted. Did you intend:
averageBlue = (double(bluePlane1) + double(bluePlane2)) / 3.0;
If not, please copy all the red text from the Command Window and paste it to a Comment to your Question here.
0 Comments
Image Analyst
on 9 Oct 2015
What's with the char() function????? Try this:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
You define the averageGreen to be 2/3 the blue channel of your image 1, but you don't every use it. Then you try to use averageBlue which has not been defined yet.
2 Comments
Image Analyst
on 9 Oct 2015
So what's the problem now? It does what you tell it to do, but I don't know what you want it to do. What do you want?
See Also
Categories
Find more on Image Processing Toolbox 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!