Optical Flow in Computer Vision tool box

3 次查看(过去 30 天)
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

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Optics 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by