Setting resolution for getframe?

15 vues (au cours des 30 derniers jours)
Sonicflash
Sonicflash le 21 Juil 2022
Réponse apportée : Voss le 22 Juil 2022
I am currently working on turning a video into frames, apply a filter, then stitch back together in a frame.
However, I am using getframe to capture the image after applying my filter. Here is my problem section:
outputFileName = sprint('Frame %4.4d.png', frame);
frameImage = getframe(gca);
imwrite(frameImage.cdata, outputFileName, 'png');
From what I learned, I am taking the image that is off my monitor. This has caused there to be a resolution change from my original video. Is there a way I am able to change the resolution of each frame saved off? Or perhaps a better methodlogy?

Réponses (1)

Voss
Voss le 22 Juil 2022
Setting the resolution with getframe is not supported, but you can use exportgraphics or print, both of which support setting the resolution.
exportgraphics is available in R2020a or newer versions.
print only works with figures, not axes, but you could set your axes Position to cover the entire figure and it would turn out ok.
References: exportgraphics print

Catégories

En savoir plus sur Convert Image Type dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by