There is a image which contains 3 color channels RGB and we should crop it and overlay them one on another to get a color image. The image is :-
I have written a code for this problem :-
img = imread('image.jpg');[r,c] = size(img);rr=r/3;B=imcrop(img,[1,1,c,rr]);G=imcrop(img,[1,1*rr,c,rr]);R=imcrop(img,[1,2*rr,c,rr]);ColorImg(:,:,1) = R;ColorImg(:,:,2) = G;ColorImg(:,:,3) = B;imshow(ColorImg)
but I am getting an error as : –
Variable B must be of size [341 400]. It is currently of size [342 400]. Check where the variable is assigned a value.
Can you help me to know what is the error?
Thank you in advance.
Best Answer