Answered step by step
Verified Expert Solution
Link Copied!

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 frame_0037.png and frame_0038.png:
Read the images. Convert them to gray scale. Scale the values to be in the range [0,1], by dividing the gray scale values by 255.
Write a function [u, v]= optical_flow(I1,I2,window_size,eig_thr) that implements Lucas-Kanade 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. window_size is the length of the side of the window you will use for optical flow computation. eig_thr 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 (0,0).)
Run the code for window_size =5,7,9. Plot the resulting vector field of the optical flow algorithm on top of the first image for each window_size. You can set eig_thr to 0.01.
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]= imgradientxy(I);
For computing weighted aggregates, you can use:
H = fspecial('gaussian',[55],sigma);
Iout = imfilter(Iin,H,'same');
Use the function quiver to plot the vector field (u,v).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions