Hide figure while using geframe/videowriter function
Mostra commenti meno recenti
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.
Risposte (1)
Ameer Hamza
il 25 Apr 2020
Modificato: Ameer Hamza
il 25 Apr 2020
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 Commenti
Paschalis Garouniatis
il 25 Apr 2020
Ameer Hamza
il 25 Apr 2020
If I understand correctly, you first want to make the figure window invisible and then apply the getframe on it. Right?
Paschalis Garouniatis
il 25 Apr 2020
Ameer Hamza
il 25 Apr 2020
Which MATLAB release are you using. I am able to do it in R2020a.
Paschalis Garouniatis
il 25 Apr 2020
Ameer Hamza
il 25 Apr 2020
Yes, following code work without any error on R2020a
plot(1:10);
set(gcf, 'Visible', 'off');
frame = getframe(gcf);
imshow(frame.cdata)
Paschalis Garouniatis
il 26 Apr 2020
Modificato: Paschalis Garouniatis
il 26 Apr 2020
Ameer Hamza
il 27 Apr 2020
Can you write a small code snippet which gives an error with videoWriter?
Categorie
Scopri di più su Animation in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!