Thread Subject: All points in an area of an image

Subject: All points in an area of an image

From: Vivian Harvey

Date: 13 May, 2008 10:57:04

Message: 1 of 3

Is there any function in MATLAB that can import all points
(into a matrix, for eg) of a certain area in an image, be
it circle, be it rectangle as long as I have the specifics
of the bounding area....for example, if I have the centre
and radius of a circle in the image, can we go

function(xcentre, ycentre, radius) in image
I=imread('example.jpg')?

Subject: All points in an area of an image

From: Alessandro Mura

Date: 13 May, 2008 11:52:17

Message: 2 of 3

"Vivian Harvey" <viv_harv@yahoo.co.uk> wrote in message
<g0bs60$i81$1@fred.mathworks.com>...
> Is there any function in MATLAB that can import all points
> (into a matrix, for eg) of a certain area in an image, be
> it circle, be it rectangle as long as I have the specifics
> of the bounding area....for example, if I have the centre
> and radius of a circle in the image, can we go
>

This creates a new image with only the points
inside a circle of the old image.


I=load ('clown')


 image(I.X)
 colormap(I.map)


figure

 [x,y]=ndgrid([1:size(I.X,1)],[1:size(I.X,2)]);
 I.Z=I.X(((x-150).^2+(y-100).^2)<50^2);

 i=(((x-150).^2+(y-100).^2)<50^2);
 Z=zeros(size(I.X));
 Z(i)=X(i);
image(Z)
colormap(I.map)


if you want just the points, in an array:

Z=I.X(i);
X=x(i);
Y=y(i);


Subject: All points in an area of an image

From: ImageAnalyst

Date: 13 May, 2008 13:37:55

Message: 3 of 3

On May 13, 6:57=A0am, "Vivian Harvey" <viv_h...@yahoo.co.uk> wrote:
> Is there any function in MATLAB that can import all points
> (into a matrix, for eg) of =A0a certain area in an image, be
> it circle, be it rectangle as long as I have the specifics
> of the bounding area....for example, if I have the centre
> and radius of a circle in the image, can we go
>
> function(xcentre, ycentre, radius) in image
> I=3Dimread('example.jpg')?

----------------------------------
Vivian:
First you read the image into a 2D array (if it's monochrome) or a 3D
array if it's RGB color or multispectral. Then you can create a mask
of any shape you want and multiply it by your image to get an image
with just the pixels you want. Keep in mind that this will still be a
2D or 3D image that will just have zeros outside your mask. This is
because arrays have to be rectangular. If you want ONLY the pixels in
the mask, there are ways of pulling only those pixels out and
stringing them into one long 1D array. Which way were you thinking
of?
Regards,
ImageAnalyst

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
circle area coordinates Vivian Harvey 13 May, 2008 07:00:05
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com