From: Ritika on 5 Jun 2010 23:26 How can we extract the RGB triplet for an jpg image?
From: ImageAnalyst on 5 Jun 2010 23:57 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 6 Jun 2010 01:00 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()
|
Pages: 1 Prev: soundsc or sound function will not play audio Next: approximation |