cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3...
Transcript of cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3...
![Page 1: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/1.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
OpenCVBasics
Lecture #3January 22, 2018
![Page 2: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/2.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
… and so it begins
![Page 3: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/3.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Recall – “Hello World” Equivalent
![Page 4: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/4.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
… and when run locally …
![Page 5: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/5.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Next up … Images
![Page 6: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/6.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
MAT as of OpenCV 2.0 (and up)• Memory management handled for us.• A tremendous amount of information hiding.• All and all – a good thing.• All common types supported– Gray scale– Color (RGB, HSV, ..)– In case you wondered:• “There are more than 150 color-space conversion
methods available in OpenCV.”
![Page 7: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/7.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Tutorial 2
Further practice reading, writing and now modifying images.
![Page 8: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/8.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Tutorial 3 – Printing (a few) pixels
FYI – Pixels from the center of the right eye.
![Page 9: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/9.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Tutorial 4 – Changing Pixels
![Page 10: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/10.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Some Observations• Pixels are shared between two Mat objects.
• Iterators simplify access.
• A color image consists of 3 channels.– Hence, the Vec3b usage
• Why is the 3rd channel set to 255– The goal is to give the Red Panda red eye.
![Page 11: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/11.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Tutorial 5 – Affine Transforms• We return to image warping, but now making
it happen in OpenCV
![Page 12: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/12.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Before and After Points
![Page 13: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/13.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Make it so …Recall, this is what we discussed about 2 lectures ago when we used before/after representations of 3 2D points to define a 6DOF transform.
![Page 14: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/14.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Warp then Rotate
Pay attention to the center of rotation.
![Page 15: cs510 L03 OpenCV Intro - Colorado State University · 2018. 1. 22. · OpenCV Basics Lecture #3 January 22, 2018. ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 … and](https://reader035.fdocuments.us/reader035/viewer/2022071219/6053f128d3da2f68fd39ac83/html5/thumbnails/15.jpg)
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018
Project 1 – Track the Frigatebird