> greenimage(:,:,1:3)=0; you should use 'greenimage(:,:,[1,3])' in the above line. 1:3 is 1,2,3. Navan. --- aditya <> wrote: > Hi All, > I was trying to isolate the RGB components from a > given image.I wrote the following code and i am > getting the red and blue components but for the > green > component i am getting a Black image.Can some one > guide what is going wrong.Also when i try to take > the > histogram of the image using Imhist i have a problem > because its a JPEG image.can anyone tell me how to > over come it. > Thanks in Advance. > Regards, > Aditya > > > close all > clear all > A=imread('images.jpg'); > B=double(A); > redimage=A; > redimage(:,:,2:3)=0; > figure(1) > title('red image') > imagesc(redimage) > blueimage=A; > blueimage(:,:,1:2)=0; > figure(2) > title('blueimage') > greenimage=A; > greenimage(:,:,1:3)=0; > figure(3) > title('greenimage') __________________________________ |