Course COMP 7116 Computer Vision Image Formation Geometric

  • Slides: 27
Download presentation
Course : COMP 7116 – Computer Vision Image Formation: Geometric Camera Models Session 02

Course : COMP 7116 – Computer Vision Image Formation: Geometric Camera Models Session 02 Prof. Dr. Widodo Budiharto 2018

Outline • • • Pinhole perspective Projective geometry Projection Matrix Adding a lens Focal

Outline • • • Pinhole perspective Projective geometry Projection Matrix Adding a lens Focal Length, Aperture, and Depth of Fields

Camera and World Geometry

Camera and World Geometry

Pinhole Perspective f c f = focal length c = center of the camera

Pinhole Perspective f c f = focal length c = center of the camera Figure from Forsyth

Mapping from 3 D to 2 D

Mapping from 3 D to 2 D

Projection • Its is just point of View!

Projection • Its is just point of View!

Projective Geometry

Projective Geometry

Vanishing Points and Lines • Parallel lines in the world intersect in the image

Vanishing Points and Lines • Parallel lines in the world intersect in the image at “vanishing points”

Vanishing Points and Lines

Vanishing Points and Lines

Projection • World coordinate image coordinates

Projection • World coordinate image coordinates

Common Image File Formats • • • GIF (Graphic Interchange Format) PNG (Portable Network

Common Image File Formats • • • GIF (Graphic Interchange Format) PNG (Portable Network Graphics) JPEG (Joint Photographic Experts Group) TIFF (Tagged Image File Format) PGM (Portable Gray Map) FITS (Flexible Image Transport System) T 0283 - Computer Vision 11

Color and grayscale image = ( (0. 3 * R) + (0. 59 *

Color and grayscale image = ( (0. 3 * R) + (0. 59 * G) + (0. 11 * B) ) T 0283 - Computer Vision 12

Optical Flow • Optical flow or optic flow is the pattern of apparent motion

Optical Flow • 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. T 0283 - Computer Vision 13

Display. Image. cpp // Menampilkan Image menggunakan cv. Load. Image #include "stdafx. h" #include

Display. Image. cpp // Menampilkan Image menggunakan cv. Load. Image #include "stdafx. h" #include <cv. h> #include <cxcore. h> #include <highgui. h> int _tmain(int argc, _TCHAR* argv[]) { Ipl. Image *img = cv. Load. Image("f: handsome. jpg"); cv. Named. Window("Open. CV", 1); cv. Show. Image("Open. CV", img); cv. Wait. Key(0); cv. Destroy. Window("Open. CV "); cv. Release. Image(&img); return 0; } T 0283 - Computer Vision 14

C++ 2. x Style //Display. Image 2. cpp #include "stdafx. h" #include <stdlib. h>

C++ 2. x Style //Display. Image 2. cpp #include "stdafx. h" #include <stdlib. h> #include <cv. hpp> #include <cxcore. hpp> #include <highgui. h> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { cv: : Mat img=cv: : imread("f: /fruits. jpg"); cv: : imshow("Belajar Open. CV", img); //tampilkan cv: : wait. Key(); return EXIT_SUCCESS; } T 0283 - Computer Vision 15

Camera int main(int argc, char* argv[]) { Video. Capture cap(0); // open the video

Camera int main(int argc, char* argv[]) { Video. Capture cap(0); // open the video camera no. 0 if (!cap. is. Opened()) // if not success, exit program { cout << "Cannot open the video cam" << endl; return -1; } T 0283 - Computer Vision 16

Face Library • String face_cascade_name = "lbpcascade_frontalface. xml"; • String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses. xml";

Face Library • String face_cascade_name = "lbpcascade_frontalface. xml"; • String eyes_cascade_name = "haarcascade_eye_tree_eyeglasses. xml"; T 0283 - Computer Vision 17

sprintf(lbl. Object, "%s", prob_teta. Obstacle); cv: : put. Text(frame, "Distance Obs. 1: 53", cv.

sprintf(lbl. Object, "%s", prob_teta. Obstacle); cv: : put. Text(frame, "Distance Obs. 1: 53", cv. Point(10, 40), 1, 2, cv: : Scalar(255, 10, 0, 3)); Bina Nusantara University 18

Example • Displaying face detected from webcam with ellipse and rectangle usually need by

Example • Displaying face detected from webcam with ellipse and rectangle usually need by robotics engineer, because it can be used to measure distance between camera and the object, the rectangle codes : cv. Circle( img, center, radius, color, 3, 8, 0 ); cv. Rectangle( img, cv. Point( r->x, r->y ), cv. Point( r->x + r->width, r->y + r>height ), CV_RGB( 0, 255, 0 ), 1, 8, 0 ); Bina Nusantara University 19

Stereo Vision Proyeksi titik pada kamera • 10/19/2021 Titik di kerangka image depan Iq(Iqx,

Stereo Vision Proyeksi titik pada kamera • 10/19/2021 Titik di kerangka image depan Iq(Iqx, Iqy) merupakan proyeksi titik pada kerangka kamera Cq(Cqx, Cqy, Cqz) ke kerangka image depan, dimana f melambangkan focal length. 20

Stereo Model • Titik 3 dimensi pada kerangka kamera stereo dapat direkonstruksi menggunakan proyeksi

Stereo Model • Titik 3 dimensi pada kerangka kamera stereo dapat direkonstruksi menggunakan proyeksi titik 2 dimensi dari kerangka image kanan dan kiri 10/19/2021 21

Depth Estimation • Menggunakan kamera stereo, diperoleh posisi wajah tiap moving obstacle sehingga dapat

Depth Estimation • Menggunakan kamera stereo, diperoleh posisi wajah tiap moving obstacle sehingga dapat diperkirakan dihitung jarak moving obstacle tersebut. • Posisi titik 3 dimensi pada stereo camera : Catatan: 10/19/2021 (Purwanto D. , 2001) 22

Motion History

Motion History

Tracking dengan motion history a) b) c) Deteksi orang lewat dan arah gerak menggunakan

Tracking dengan motion history a) b) c) Deteksi orang lewat dan arah gerak menggunakan motion history 10/19/2021 24

Machine Vision

Machine Vision

Exercise • Buat Program dengan webcam untuk deteksi wajah dan mata, serta wajah dibuat

Exercise • Buat Program dengan webcam untuk deteksi wajah dan mata, serta wajah dibuat kotak.

References • Richard Szeliski. (2011). Computer Vision: Algorithms and applications. 01. Springer. Chapter 1

References • Richard Szeliski. (2011). Computer Vision: Algorithms and applications. 01. Springer. Chapter 1 & 2. • David Forsyth and Jean Ponce. (2002). Computer Vision: A Modern Approach. 02. Prentice Hall. Chapter 1 & 2. • https: //cs. brown. edu/courses/cs 143/lectures/02. pdf