Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
correct approach to add geometrical objects to image

Subject: correct approach to add geometrical objects to image

From: John Smith

Date: 20 Sep, 2009 16:06:50

Message: 1 of 4

hi,
please help with Matlab beginner challenge
i need to create an image with few geometrical objects (circles,
ellipses) and then to apply some projective transforms
my problem is that i cant understand how to actually "drow" on image

image is AFAIU generally defined as [X;Y;3] matrix,
functions as SCIRCLE1 can compute/return collection of points
representing circle, but the problem is that points are not discrete ,
coordinates are real numbers and not pixels

how can i recompute the scircle output to be valid in image
coordinates system ? i.e. how can i "pixelize" it?

thanks for your attention, i really missing some basic concept and
will appreciate your help

John

Subject: correct approach to add geometrical objects to image

From: Dave Brackett

Date: 20 Sep, 2009 21:32:01

Message: 2 of 4

John Smith <noisybobx7@gmail.com> wrote in message <d880568b-df02-410b-95ab-5a6aaa94e578@b18g2000vbl.googlegroups.com>...
> hi,
> please help with Matlab beginner challenge
> i need to create an image with few geometrical objects (circles,
> ellipses) and then to apply some projective transforms
> my problem is that i cant understand how to actually "drow" on image
>
> image is AFAIU generally defined as [X;Y;3] matrix,
> functions as SCIRCLE1 can compute/return collection of points
> representing circle, but the problem is that points are not discrete ,
> coordinates are real numbers and not pixels
>
> how can i recompute the scircle output to be valid in image
> coordinates system ? i.e. how can i "pixelize" it?
>
> thanks for your attention, i really missing some basic concept and
> will appreciate your help
>
> John

'getframe' can be used to merge axes even though it is more commonly used to create movie frames.

Subject: correct approach to add geometrical objects to image

From: John Smith

Date: 21 Sep, 2009 06:37:08

Message: 3 of 4

On Sep 21, 12:32 am, "Dave Brackett" <davebrack...@hotmail.com> wrote:
> John Smith <noisybo...@gmail.com> wrote in message <d880568b-df02-410b-95ab-5a6aaa94e...@b18g2000vbl.googlegroups.com>...
> > hi,
> > please help with Matlab beginner challenge
> > i need to create an image with few geometrical objects (circles,
> > ellipses) and then to apply some projective transforms
> > my problem is that i cant understand how to actually "drow" on image
>
> > image is AFAIU generally  defined as [X;Y;3] matrix,
> > functions as SCIRCLE1 can compute/return collection of points
> > representing circle, but the problem is that points are not discrete ,
> > coordinates are real numbers and not pixels
>
> > how can i recompute the scircle output to be valid in image
> > coordinates system ? i.e. how can i "pixelize" it?
>
> > thanks for your attention, i really missing some basic concept and
> > will appreciate your help
>
> > John
>
> 'getframe' can be used to merge axes even though it is more commonly used to create movie frames.

Thanks, i try 'getframe'
but it looks like 'getframe' usage is a trick and not method

how problems of this kind are usually solved, is my method of
converting matlab functions output to pictures matrix data is wrong ?
would you target it in another way ?

thanks in advance for your help

Subject: correct approach to add geometrical objects to image

From: ImageAnalyst

Date: 21 Sep, 2009 10:41:34

Message: 4 of 4

On Sep 21, 2:37 am, John Smith <noisybo...@gmail.com> wrote:
> On Sep 21, 12:32 am, "Dave Brackett" <davebrack...@hotmail.com> wrote:
>
> > John Smith <noisybo...@gmail.com> wrote in message <d880568b-df02-410b-95ab-5a6aaa94e...@b18g2000vbl.googlegroups.com>...
> > > hi,
> > > please help with Matlab beginner challenge
> > > i need to create an image with few geometrical objects (circles,
> > > ellipses) and then to apply some projective transforms
> > > my problem is that i cant understand how to actually "drow" on image
>
> > > image is AFAIU generally  defined as [X;Y;3] matrix,
> > > functions as SCIRCLE1 can compute/return collection of points
> > > representing circle, but the problem is that points are not discrete ,
> > > coordinates are real numbers and not pixels
>
> > > how can i recompute the scircle output to be valid in image
> > > coordinates system ? i.e. how can i "pixelize" it?
>
> > > thanks for your attention, i really missing some basic concept and
> > > will appreciate your help
>
> > > John
>
> > 'getframe' can be used to merge axes even though it is more commonly used to create movie frames.
>
> Thanks, i try 'getframe'
> but it looks like 'getframe' usage is a trick and not method
>
> how problems of this kind are usually solved, is my method of
> converting matlab functions output to pictures matrix data is wrong ?
> would you target it in another way ?
>
> thanks in advance for your help-
------------------------------------------------------------------------------------------------
MATLAB is really weak in this area. There are some primitive
functions for drawing into the overlay (such as rectangle() if you
want to draw a circle, and line() if you want to draw a line) but no
real way that I know of to draw right into the underlying image. So
you have to use "tricks" such as getframe and then apply logical
operations. And you have to be careful with that since I think when
it gives you the rasterized version of the overlay it might be the
size of the image on the screen, not the true original matrix size of
the underlying image (I'd have to recheck this).

Tags for this Thread

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.

Contact us