%I have tested it with a different image, No error
RGB=imread('1.jpg');
redvalue=RGB(:,:,1);
greenvalue=RGB(:,:,2);
bluevalue=RGB(:,:,3);
sprintf('Value of the red,green and blue pixel is %d,%d,%d',redvalue,greenvalue,bluevalue);
figure, imshow(RGB),title('RGB IMAGE')
I=rgb2gray(RGB);
figure,imshow(I),title('gray image')
figure,imhist(I),title('histogram')
T=80;
it=im2bw(I,T/255);
figure,imshow(it);
Here I have ignored the warning
Best Answer