Thread Subject: Saving a overlay and image figure

Subject: Saving a overlay and image figure

From: Nicholas Beser

Date: 7 Sep, 2008 21:10:19

Message: 1 of 9

I was able to create a very large image with a line overlay in MATLAB 2008a. I tried to use getimage to retrieve the combination of image and line overlay, however the function only returned the image (no line art).

Here is the code fragment:
h=imshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
hold on
for k=2:frmcnt
    xl=[pointlist(1,k-1) pointlist(1,k)];
    yl=[pointlist(2,k-1) pointlist(2,k)];
    plot(xl,yl,'Color','b');
end
Anewimg=getimage(h);
hold off

Is there some other function that I should use to save the entire figure to a graphics file (such as PNG or JPG)? While I can manually save the figure as a jpg, it is not saved at the full resolution, only at display resolution. Since the display is at 17%, that is not sufficient.

Thank-you,

Nick Beser
nick.beser@jhuapl.edu

Subject: Saving a overlay and image figure

From: Mars creature

Date: 8 Sep, 2008 00:53:23

Message: 2 of 9

On Sep 7, 5:10 pm, "Nicholas Beser" <nick.be...@jhuapl.edu> wrote:
> I was able to create a very large image with a line overlay in MATLAB 2008a. I tried to use getimage to retrieve the combination of image and line overlay, however the function only returned the image (no line art).
>
> Here is the code fragment:
> h=imshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
> hold on
> for k=2:frmcnt
> xl=[pointlist(1,k-1) pointlist(1,k)];
> yl=[pointlist(2,k-1) pointlist(2,k)];
> plot(xl,yl,'Color','b');
> end
> Anewimg=getimage(h);
> hold off
>
> Is there some other function that I should use to save the entire figure to a graphics file (such as PNG or JPG)? While I can manually save the figure as a jpg, it is not saved at the full resolution, only at display resolution. Since the display is at 17%, that is not sufficient.
>
> Thank-you,
>
> Nick Beser
> nick.be...@jhuapl.edu

Not sure if it works for you.
You can use 'print' to save the figure to a graphic file, such as
jpg,eps etc. 300dpi (-r300) should be enough to have a nice printout.
Jinbo

Subject: Saving a overlay and image figure

From: Nicholas Beser

Date: 8 Sep, 2008 14:17:01

Message: 3 of 9

Thank-you for your reply. I guess I did not make the problem clear. I know I can save the figure, but it saves it at the screen resolution (1200x900). The native resolution of the mosaic was 5300x1500. While I can save the basic image obtained by getImage, the overlay is not retrieved with getImage.

I saw on a earlier post, someone had asked Steve Eddings the same question, and was told to call the technical support. That was about a year ago.

Nick

Mars creature <jinbow@gmail.com> wrote in message <5c654054-d26c-4cf3-9865-171a56e230ad@p25g2000hsf.googlegroups.com>...
> On Sep 7, 5:10 pm, "Nicholas Beser" <nick.be...@jhuapl.edu> wrote:
> > I was able to create a very large image with a line overlay in MATLAB 2008a. I tried to use getimage to retrieve the combination of image and line overlay, however the function only returned the image (no line art).
> >
> > Here is the code fragment:
> > h=imshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
> > hold on
> > for k=2:frmcnt
> > xl=[pointlist(1,k-1) pointlist(1,k)];
> > yl=[pointlist(2,k-1) pointlist(2,k)];
> > plot(xl,yl,'Color','b');
> > end
> > Anewimg=getimage(h);
> > hold off
> >
> > Is there some other function that I should use to save the entire figure to a graphics file (such as PNG or JPG)? While I can manually save the figure as a jpg, it is not saved at the full resolution, only at display resolution. Since the display is at 17%, that is not sufficient.
> >
> > Thank-you,
> >
> > Nick Beser
> > nick.be...@jhuapl.edu
>
> Not sure if it works for you.
> You can use 'print' to save the figure to a graphic file, such as
> jpg,eps etc. 300dpi (-r300) should be enough to have a nice printout.
> Jinbo

