cs510 l03 opencv intro - cs.colostate.edu€¦ · ã bruce a. draper & j. ross beveridge,...

15
ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

Upload: others

Post on 08-Aug-2020

5 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

OpenCVBasics

Lecture #3January 22, 2018

Page 2: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

… and so it begins

Page 3: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

Recall – “Hello World” Equivalent

Page 4: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

… and when run locally …

Page 5: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

Next up … Images

Page 6: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

Tutorial 4 – Changing Pixels

Page 10: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

Before and After Points

Page 13: cs510 L03 OpenCV Intro - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã 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 - cs.colostate.edu€¦ · ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018 OpenCV Basics Lecture #3 January 22, 2018

ã Bruce A. Draper & J. Ross Beveridge, January 22, 2018

Project 1 – Track the Frigatebird