Thread Subject: how to select a circular region ?

Subject: how to select a circular region ?

From: Diana

Date: 11 Jul, 2009 11:38:01

Message: 1 of 7

hi,

I can select a rectangular region as ,

I(32:27, 92:82) and change the intensity value of the this region. But I want to select a cicular or ellipsoid region and change its intensity

how to do this?

Subject: how to select a circular region ?

From: Bruno Luong

Date: 11 Jul, 2009 12:00:20

Message: 2 of 7

"Diana " <diana89@yahoo.com> wrote in message <h39tip$2ov$1@fred.mathworks.com>...
> hi,
>
> I can select a rectangular region as ,
>
> I(32:27, 92:82) and change the intensity value of the this region. But I want to select a cicular or ellipsoid region and change its intensity
>
> how to do this?

You must setect the indices (using logical indexing, or FIND indexing) that meet whatever the criteria you chose (inside whatever shape). Example:

I = peaks(40);

[ny nx] = size(I);
x = linspace(-1,1,nx);
y = linspace(-1,1,ny);
[X Y] = meshgrid(x,y);
radius=0.5;
I(X.^2+Y.^2<radius^2)=5; % logical indexing of the circle centered at (0,0)

imagesc(I)

Subject: how to select a circular region ?

From: Jan Jaim

Date: 14 Jul, 2009 07:18:01

Message: 3 of 7

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h39usk$ssd$1@fred.mathworks.com>...
> "Diana " <diana89@yahoo.com> wrote in message <h39tip$2ov$1@fred.mathworks.com>...
> > hi,
> >
> > I can select a rectangular region as ,
> >
> > I(32:27, 92:82) and change the intensity value of the this region. But I want to select a cicular or ellipsoid region and change its intensity
> >
> > how to do this?
>
> You must setect the indices (using logical indexing, or FIND indexing) that meet whatever the criteria you chose (inside whatever shape). Example:
>
> I = peaks(40);
>
> [ny nx] = size(I);
> x = linspace(-1,1,nx);
> y = linspace(-1,1,ny);
> [X Y] = meshgrid(x,y);
> radius=0.5;
> I(X.^2+Y.^2<radius^2)=5; % logical indexing of the circle centered at (0,0)
>
> imagesc(I)

Hi,

I have an image sized 400x400 and want to select ( or add) a circular region on the image. The size of the circular part can be 40x40 like the above code. The above code is very nice, but, how to add this circule onto my image?

Subject: how to select a circular region ?

From: Matt

Date: 14 Jul, 2009 07:28:02

Message: 4 of 7

"Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hbf9$hv7$1@fred.mathworks.com>...

> I have an image sized 400x400 and want to select ( or add) a circular region on the image. The size of the circular part can be 40x40 like the above code. The above code is very nice, but, how to add this circule onto my image?
-----------------


How is "adding" a circle to the image a different operation from setting the pixels in the circle to some prominently visible intensity level, as Bruno showed you how to do?

Subject: how to select a circular region ?

From: Jan Jaim

Date: 14 Jul, 2009 08:23:02

Message: 5 of 7

"Matt " <xys@whatever.com> wrote in message <h3hc21$pc8$1@fred.mathworks.com>...
> "Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hbf9$hv7$1@fred.mathworks.com>...
>
> > I have an image sized 400x400 and want to select ( or add) a circular region on the image. The size of the circular part can be 40x40 like the above code. The above code is very nice, but, how to add this circule onto my image?
> -----------------
>
>
> How is "adding" a circle to the image a different operation from setting the pixels in the circle to some prominently visible intensity level, as Bruno showed you how to do?

Let say the image is;
img=zeros(400,400);

and the above circle is I, and we want to see the circle as

 img(32:72, 92:132)=I; but as you guess the error is,
"Subscripted assignment dimension mismatch". What is the solution ?

Subject: how to select a circular region ?

From: Rose Watchy

Date: 14 Jul, 2009 11:20:03

Message: 6 of 7

"Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hf96$egd$1@fred.mathworks.com>...
> "Matt " <xys@whatever.com> wrote in message <h3hc21$pc8$1@fred.mathworks.com>...
> > "Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hbf9$hv7$1@fred.mathworks.com>...
> >
> > > I have an image sized 400x400 and want to select ( or add) a circular region on the image. The size of the circular part can be 40x40 like the above code. The above code is very nice, but, how to add this circule onto my image?
> > -----------------
> >
> >
> > How is "adding" a circle to the image a different operation from setting the pixels in the circle to some prominently visible intensity level, as Bruno showed you how to do?
>
> Let say the image is;
> img=zeros(400,400);
>
> and the above circle is I, and we want to see the circle as
>
> img(32:72, 92:132)=I; but as you guess the error is,
> "Subscripted assignment dimension mismatch". What is the solution ?

dear Jan,
you must check the matrix dimension !

Hi everybody,

I have a grayscale image, let's say it is 400x400. I will show the above white circle onto the grayscale image. But when I write the code as;

grayscaleImg(32:71, 92:131) = I; then the circle seems as black and in the rectangular shape. How to show the circle without the rectangule background and the color of the circle must be white ?

many many thanks..

Subject: how to select a circular region ?

From: Julia Woody

Date: 15 Jul, 2009 08:50:03

Message: 7 of 7

"Rose Watchy" <Rose.Watchy@gmail.com> wrote in message <h3hpl3$d1e$1@fred.mathworks.com>...
> "Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hf96$egd$1@fred.mathworks.com>...
> > "Matt " <xys@whatever.com> wrote in message <h3hc21$pc8$1@fred.mathworks.com>...
> > > "Jan Jaim" <bluekidresat@gmail.com> wrote in message <h3hbf9$hv7$1@fred.mathworks.com>...
> > >
> > > > I have an image sized 400x400 and want to select ( or add) a circular region on the image. The size of the circular part can be 40x40 like the above code. The above code is very nice, but, how to add this circule onto my image?
> > > -----------------
> > >
> > >
> > > How is "adding" a circle to the image a different operation from setting the pixels in the circle to some prominently visible intensity level, as Bruno showed you how to do?
> >
> > Let say the image is;
> > img=zeros(400,400);
> >
> > and the above circle is I, and we want to see the circle as
> >
> > img(32:72, 92:132)=I; but as you guess the error is,
> > "Subscripted assignment dimension mismatch". What is the solution ?
>
> dear Jan,
> you must check the matrix dimension !
>
> Hi everybody,
>
> I have a grayscale image, let's say it is 400x400. I will show the above white circle onto the grayscale image. But when I write the code as;
>
> grayscaleImg(32:71, 92:131) = I; then the circle seems as black and in the rectangular shape. How to show the circle without the rectangule background and the color of the circle must be white ?
>
> many many thanks..

Is there anybody who can give answer to this question?
cheers,

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
select rectangu... Sprinceana 11 Jul, 2009 16:49:46
rssFeed for this Thread

Contact us at files@mathworks.com