From: Bhuvan on
i want to crop a region of the image by using it's rows and columns..
i use the following code...

e=imread('w.jpg');
h=30;
i=e(60:520,30:490);
imshow(i);

the original image is coloured but after i crop the image i is will be in greyscale why is it so...and i don't want to use imcrop function...
thanking you.....
From: Walter Roberson on
Bhuvan wrote:
> i want to crop a region of the image by using it's rows and columns..
> i use the following code...
>
> e=imread('w.jpg');
> h=30;
> i=e(60:520,30:490);
> imshow(i);
>
> the original image is coloured but after i crop the image i is will be in greyscale why is it so...and i don't want to use imcrop function...

'e' is probably a 3 dimensional variable, and you are only selecting on
two of its dimensions, which would have the effect of selecting only
from the first pane -- as if you had specified e(60:520, 30:490, 1) .

If you want to retain the colour, use

i = e(60:520, 30:490, :) ;
From: Bhuvan on
thanks a lot....it's awesome