Thread Subject: Drawing a solid circle pixel using x,y coordinate and radius

Subject: Drawing a solid circle pixel using x,y coordinate and radius

From: Phil Au

Date: 25 Feb, 2008 18:43:01

Message: 1 of 4

Hi all,

I was having difficulties in creating a solid circle shape
pixel with x and y coordinates, and radius..

I kind of know that the radius must be at least more than 3
pixels size to be able to show the shape of the circle, but
I dont know where to start to write the code..

Many thanks

Subject: Drawing a solid circle pixel using x,y coordinate and radius

From: Ian Clarkson

Date: 25 Feb, 2008 22:08:05

Message: 2 of 4

"Phil Au" <philipawt@gmail.com> wrote in message
<fpv27l$p8s$1@fred.mathworks.com>...
> Hi all,
>
> I was having difficulties in creating a solid circle
shape
> pixel with x and y coordinates, and radius..
>
> I kind of know that the radius must be at least more than
3
> pixels size to be able to show the shape of the circle,
but
> I dont know where to start to write the code..
>
> Many thanks

i could have sworn this got answered a few days ago. check
around the forum a bit more. it involved calculating the
radius out from the center and just turning the pixel "on",
as i recall.

Subject: Drawing a solid circle pixel using x,y coordinate and radius

From: Phil Au

Date: 25 Feb, 2008 22:45:06

Message: 3 of 4

"Ian Clarkson" <ian.clarkson@gesturetek.com> wrote in
message <fpve85$i5i$1@fred.mathworks.com>...
> "Phil Au" <philipawt@gmail.com> wrote in message
> <fpv27l$p8s$1@fred.mathworks.com>...
> > Hi all,
> >
> > I was having difficulties in creating a solid circle
> shape
> > pixel with x and y coordinates, and radius..
> >
> > I kind of know that the radius must be at least more
than
> 3
> > pixels size to be able to show the shape of the circle,
> but
> > I dont know where to start to write the code..
> >
> > Many thanks
>
> i could have sworn this got answered a few days ago.
check
> around the forum a bit more. it involved calculating the
> radius out from the center and just turning the
pixel "on",
> as i recall.



Thx for your advice, But I was wondering how I adapt this
to a reference frame in an image ? i.e. paint a solid
cirlce in pixel(x,y)?

Subject: Drawing a solid circle pixel using x,y coordinate and radius

From: ImageAnalyst

Date: 26 Feb, 2008 01:06:41

Message: 4 of 4

On Feb 25, 5:45=A0pm, "Phil Au" <philip...@gmail.com> wrote:
> "Ian Clarkson" <ian.clark...@gesturetek.com> wrote in
> message <fpve85$i5...@fred.mathworks.com>...
>
>
>
>
>
> > "Phil Au" <philip...@gmail.com> wrote in message
> > <fpv27l$p8...@fred.mathworks.com>...
> > > Hi all,
>
> > > I was having difficulties in creating a solid circle
> > shape
> > > pixel with x and y coordinates, and radius..
>
> > > I kind of know that the radius must be at least more
> than
> > 3
> > > pixels size to be able to show the shape of the circle,
> > but
> > > I dont know where to start to write the code..
>
> > > Many thanks
>
> > i could have sworn this got answered a few days ago.
> check
> > around the forum a bit more. it involved calculating the
> > radius out from the center and just turning the
> pixel "on",
> > as i recall.
>
> Thx for your advice, But I was wondering how I adapt this
> to a reference frame in an image ? i.e. paint a solid
> cirlce in pixel(x,y)?- Hide quoted text -
>
> - Show quoted text -

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Let me know if you're able to adapt this simple demo code I wrote for
you to your situation:
%=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
% Make a binary image containing two overlapping circular objects.
imageSizeX =3D 128;
imageSizeY =3D 200;
centerX =3D 64;
centerY =3D 90;
radius =3D 10;
[x,y] =3D meshgrid(1:imageSizeY, 1:imageSizeX);
binaryImage =3D sqrt((x-centerX).^2 + (y-centerY).^2) <=3D radius;
figure;
imshow(binaryImage, []);
title('bw Circle');

Regards,
ImageAnalyst

Tags for this Thread

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.

rssFeed for this Thread

Contact us at files@mathworks.com