Effacer les filtres
Effacer les filtres

output size of images written using getframe

2 vues (au cours des 30 derniers jours)
Mahalakshmi
Mahalakshmi le 23 Août 2011
When I write images by using getframe, eventhough the input image is of size 512*512 the output images are of size 513*513 or 514*514. I don't understand why is this happening. Is there any way I restrict the output image size to 512*512. Thanks in advance.

Réponses (1)

Jan
Jan le 24 Août 2011
What exactly is "the input image"?
I did not find a method to create a 100% equal copy of a displayed figure. There can be 1 or 2 pixels difference, except I use the Java methods for a screen copy. But even then it is not trivial to get the contents of the figure exactly, because there can be different borders around the figure.
In addition MATLAB's HG objects must not be set on exact pixel positions, e.g. when using 'normalized' units -- in opposite to Java, as far as I understood. But e.g. MATLAB's GUI elements are based on Java objects and of course theire pixels are drawn to exact screen pixel positions...
When I create a UITable and UITree in a figure, resizing the figure let sometimes disappear the 1-pixel light grey line on the left (indowsXP, Matlab 2009a). It is hard to notice, but gets more striking, when a slider is created directly at the margin of the figure.
My conclusion: If an exact [WxH] output is needed, crop the captured matrix - at the right and/or left and top and/or bottom.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by