Optical Flow in Computer Vision tool box
조회 수: 2 (최근 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
답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!