finding a velocity of moving object using optical flow

1 回表示 (過去 30 日間)
Dalia
Dalia 2023 年 9 月 21 日
コメント済み: Cris LaPierre 2023 年 9 月 22 日
I have a matlab based application in which I compute the optical flow by the following code. How can I find the resultant vector of velocity for the moving object and what are the units of u and v?
%%Extraction of frames
>> obj = VideoReader(filename);
for k = 1 : 2 %fill in the appropriate number
this_frame = readFrame(obj);
thisfig = figure();
thisax = axes('Parent', thisfig);
image(this_frame, 'Parent', thisax);
title(thisax, sprintf('Frame #%d', k));
end
%% optical flow
>> I1=imread('Framep#1.png');
>> I2=imread('Framep#2.png');
>> modelname = 'ex_blkopticalflow.slx';
>> open_system(modelname)
>> out = sim(modelname);
>> Vx = real(out.simout);
>> Vy = imag(out.simout);
>> img = out.simout1;
>> flow = opticalFlow(Vx,Vy);
>> figure
imshow(img)
hold on
plot(flow,'DecimationFactor',[5 5],'ScaleFactor',40)
  1 件のコメント
Cris LaPierre
Cris LaPierre 2023 年 9 月 22 日
You might be interested in our Computer Vision for Engineering and Science specialization. It's free to enroll.
Here's a relevant video from Course 3: Applying Optical Flow

サインインしてコメントする。

回答 (0 件)

カテゴリ

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