I need the code for extracting the digital numbers from the color planes!

I need a code to extract the digital numbers from the three color planes--red, green, blue

3 Comments

Here is a photo in the attachments I want to extract the digital numbers from the three color planes--red, green, blue .. Can you help?

Sign in to comment.

 Accepted Answer

Look at impixelinfo() for telling you what the RGB values are as you mouse around.
Here are some snippets that might help you:
% 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.
rgbImage = cat(3, redChannel, greenChannel, blueChannel);
% Mask image must be converted to the same integer type
% as the integer image we want to mask.
mask = cast(binaryImage, 'like', rgbImage);
% Multiply the mask by each color channel individually.
maskedRed = redChannel .* mask;
maskedGreen = greenChannel .* mask;
maskedBlue = blueChannel .* mask;
% Recombine separate masked color channels into a single, true color RGB image.
maskedRgbImage = cat(3, maskedRed, maskedGreen, maskedBlue);
Also see my File Exchange for some color image demos:

7 Comments

Ok .. that's fine! but I can not still change ur photos with my photos ... also is there any way to calculate MAX, MIN MEDIAN .. I see u just calculated the MEAN! Thanks so much
You were not specific enough with what you want to do. You didn't even upload one of your photos. There are max(), min(), and med() functions you know. For example:
minValueR = min(redChannel(:));
minValueG = min(greenChannel(:));
minValueB = min(blueChannel(:));
There are so, so many things you can do, but I'd need more specific information.
Here is what I need exactly .. https://www.dropbox.com/s/n6ppznmang3xuw2/Project.docx?dl=0 I put in this link.. Thanks so much for help..
so what I need exactly... extracting digital numbers from the photos.. calculating some equations .. VARI .. EXG .. GCC .. VCI.. So .. I just need to get the numbers first in excel sheet .. Sorry for disturbing!
Can you attach the item here with the paper clip icon?
Sure.. Just follow this link: https://www.dropbox.com/s/n6ppznmang3xuw2/Project.docx?dl=0 Thanks

Sign in to comment.

More Answers (1)

Greg
Greg on 25 Jan 2017
Edited: Greg on 25 Jan 2017
A = imread(filename);
A(:,:,1) is the red
A(:,:,2) is the green
See a pattern yet...?

1 Comment

the code is working .. I need just to organize that .. if you can help me in that.. I am little bit beginner in MATLAB.. I got thousands of numbers .. can I display that in a column ?

Sign in to comment.

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!