How to find the optical flow of the corner point of a red box in a video?

9 ビュー (過去 30 日間)
Joel Nunes
Joel Nunes 2020 年 3 月 24 日
回答済み: darova 2020 年 3 月 24 日
I extracted all the frames of the video.I have to find the optical flow of the left corner of the redbox over subsequent frames.
I have created a red mask for the red box and found the corners using the Harrisfeatures, how do I iterate over all the frames and store the corner points of the red box ina array?
for n=1:150
pic{n}= imread(sprintf('image%03d.png',n));
% points = detectHarrisFeatures(rgb2gray(pic{1}));
red_channel = pic{n}(:, :, 1);
green_channel =pic{n}(:, :, 2);
blue_channel = pic{n}(:, :, 3);
redMask = red_channel > 200 & green_channel < 200 & blue_channel < 200;
points = detectHarrisFeatures(redMask);
end
pointImage = insertMarker(pic{150=}, points.Location, '+', 'Color', 'blue');

回答 (1 件)

darova
darova 2020 年 3 月 24 日
What about find()?
[y,x] = find(redMask,1,'first')

カテゴリ

Help Center および File ExchangeOptics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by