필터 지우기
필터 지우기

Hide figure while using geframe/videowriter function

조회 수: 4 (최근 30일)
Paschalis Garouniatis
Paschalis Garouniatis 2020년 4월 25일
댓글: Ameer Hamza 2020년 4월 27일
I am using the function getframe in order to obtain frames from a figure and the videowriter to create a video from those frames. I need to hide the figure during the process. I used the command set(gcf,'visible','off') but the process stops with an error message popping up. It states that the frames obtained from the function getframe are not of the same size. Is there a solution or another way to overcome this problem? Thanks in advance.

답변 (1개)

Ameer Hamza
Ameer Hamza 2020년 4월 25일
편집: Ameer Hamza 2020년 4월 25일
Call getframe with the axes handle
frame = getframe(gca); % gca is the current axes handle
It will only return the image of the axes.
  댓글 수: 8
Paschalis Garouniatis
Paschalis Garouniatis 2020년 4월 26일
편집: Paschalis Garouniatis 2020년 4월 26일
Your code works also with my MATLAB release. If it is possible try your code using the videoWriter function. My figure is an animation using plot function and illustrates a moving object. With some digging I found that getframe() cannot work with hidden figures and even if we use set(gcf,'visible','off') the figure window still pops up. In my case though, as I mentioned above, there is a problem with different frame size obtained using getframe() from each step of the plot. I think this has to do with the fact that the first frame size determines the size that will be used from the videoWriter. Anyway thank you for your time.
Ameer Hamza
Ameer Hamza 2020년 4월 27일
Can you write a small code snippet which gives an error with videoWriter?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by