Effacer les filtres
Effacer les filtres

Optical Flow in Computer Vision tool box

3 vues (au cours des 30 derniers jours)
KaMu
KaMu le 16 Mar 2012
In the vision.optical flow, How can I plot the vector direction. Quiver draw the vector into image and i have video player. It also requires block size. Here is the code that i have (it is the same one in the example):
-------
hvfr = vision.VideoFileReader('MyVid.mov', ...
'ImageColorSpace', 'Intensity', ...
'VideoOutputDataType', 'uint8');
hidtc = vision.ImageDataTypeConverter;
hof = vision.OpticalFlow('ReferenceFrameDelay', 2);
hof.OutputValue = 'Horizontal and vertical components in complex form';
hmean1 = vision.Mean;
hsi = vision.ShapeInserter('Shape','Lines','BorderColor','Custom', 'CustomBorderColor', 255);
hvp = vision.VideoPlayer('Name', 'Motion Vector');
ii=0;
while ~isDone(hvfr)&&ii<1000
frame = step(hvfr);
im = step(hidtc, frame);
of = step(hof, im);
lines = videooptflowlines(of, 20); % generate coordinate points
if ~isempty(lines)
out = step(hsi, im, lines); % draw lines to indicate flow
step(hvp, out);%show it on the video player
end
ii=ii+1;
end
release(hvp);
release(hvfr);
--------
Thanks

Réponses (0)

Catégories

En savoir plus sur Optics 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!

Translated by