Thread Subject: getimage (IPT) weirdness

Subject: getimage (IPT) weirdness

From: Eddie

Date: 14 Oct, 2008 18:21:02

Message: 1 of 3

So, my understanding of the documentation of the getimage function from the Image Processing Toolbox is that if I say:

xp = linspace(-10,10,350);
fig = figure;
plot(xp,xp.^2);
A = getimage(fig);

A should now be a matrix that contains the data relating to the pixels of the figure with the plotted parbola. However, when I try this, A is empty.

What I am doing wrong?

Subject: getimage (IPT) weirdness

From: Walter Roberson

Date: 14 Oct, 2008 18:27:47

Message: 2 of 3

Eddie wrote:
> So, my understanding of the documentation of the getimage function from the Image Processing
> Toolbox is that if I say:

> xp = linspace(-10,10,350);
> fig = figure;
> plot(xp,xp.^2);
> A = getimage(fig);
 
> A should now be a matrix that contains the data relating to the pixels of the figure with
> the plotted parbola. However, when I try this, A is empty.
> What I am doing wrong?

Look at the documentation again. getimage() returns whatever is in the first CData array
that is found under the given handle. Objects of type image have CData arrays (as well as
some other kinds of objects such as objects of type patch), but plot() creates
objects of time axes and lineseries, neither of which have CData arrays.

Perhaps what you wanted to look at was getframe().

Subject: getimage (IPT) weirdness

From: Eddie

Date: 14 Oct, 2008 18:52:01

Message: 3 of 3

Walter Roberson <roberson@hushmail.com> wrote in message <ew5Jk.11$tV.9@newsfe08.iad>...
> Eddie wrote:
> > So, my understanding of the documentation of the getimage function from the Image Processing
> > Toolbox is that if I say:
>
> > xp = linspace(-10,10,350);
> > fig = figure;
> > plot(xp,xp.^2);
> > A = getimage(fig);
>
> > A should now be a matrix that contains the data relating to the pixels of the figure with
> > the plotted parbola. However, when I try this, A is empty.
> > What I am doing wrong?
>
> Look at the documentation again. getimage() returns whatever is in the first CData array
> that is found under the given handle. Objects of type image have CData arrays (as well as
> some other kinds of objects such as objects of type patch), but plot() creates
> objects of time axes and lineseries, neither of which have CData arrays.
>
> Perhaps what you wanted to look at was getframe().

OK, you're right. I saw that a figure was a valid argument to the function, and assumed magic would happen. getframe() won't work for my purposes though because I need to suppress the actual display of the plot, and getframe() requires the figure to be visible. Other suggestions?

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