Thread Subject: really funny about getframe

Subject: really funny about getframe

From: vihang

Date: 8 Nov, 2005 09:57:41

Message: 1 of 4

Hi All
I have observed something really funny while using getframe in Matlab
R14 sp2.
Try this, run any application "Say winamp" and make sure the
application always remains on top and then run this following

I =imread('lena.jpg');
figure, imshow(I);
hold on;
M = getframe(gcf);
imshow(M.cdata);

P.N : If you donot have lena.jpg, use any other RGB image

You will notice that the getframe has even captured the winamp in
M.cdata
Really funny as the matlab help on getframe says

"Note that F = getframe; returns the contents of the current axes,
exclusive of the axis labels, title, or tick labels. F =
getframe(gcf); captures the entire interior of the current figure
window."

It doesnt say it can capture anything else on the screeen too which
is in front of it :)

Please comment
Regards
Vihang

Subject: really funny about getframe

From: vihang

Date: 9 Nov, 2005 01:03:48

Message: 2 of 4

Any comments to this topic...?
Vihang

Subject: really funny about getframe

From: Herbert Ramoser

Date: 9 Nov, 2005 08:19:45

Message: 3 of 4

vihang wrote:
> Hi All
> I have observed something really funny while using getframe in Matlab
> R14 sp2.
> Try this, run any application "Say winamp" and make sure the
> application always remains on top and then run this following
>
> I =imread('lena.jpg');
> figure, imshow(I);
> hold on;
> M = getframe(gcf);
> imshow(M.cdata);
>
> P.N : If you donot have lena.jpg, use any other RGB image
>
> You will notice that the getframe has even captured the winamp in
> M.cdata
> Really funny as the matlab help on getframe says
>
> "Note that F = getframe; returns the contents of the current axes,
> exclusive of the axis labels, title, or tick labels. F =
> getframe(gcf); captures the entire interior of the current figure
> window."

This is a well known behaviour of getframe. It captures the screen
content at the coordinates of the figure no matter whether the figure is
on top or not. Check the archives of this newsgroup to find work-arounds.

-Herbert

Subject: really funny about getframe

From: Mr SoleCentral

Date: 9 Nov, 2005 08:22:35

Message: 4 of 4

vihang wrote:
> Any comments to this topic...?
> Vihang

Another solution is to use the undocumented hardcopy command. This is
detailed in another thread but the short answer is

  X = hardcopy(fig, path, '-dOpenGL', '-r0');
  imwrite(X, path, 'png');

with path being the location on the disk you want the picture saved. The
path argument to hardcopy is ignored.

The full thread is

http://newsreader.mathworks.com/WebX?14@211.AVmeaWUA96B.0@.ef17d1b


Mr SC

--
http://solecentral.com.au
Buy online and save on Original Birkenstocks

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