Hide figure while using geframe/videowriter function
이전 댓글 표시
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
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
2020년 4월 25일
Ameer Hamza
2020년 4월 25일
If I understand correctly, you first want to make the figure window invisible and then apply the getframe on it. Right?
Paschalis Garouniatis
2020년 4월 25일
Ameer Hamza
2020년 4월 25일
Which MATLAB release are you using. I am able to do it in R2020a.
Paschalis Garouniatis
2020년 4월 25일
Ameer Hamza
2020년 4월 25일
Yes, following code work without any error on R2020a
plot(1:10);
set(gcf, 'Visible', 'off');
frame = getframe(gcf);
imshow(frame.cdata)
Paschalis Garouniatis
2020년 4월 26일
편집: Paschalis Garouniatis
2020년 4월 26일
Ameer Hamza
2020년 4월 27일
Can you write a small code snippet which gives an error with videoWriter?
카테고리
도움말 센터 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!