Speeding up drawnow !
Mostra commenti meno recenti
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 Commenti
MathReallyWorks
il 22 Mag 2017
Hello Dan Matthews,
Check it out.
Dan Matthews
il 22 Mag 2017
Jan
il 22 Mag 2017
Risposte (0)
Categorie
Scopri di più su Image Preview and Device Configuration 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!