imshow and plot not displaying when using opticalFlow
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Paul Gresham
le 19 Mar 2016
Réponse apportée : Issa Al-Hmoud
le 20 Août 2019
Hi, Following the optical flow examples, the code below is behaving in an odd way. If I only use imshow on the image it will refresh in real-time (i.e comment out the plot command), however if I try to plot the optical flow vectors, I will only get the very last frame displayed once the loop has completed. Could anyone shed any light on this?
vidDevice = imaq.VideoDevice('winvideo', 1);
optical = opticalFlowHS;
nFrames = 0;
while (nFrames<100)
nFrames = nFrames + 1;
rgbData = step(vidDevice);
grey = rgb2gray(rgbData);
optFlow = estimateFlow(optical,grey);
imshow(rgbData);
hold on
plot(optFlow, 'DecimationFactor',[5 5],'ScaleFactor',25);
hold off
end
release(vidDevice);
Many thanks
0 commentaires
Réponse acceptée
Jan
le 19 Mar 2016
Try to insert a drawnow command to allow Matlab to update the display.
It will be faster to create the axes and image objects once before the loop and update the 'CData' property inside the loop only.
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Image Processing and Computer Vision dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!