Download - Matlab Tutorial. Optical Flow - CRCV
![Page 1: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/1.jpg)
Matlab Tutorial. Optical Flow
Gonzalo Vaca-Castano
REU 2013
![Page 2: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/2.jpg)
Optical flow • Definition
– Optical flow or optic flow is the pattern of apparent motion of objects, surfaces, and edges in a visual scene caused by the relative motion between an observer (an eye or a camera) and the scene
![Page 3: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/3.jpg)
2D motion constraint
![Page 4: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/4.jpg)
2D motion constraint
Are the components of Optical Flow
2D Motion constraint
![Page 5: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/5.jpg)
![Page 6: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/6.jpg)
![Page 7: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/7.jpg)
Lucas-Kanade implementation
![Page 8: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/8.jpg)
Lucas-Kanade implementation
![Page 9: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/9.jpg)
Optical Flow code (Download it from webpage)
addpath('LucasKanade');
i1=imread(‘car1.jpg');
i2=imread(‘car2.jpg');
[u,v] =LucasKanade(rgb2gray(i1),rgb2gray(i2),20);
f(:,:,1)=u;
f(:,:,2)=v;
imshow(flowtocolor(f));
![Page 10: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/10.jpg)
Optical Flow (input)
![Page 11: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/11.jpg)
Optical Flow (input)
![Page 12: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/12.jpg)
Optical Flow (Output)
![Page 13: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/13.jpg)
![Page 14: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/14.jpg)
Optical Flow code (Download it from webpage)
addpath('LucasKanade');
i1=imread('table1.jpg');
i2=imread('table2.jpg');
[u,v,cert] =HierarchicalLK(rgb2gray(i1),rgb2gray(i2),3,2,2,1)
f(:,:,1)=u;
f(:,:,2)=v;
flowtocolor(f)
![Page 15: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/15.jpg)
Optical Flow with pyramids (input)
![Page 16: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/16.jpg)
Optical Flow with pyramids (input)
![Page 17: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/17.jpg)
Optical Flow with pyramids (output)
![Page 18: Matlab Tutorial. Optical Flow - CRCV](https://reader030.vdocuments.us/reader030/viewer/2022020119/586869301a28ab357d8b4a5d/html5/thumbnails/18.jpg)
Optical Flow with Pyramids