Speeding up drawnow !
29 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!