From: Ritika on
How can we extract the RGB triplet for an jpg image?
From: ImageAnalyst on
On Jun 5, 11:26 pm, "Ritika " <ritika.dhi...(a)gmail.com> wrote:
> How can we extract the RGB triplet for an jpg image?

------------------------
rgbImageArray = imread(fullFileName);
x=100; % Whatever x (column) you want.
y = 250; % Whatever y (row or line number) you want.
redValue = rgbImageArray(y, x, 1);
greenValue = rgbImageArray(y, x, 2);
blueValue = rgbImageArray(y, x, 3);

% If you want it all in one array:
rgbTriplet = [redValue greenValue blueValue];

From: Walter Roberson on
ImageAnalyst wrote:
> On Jun 5, 11:26 pm, "Ritika " <ritika.dhi...(a)gmail.com> wrote:
>> How can we extract the RGB triplet for an jpg image?
>
> ------------------------
> rgbImageArray = imread(fullFileName);
> x=100; % Whatever x (column) you want.
> y = 250; % Whatever y (row or line number) you want.
> redValue = rgbImageArray(y, x, 1);
> greenValue = rgbImageArray(y, x, 2);
> blueValue = rgbImageArray(y, x, 3);
>
> % If you want it all in one array:
> rgbTriplet = [redValue greenValue blueValue];

Note that if the image is an indexed (pseudocolor) image then you will
need to convert it to rgb before extracting the color planes, with ind2rgb()