Speeding up drawnow !
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
MathReallyWorks
on 22 May 2017
Hello Dan Matthews,
Check it out.
Dan Matthews
on 22 May 2017
Jan
on 22 May 2017
Answers (0)
Categories
Find more on Image Preview and Device Configuration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!