Question: OPTICAL FLOW You will compute the optical flow between frames frame _ 0 0 3 7 . png and frame _ 0 0 3 8
OPTICAL FLOW
You will compute the optical flow between frames framepng and framepng:
Read the images. Convert them to gray scale. Scale the values to be in the range by dividing the gray scale values by
Write a function u v opticalflowIIwindowsize,eigthr that implements LucasKanade optical flow algorithm. The input will be a pair of images and the output will be an optical flow field u v
Here, u and v are the components of the optical flow. windowsize is the length of the side of the window you will use for optical flow computation. eigthr is the threshold such that if it is larger than the smallest value of then the optical flow at that position will not be estimated set to be equal to
Run the code for windowsize Plot the resulting vector field of the optical flow algorithm on top of the first image for each windowsize. You can set eigthr to
Comment on your observations.
If you code with MATLAB, you can use the following functions:
The matlab command imgradientxy will compute Ix and Iy of an image:
Ix Iy imgradientxyI;
For computing weighted aggregates, you can use:
H fspecialgaussiansigma;
Iout imfilterIinH'same';
Use the function quiver to plot the vector field uv
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
