Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started