Speeding up drawnow !
Mostrar comentarios más antiguos
Hello Image analysis enthusiasts,
I have a GUI which accesses the camera, takes snapshot of the first available frame and updates the figure by setting the CData of the image data in every iteration of the loop. I want to achieve everything within 10-15 ms. Unfortunately, drawnow is very slow and alone takes 70 ms. Here is the sample code:
vid=videoinput('qimaging',1);
img=zeros(1600,1200,1);
h=imshow(img); % creates figure handle
start(vid);
for i=1:10000
image=peekdata(vid,1); % takes 6 milliseconds%
set(h,'CData',image); % takes 1 ms%
drawnow %takes 70 ms%
end
I have two questions: 1) Is there a way to speed up drawnow; I think currently, it updates the other uipanel and uicontrols in the GUI also and hence, it is slower. 2) I am confused if drawnow is really needed as I am already changing the imagedata by using 'set' in every frame. However, if I remove drawnow, my figures don't get updated.
Any help is greatly appreciated. Thanks!
3 comentarios
MathReallyWorks
el 22 de Mayo de 2017
Hello Dan Matthews,
Check it out.
Dan Matthews
el 22 de Mayo de 2017
Jan
el 22 de Mayo de 2017
Respuestas (0)
Categorías
Más información sobre Image Preview and Device Configuration en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!