From: Smith Kumar on
Hello everyone,

I checked the imcrop function and its quite straight forward to use for shapes such as rectangle..

My question is suppose I have an image, a particular centre and radius iand would like to crop this circle from the image.

Any sugestions please...

I checked the thread http://www.mathworks.com/matlabcentral/newsreader/view_thread/264367 but it works only for ellipses..

I know how to draw a circle using the code belod but how to crop it...

a = [0:2*pi/nsides:2*pi];
line(r*cos(a)+c(1), r*sin(a)+c(2), 'color', col);

Many thanks in advance,
From: ImageAnalyst on
You can "mask" an image with any arbitrary shape but you can crop with
rectangular shapes only, because images are arrays in MATLAB and
arrays are required to be rectangular. You can have a round spot in
an image, but there has to be *something* in the corner between the
circle and the array corner (such as zeros). Please explain what you
want to do.
From: Smith Kumar on
Thanks for your response.

Basically I have an image say 640*480.

I found the centre of the image and would have drawn a circle from that centre of the image and radius 100.

Now i want to crop / cut that circle from the original image, basically I will have the circular image portion extracted from the original image.

Please let me know if you need any more info.

Thanks,
From: ImageAnalyst on
Yes. You can answer my previous question. You can tell me if the
extracted circular portion is to be rectangular or not. Even if you
were to get a list of all pixels in the circular area, you're going to
have to do something with those pixels and that will mean applying
them to another array which is going to be rectangular.

Why don't you tell me what a cropped image means to you? Does it mean
an array of numbers like an image? Or does it mean just an N by 2
list of (x,y) coordinates of the locations that are in the cropped
region (this Nx2 array is, of course, NOT an image).
From: Smith Kumar on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <535bd562-26f1-4152-90b1-85ab5fce4b69(a)j6g2000vbd.googlegroups.com>...
> Yes. You can answer my previous question. You can tell me if the
> extracted circular portion is to be rectangular or not. Even if you
> were to get a list of all pixels in the circular area, you're going to
> have to do something with those pixels and that will mean applying
> them to another array which is going to be rectangular.
>
> Why don't you tell me what a cropped image means to you? Does it mean
> an array of numbers like an image? Or does it mean just an N by 2
> list of (x,y) coordinates of the locations that are in the cropped
> region (this Nx2 array is, of course, NOT an image).

Hi IA,
Thanks for your response.

Well., I want to draw a circle on the image and to set all the pixels outside that circle to zero.

I was also wondering as u suggested it I could then get only the circle without the zero afterwards...basically it would look like a circle...rather than a rectangle.. is that possible in matlab...

By cropping, I mean an array of numbers like an image.. as you suggested.

Thanks in advance....