1 / 23

Recognition II Session 1 2

Course : COMP7116 – Computer Vision Effective Period : February 2018. Recognition II Session 1 2. Learning Objectives. After carefully listening this lecture, students will be able to do the following : Face Recognition Systems using PCA, LDA etc. Opencv Contrib.

rileyl
Download Presentation

Recognition II Session 1 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Course : COMP7116 – Computer Vision Effective Period : February 2018 Recognition IISession 12

  2. Learning Objectives • After carefullylistening this lecture, students will be able to do the following : • Face Recognition Systems using PCA, LDA etc

  3. OpencvContrib • OpenCV has three built-in face recognizers, here are the names of those face recognizers and their OpenCV calls: • EigenFaces (PCA) – cv2.face.createEigenFaceRecognizer() • FisherFaces (LDA) – cv2.face.createFisherFaceRecognizer() • Local Binary Patterns Histograms (LBPH) – cv2.face.createLBPHFaceRecognizer()

  4. PCA (PrinciPAL Component ANalysis • Training set of m images of size N*N are represented by vectors of size N2 x1,x2,x3,…,xM Example Turk, M., Pentland, A.: Eigenfaces for recognition. J. Cognitive Neuroscience 3 (1991) 71–86.

  5. PCA • Let training set of image xi, and the average training set m is defined by: m= (1/m) ∑mi=1xi • Each face differs from the average ri = xi – m

  6. LDA LDA (Linear Discriminant Analysis) is enhancement of PCA (Principal Component Analysis). PCA doesn’t use concept of class, where as LDA does. Face images of same person is treated as of same class here. 

  7. LOCAL BINARY PATTERNS HISTOGRAMS (LBPH) FACE RECOGNIZER

  8. Histogram In the end, you will have one histogram for each face in the training data set. That means that if there were 100 images in the training data set then LBPH will extract 100 histograms after training and store them for later recognition. Remember, the algorithm also keeps track of which histogram belongs to which person.

  9. LBP Faces

  10. Implementation 3 steps: • Data Gathering: Gather face data (face images in this case) of the persons you want to identify. • Train the Recognizer: Feed that face data and respective names of each face to the recognizer so that it can learn. • Recognition: Feed new faces of that people and see if the face recognizer you just trained recognizes them. https://www.superdatascience.com/opencv-face-recognition/

  11. XML Libraries for face detection • You have to inform to classifier, the directory to be used, such as haarcascade_frontalface_default.xml. At OpenCV, stored on : Program_Files/OpenCV/data/haarcasades/haarcascade_frontalface_default.xml. • haarcascade_frontalface_alt2.xml • haarcascade_mcs_eyepair_big.xml • haarcascad_mcs_nose.xml • haarcascade_mcs_mouth.xml • haarcascade_smile.xml

  12. Face Detection //-- Detect faces face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0, Size(80, 80) ); for( int i = 0; i < faces.size(); i++ ) { Mat faceROI = frame_gray( faces[i] ); std::vector<Rect> eyes; //-- In each face, detect eyes eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) );

  13. DISTANCE sprintf(lblObject, "%s",prob_tetaObstacle); cv::putText(frame, "Distance Obs.1: 53", cvPoint(10, 40),1,2,cv::Scalar(255, 10, 0,3));

  14. Face Detection if( eyes.size() == 2) { //-- Draw the face Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 0 ), 2, 8, 0 ); for( int j = 0; j < eyes.size(); j++ ) { //-- Draw the eyes Point center( faces[i].x + eyes[j].x + eyes[j].width*0.5, faces[i].y + eyes[j].y + eyes[j].height*0.5 ); int radius = cvRound( (eyes[j].width + eyes[j].height)*0.25 ); circle( frame, center, radius, Scalar( 255, 0, 255 ), 3, 8, 0 ); } }

  15. 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 : cvCircle( img, center, radius, color, 3, 8, 0 ); cvRectangle( img,cvPoint( r->x, r->y ),cvPoint( r->x + r->width, r->y + r->height ),CV_RGB( 0, 255, 0 ), 1, 8, 0 );

  16. Bayes Filters: Framework • Given: • Stream of observations z and action data u: • Sensor modelP(z|x). • Action modelP(x|u,x’). • Prior probability of the system state P(x). • Wanted: • Estimate of the state X of a dynamical system. • The posterior of the state is also called Belief:

  17. Bayes Filter • Prediction

  18. State Estimation using Bayesian • State estimation dapat menggunakan pendekatan Bayesian karena memiliki formula yang lengkap untuk pengambilan keputusan optimal. • Bayes formula: • Bayesian update formula digunakanuntukmenentukan posterior ketikaobservasibarudiperoleh

  19. State Estimation using Bayesian • Misal robot memperoleh hasil pengukuran z untuk pintu terbuka/tertutup, maka P(open|z)?

  20. example • P(z|open) = 0.6 P(z|open) = 0.3 • P(open) = P(open) = 0.5 • z raisesthe probability that the door is open. 20

  21. What are Biometrics • We all have unique personal attributes • Biometrics are individual physiological characteristics • It’s basically patternrecognition thatmakes a personal identification

  22. Case Study I (Group 100 minutes) • Write a face recognition program to store and recognize name and gender. • person data stored in facedata.xml

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

More Related