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:
Increase image canvas

Subject: Increase image canvas

From: audley james

Date: 18 Apr, 2011 00:40:20

Message: 1 of 6

Hi,

I have an image 640x 480. The figure window in matlab fits to the image where the first pixel value is 1,1.

How can I increase the canvas of the image space in the figure, window, such that I can also access values that are negative and so forth.

thanks
audley

Subject: Increase image canvas

From: ImageAnalyst

Date: 18 Apr, 2011 01:56:00

Message: 2 of 6

audley:
You can use padarray(), but it also has normal array indexing like all
MATLAB arrays, meaning that the upper left element is always (1,1), no
matter what. If for example, you padded it with a single layer of
elements, then to get this to be (0,0) when you refer to it, you'd
have to do the index bookkeeping yourself. No way around it.

Subject: Increase image canvas

From: Yumnam Kirani

Date: 18 Apr, 2011 08:13:03

Message: 3 of 6

"audley james" <audleyer@gmail.com> wrote in message <iog19k$drf$1@fred.mathworks.com>...
> Hi,
>
> I have an image 640x 480. The figure window in matlab fits to the image where the first pixel value is 1,1.
>
> How can I increase the canvas of the image space in the figure, window, such that I can also access values that are negative and so forth.
>
> thanks
> audley

In your image 640x480, what is the convas size and what is the image size? What is the difference bewteen convas size and image size in your context? MATLAB supports only positive indices. What actually is your requirement?

Yumnam Kirani Singh
Tronglaobi Awang Leikai

Subject: Increase image canvas

From: audley james

Date: 18 Apr, 2011 14:06:20

Message: 4 of 6

Hello,


Well my problem is I have a line on the image and I cannot see it since one of its endpoint coordinate is negative.

I have an image at the website :

http://img52.imageshack.us/i/outsidea.jpg/


I draw a line as follows :

line([146 -52], [331 396],'Color', 'r','LineStyle','-','Linewidth' ,2.5,'marker' , 'o')

The line goes outside the image. I can see it when I zoom into the figure outside. But not when I zoom out. How can I fix this ?

thank you for helping
Audley

Subject: Increase image canvas

From: ImageAnalyst

Date: 18 Apr, 2011 14:49:05

Message: 5 of 6

You might have to call the Mathworks or just experiment around. It's
quirky. Sometimes the line is there and sometimes it's not. If both
endpoints are inside the image, it plots. If one point is in the
image and one point is outside the image, it will plot the part inside
the image only, and the part of the line outside the image gets
chopped off. If both endpoints are outside the image it doesn't seem
to plot anything, but I'm not sure if that's really the actual rules
it's using.

Subject: Increase image canvas

From: Steven_Lord

Date: 18 Apr, 2011 16:34:54

Message: 6 of 6



"audley james" <audleyer@gmail.com> wrote in message
news:iohggr$kkm$1@ginger.mathworks.com...
> Hello,
>
>
> Well my problem is I have a line on the image and I cannot see it since
> one of its endpoint coordinate is negative.
> I have an image at the website :
>
> http://img52.imageshack.us/i/outsidea.jpg/
>
>
> I draw a line as follows :
>
> line([146 -52], [331 396],'Color', 'r','LineStyle','-','Linewidth'
> ,2.5,'marker' , 'o')
>
> The line goes outside the image. I can see it when I zoom into the figure
> outside. But not when I zoom out. How can I fix this ?

Use XLIM to modify the axis limits after creating the line or change the
XLimMode property to 'auto' before creating the line so that MATLAB
automatically adjusts the limits to reflect the extent of the line object..

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with 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