Subject: Saving a overlay and image figure

From: ImageAnalyst

Date: 8 Sep, 2008 17:45:16

Message: 4 of 9

On Sep 7, 5:10=A0pm, "Nicholas Beser" <nick.be...@jhuapl.edu> wrote:
> I was able to create a very large image with a line overlay in MATLAB 200=
8a. I tried to use getimage to retrieve the combination of image and line o=
verlay, however the function only returned the image (no line art).
>
> Here is the code fragment:
> h=3Dimshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
> hold on
> for k=3D2:frmcnt
> =A0 =A0 xl=3D[pointlist(1,k-1) pointlist(1,k)];
> =A0 =A0 yl=3D[pointlist(2,k-1) pointlist(2,k)];
> =A0 =A0 plot(xl,yl,'Color','b');
> end
> Anewimg=3Dgetimage(h);
> hold off
>
> Is there some other function that I should use to save the entire figure =
to a graphics file (such as PNG or JPG)? While I can manually save the figu=
re as a jpg, it is not saved at the full resolution, only at display resolu=
tion. Since the display is at 17%, that is not sufficient.
>
> Thank-you,
>
> Nick Beser
> nick.be...@jhuapl.edu

-----------------------------------------------------------------
Good question and I don't think I've seen a satisfactory answer yet.
I think there's some sort of incompatibility between how it draws
overlay graphics and the underlying pixel based bitmap. As you know
the image may display on screen in the little axes which will have a
completely different number of pixels on your screen than in the
underlying pixel image. And the graphics are drawn to fit in this
screen image. The methods I've seen all produce saved images that are
different dimensions than your original image (for example, the other
responses to your question).
Still looking for what we really want. . . . . . .
ImageAnalyst

Subject: Saving a overlay and image figure

From: Joaquim Luis

Date: 8 Sep, 2008 19:06:02

Message: 5 of 9

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <cf49d90b-baef-42bc-a5ad-36ffd3282dcd@d45g2000hsc.googlegroups.com>...
> On Sep 7, 5:10=A0pm, "Nicholas Beser" <nick.be...@jhuapl.edu> wrote:
> > I was able to create a very large image with a line overlay in MATLAB 200=
> 8a. I tried to use getimage to retrieve the combination of image and line o=
> verlay, however the function only returned the image (no line art).
> >
> > Here is the code fragment:
> > h=3Dimshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
> > hold on
> > for k=3D2:frmcnt
> > =A0 =A0 xl=3D[pointlist(1,k-1) pointlist(1,k)];
> > =A0 =A0 yl=3D[pointlist(2,k-1) pointlist(2,k)];
> > =A0 =A0 plot(xl,yl,'Color','b');
> > end
> > Anewimg=3Dgetimage(h);
> > hold off
> >
> > Is there some other function that I should use to save the entire figure =
> to a graphics file (such as PNG or JPG)? While I can manually save the figu=
> re as a jpg, it is not saved at the full resolution, only at display resolu=
> tion. Since the display is at 17%, that is not sufficient.
> >
> > Thank-you,
> >
> > Nick Beser
> > nick.be...@jhuapl.edu
>
> -----------------------------------------------------------------
> Good question and I don't think I've seen a satisfactory answer yet.
> I think there's some sort of incompatibility between how it draws
> overlay graphics and the underlying pixel based bitmap. As you know
> the image may display on screen in the little axes which will have a
> completely different number of pixels on your screen than in the
> underlying pixel image. And the graphics are drawn to fit in this
> screen image. The methods I've seen all produce saved images that are
> different dimensions than your original image (for example, the other
> responses to your question).
> Still looking for what we really want. . . . . . .
> ImageAnalyst


Hi,
It was for these and other reason that I created the IMCAPTURE. Some "clients" seam to be happy with it as well.
www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13355&objectType=FILE

