Thread Subject: get an image array out of a figure

Subject: get an image array out of a figure

From: Evgeny Lahav

Date: 20 Jan, 2008 12:31:20

Message: 1 of 3

Hi,

I have a fig file which contains mainly the types - 'line' and 'patch'.

I want to get an image of certain size out of this fig.

actually what I need is to load the fig, and get an array which can be saved as an image.

do you have any suggestions?

thanks

Subject: get an image array out of a figure

From: Anh Huy Phan

Date: 20 Jan, 2008 14:40:03

Message: 2 of 3

Evgeny Lahav <evgeny_lahav@contractor.amat.com> wrote in
message
<420369.1200832332112.JavaMail.jakarta@nitrogen.mathforum.org>...
> Hi,
>
> I have a fig file which contains mainly the types - 'line'
and 'patch'.
>
> I want to get an image of certain size out of this fig.
>
> actually what I need is to load the fig, and get an array
which can be saved as an image.
>
> do you have any suggestions?
>
> thanks

If you want to capture a figure or an axes to a matrix, try
to use getframe and frame2im
E.g
    
    im = frame2im(getframe(gcf,rec));

or
    im = frame2im(getframe(gca,rec));

rec is the area to be copied.

Anh Huy Phan
RIKEN - BSI

Subject: get an image array out of a figure

From: Evgeny Lahav

Date: 21 Jan, 2008 11:35:52

Message: 3 of 3

thanks a lot - it really helped.

for anybody who might be interested, this is the function:

    open(file);
    h=gca;
    F=getframe(h);
    im=F.cdata;

the input is 'file' - which is a fig file
the output is im - which is rgb image

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

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com