From: Jeffery R on
Concerning the same error, with integer operands for colon operators, I am trying to do a bit of image processing. Though I am surely not going about it the most efficient way, I was trying to use ginput to reduce the size of an image. I have the following code, which results in the integer operand issue:

[x,y] = ginput(2)
size(Pic)
A = Pic(y(1):y(2),x(1):x(2),:);

Ab=A(:,:,3);

I am trying to take an image, convert it to RGB, display it, click an important area, make a new 3d matrix with the selected part of the image, zoom in, and then take only the blue layer and view it, and perform some calculations on the matrix as well. The g-input results are not integers, but I am not entirely sure what I should change about this. Also, currently my function is working, it just gives me this warning.

Thanks in advance.
-Jeff
From: Andy on
"Jeffery R" <jar399(a)cornell.edu> wrote in message <hhdrkh$6ao$1(a)fred.mathworks.com>...
> Concerning the same error, with integer operands for colon operators, I am trying to do a bit of image processing. Though I am surely not going about it the most efficient way, I was trying to use ginput to reduce the size of an image. I have the following code, which results in the integer operand issue:
>
> [x,y] = ginput(2)
> size(Pic)
> A = Pic(y(1):y(2),x(1):x(2),:);
>
> Ab=A(:,:,3);
>
> I am trying to take an image, convert it to RGB, display it, click an important area, make a new 3d matrix with the selected part of the image, zoom in, and then take only the blue layer and view it, and perform some calculations on the matrix as well. The g-input results are not integers, but I am not entirely sure what I should change about this. Also, currently my function is working, it just gives me this warning.
>
> Thanks in advance.
> -Jeff

The function ginput returns x and y coordinate values, which are unlikely to be integers. So the line A = Pic(y(1):y(2),x(1):x(2),:); is generating this error.

On a separate note, the line size(Pic) does nothing if you don't store that data somewhere, e.g. [m,n]=size(Pic).