J. Luis

Subject: Saving a overlay and image figure

From: Nicholas Beser

Date: 8 Sep, 2008 19:55:03

Message: 6 of 9

"Joaquim Luis" <jluis@--ualg--.pt> wrote in message <ga3t2q$7l7$1@fred.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <cf49d90b-baef-42bc-a5ad-36ffd3282dcd@d45g2000hsc.googlegroups.com>...

>
> Hi,
> It was for these and other reason that I created the IMCAPTURE. Some "clients" seam to be happy with it as well.
> www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13355&objectType=FILE
>
> J. Luis

Joaquim,

Thank-you. Your code did the trick. I did notice that the overlay plot was interpolated up to a very thick line (but the results are quite satisfactory). I think it is due to the scaling that was done when the figure was created (17% scale).

Nick


Subject: Saving a overlay and image figure

From: Joaquim Luis

Date: 8 Sep, 2008 22:40:18

Message: 7 of 9

"Nicholas Beser" <nick.beser@jhuapl.edu> wrote in message <ga3vun$cn2$1@fred.mathworks.com>...
> "Joaquim Luis" <jluis@--ualg--.pt> wrote in message <ga3t2q$7l7$1@fred.mathworks.com>...
> > ImageAnalyst <imageanalyst@mailinator.com> wrote in message <cf49d90b-baef-42bc-a5ad-36ffd3282dcd@d45g2000hsc.googlegroups.com>...
>
> >
> > Hi,
> > It was for these and other reason that I created the IMCAPTURE. Some "clients" seam to be happy with it as well.
> > www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=13355&objectType=FILE
> >
> > J. Luis
>
> Joaquim,
>
> Thank-you. Your code did the trick. I did notice that the overlay plot was interpolated up to a very thick line (but the results are quite satisfactory). I think it is due to the scaling that was done when the figure was created (17% scale).

Humm... I see, but there is nothing we can do about it. The screen capture process is beyond control.

Joaquim

Subject: Saving a overlay and image figure

From: Alan B

Date: 9 Sep, 2008 03:53:02

Message: 8 of 9

Its not ideal, but you could write your own line-drawing function and just write black points directly into the array, then imwrite. Line drawing isn't too hard, and you can easily transform coordinates from data-space to pixel-space. Lacking a better solution, this would certainly work, which is better than the alternative.

Subject: Saving a overlay and image figure

From: Shanmugam Kannappan

Date: 9 Sep, 2008 05:10:20

Message: 9 of 9

Hello Sir,
getimage command will not work out for getting the content of the figure window.

I suggest that u can use getframe command.The example code as below.

imshow('pout.tif')
hold on
plot(1:260,150)
s=getframe;
figure
imshow(s.cdata)

Regards

Shanmugam.K

"Nicholas Beser" <nick.beser@jhuapl.edu> wrote in message <ga1fvr$4em$1@fred.mathworks.com>...
> I was able to create a very large image with a line overlay in MATLAB 2008a. I tried to use getimage to retrieve the combination of image and line overlay, however the function only returned the image (no line art).
>
> Here is the code fragment:
> h=imshow(imgtest,'XData',XData,'YData',YData);title(frmstr1);
> hold on
> for k=2:frmcnt
> xl=[pointlist(1,k-1) pointlist(1,k)];
> yl=[pointlist(2,k-1) pointlist(2,k)];
> plot(xl,yl,'Color','b');
> end
> Anewimg=getimage(h);
> hold off
>
> Is there some other function that I should use to save the entire figure to a graphics file (such as PNG or JPG)? While I can manually save the figure as a jpg, it is not saved at the full resolution, only at display resolution. Since the display is at 17%, that is not sufficient.
>
> Thank-you,
>
> Nick Beser
> nick.beser@jhuapl.edu

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
 

MATLAB Central Terms of Use

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 Terms prior to use.

Contact us at files@mathworks.com