Borrar filtros
Borrar filtros

output size of images written using getframe

2 visualizaciones (últimos 30 días)
Mahalakshmi
Mahalakshmi el 23 de Ag. de 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.

Respuestas (1)

Jan
Jan el 24 de Ag. de 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.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by