Save image in specific resolution in Matlab

后端 未结 2 1724
温柔的废话
温柔的废话 2020-12-17 05:31

I\'m trying for hours to simply output a certain plot in a specific resolution (320x240).

  xmax = 320; ymax = 240;
  xmin = 0; ymin = 0;
  figure;
  set(gcf         


        
2条回答
  •  醉梦人生
    2020-12-17 06:13

    There's an easier solution for this.

    Saying you have your figure, gcf, you capture the frame and just use imresize to edit the object property cdata of your frame.

    frame = getframe(gcf);
    frame.cdata = imresize(frame.cdata,[240, 320]);
    

    Then you can write your video using this frame, which now has the assigned resolution.

    writeVideo(VideoObj,frame);
    

    It works quite well.

提交回复
热议问题