Template-Based Face Detection CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.

Slides:



Advertisements
Similar presentations
Face Recognition Sumitha Balasuriya.
Advertisements

Hough Transforms CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
Chamfer Distance for Handshape Detection and Recognition CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
Presented by Xinyu Chang
The SIFT (Scale Invariant Feature Transform) Detector and Descriptor
TP14 - Local features: detection and description Computer Vision, FCUP, 2014 Miguel Coimbra Slides by Prof. Kristen Grauman.
Histograms of Oriented Gradients for Human Detection Navneet Dalal and Bill Triggs CVPR 2005 Another Descriptor.
Fırat Onur Alsaran, Neşe Alyüz, Melike Esma İlter, Mürsel Taşgın, Ahmet Burak Yoldemir CmpE 58Z Term Project.
Database-Based Hand Pose Estimation CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
Performance Evaluation Measures for Face Detection Algorithms Prag Sharma, Richard B. Reilly DSP Research Group, Department of Electronic and Electrical.
Mean transform, a tutorial KH Wong mean transform v.5a1.
Instructor: Mircea Nicolescu Lecture 13 CS 485 / 685 Computer Vision.
The Viola/Jones Face Detector Prepared with figures taken from “Robust real-time object detection” CRL 2001/01, February 2001.
Multimodal Templates for Real-Time Detection of Texture-less Objects in Heavily Cluttered Scenes Stefan Hinterstoisser, Stefan Holzer, Cedric Cagniart,
Lecture 5 Template matching
Feature extraction: Corners 9300 Harris Corners Pkwy, Charlotte, NC.
Lecture 4: Feature matching
Face Recognition Using Eigenfaces
(1) Feature-point matching by D.J.Duff for CompVis Online: Feature Point Matching Detection, Extraction.
MULTIPLE MOVING OBJECTS TRACKING FOR VIDEO SURVEILLANCE SYSTEMS.
Dynamic Scalable Distributed Face Recognition System Security Framework by Konrad Rzeszutek B.S. University of New Orleans, 1999.
Smart Traveller with Visual Translator for OCR and Face Recognition LYU0203 FYP.
September 25, 2014Computer Vision Lecture 6: Spatial Filtering 1 Computing Object Orientation We compute the orientation of an object as the orientation.
CS4670: Computer Vision Kavita Bala Lecture 8: Scale invariance.
Computer Vision P. Schrater Spring 2003
Lecture 6: Feature matching and alignment CS4670: Computer Vision Noah Snavely.
CS 485/685 Computer Vision Face Recognition Using Principal Components Analysis (PCA) M. Turk, A. Pentland, "Eigenfaces for Recognition", Journal of Cognitive.
Wang, Z., et al. Presented by: Kayla Henneman October 27, 2014 WHO IS HERE: LOCATION AWARE FACE RECOGNITION.
Computer vision.
Lecture #32 WWW Search. Review: Data Organization Kinds of things to organize –Menu items –Text –Images –Sound –Videos –Records (I.e. a person ’ s name,
DOOR ENTRY SYSTEM Alina Dinca László Papp Adrian Ulges Csaba Domokos Cercel Constantin Team:
1 Template Matching Longin Jan Latecki Temple University CIS 601 Based on a project by Roland Miezianko.
Rectangle Filters and AdaBoost CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
Lecture 4: Feature matching CS4670 / 5670: Computer Vision Noah Snavely.
Facial Feature Extraction Yuri Vanzine C490/B657 Computer Vision.
Tracking CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
CS332 Visual Processing Department of Computer Science Wellesley College Binocular Stereo Vision Region-based stereo matching algorithms Properties of.
Game Maker Terminology
Lecture 7: Features Part 2 CS4670/5670: Computer Vision Noah Snavely.
Challenges in Mining Large Image Datasets Jelena Tešić, B.S. Manjunath University of California, Santa Barbara
Face Detection Using Large Margin Classifiers Ming-Hsuan Yang Dan Roth Narendra Ahuja Presented by Kiang “Sean” Zhou Beckman Institute University of Illinois.
Gesture Recognition in a Class Room Environment Michael Wallick CS766.
CVPR2013 Poster Detecting and Naming Actors in Movies using Generative Appearance Models.
1 Template Matching Roland Miezianko Assignment 2 CIS 581 October 30, 2002.
Templates, Image Pyramids, and Filter Banks
Robust Real Time Face Detection
Histograms of Oriented Gradients for Human Detection Navneet Dalal and Bill Triggs CVPR 2005 Another Descriptor.
University of Texas at Arlington
Edges.
Principal Component Analysis CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
Magic Camera Master’s Project Defense By Adam Meadows Project Committee: Dr. Eamonn Keogh Dr. Doug Tolbert.
Pictorial Structures and Distance Transforms Computer Vision CS 543 / ECE 549 University of Illinois Ian Endres 03/31/11.
Vision Overview  Like all AI: in its infancy  Many methods which work well in specific applications  No universal solution  Classic problem: Recognition.
By: David Gelbendorf, Hila Ben-Moshe Supervisor : Alon Zvirin
Project Overview CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington.
More sliding window detection: Discriminative part-based models
Face Recognition Technology By Catherine jenni christy.M.sc.
Blob detection.
CONTENTS:  Introduction.  Face recognition task.  Image preprocessing.  Template Extraction and Normalization.  Template Correlation with image database.
Lecture 07 13/12/2011 Shai Avidan הבהרה: החומר המחייב הוא החומר הנלמד בכיתה ולא זה המופיע / לא מופיע במצגת.
Principal Component Analysis
TP12 - Local features: detection and description
Lecture 26 Hand Pose Estimation Using a Database of Hand Images
Feature description and matching
Mean transform , a tutorial
Image Processing, Lecture #8
Image Processing, Lecture #8
Feature descriptors and matching
Presented by Xu Miao April 20, 2005
Image Stitching Linda Shapiro ECE/CSE 576.
Presentation transcript:

Template-Based Face Detection CSE 6367 – Computer Vision Vassilis Athitsos University of Texas at Arlington

Face Detection We will make a few assumptions, to simplify the problem: –The face is fully visible. Example cases where the face is not fully visible

Face Detection We will make a few assumptions, to simplify the problem: –The face is fully visible. –We see a frontal view of the face, i.e., the face is facing towards the camera. Example cases where the view of the face is not frontal

Face Detection We will make a few assumptions, to simplify the problem: –The face is fully visible. –We see a frontal view of the face, i.e., the face is facing towards the camera. –The face is more or less in an upright orientation. Example of a face not in an upright orientation

What is a Template? A template is an example of how an object looks. What example would be appropriate if we are looking for a face?

What is a Template? A template is an example of how an object looks. What example would be appropriate if we are looking for a face? –An average face.

Computing an Average Face We need aligned face images: In this case, aligned means: –same size –significant features (eyes, nose, mouth), to the degree possible, are in similar pixel locations. an example set of aligned face images

Computing an Average Face % Note that filenames is a cell variable (look it up!). % Using cells is a good way to define a set of strings. filenames = { '4846d101.bmp' '4848d101.bmp' '4851d101.bmp' '4853d101.bmp' '4854d101.bmp' }; number = prod(size(filenames)); image_vertical = 100; image_horizontal = 100; total = zeros(image_vertical, image_horizontal); for index = 1: number image = read_gray(filenames{index}); total = total + image; disp(index); end average_face = total / number;

Result: Average Face

Defining a Face Template Keep the parts of the average face that are most likely to be present in all faces: –Exclude background. –Exclude forehead (highly variable appearance, due to hair). –Exclude lower chin. average face face template

Using a Template to Find Faces How can we use a face template to perform face detection in an image?

Finding Matches for the Template How can we find good matches for a given template?

Using Normalized Correlation function result = vector_normalized_correlation(v1, v2) % function result = vector_normalized_correlation(v1, v2) centered_v1 = v1 - mean(v1); centered_v2 = v2 - mean(v2); norm1 = norm(centered_v1); norm2 = norm(centered_v2); result = centered_v1.* centered_v2 / (norm1 * norm2); Function normxcorr2(template, image) returns a matrix of normalized correlation scores between the template and each template-sized subwindow of the image.

Invoking normxcorr2 photo = read_gray('vassilis1g.bmp'); result = normxcorr2(face_filter, photo); photo result result > 0.6 It found the face! The result of normxcorr2 has larger size than the input. The face in photo matched the scale of the template.

normalized_correlation A wrapper around normxcorr2. The result has the same size as the image. Border values are zero.

function result = normalized_correlation(image, template) % function result = normalized_correlation(image, template) % % Returns a matrix containing normalized correlation results between % template and all template-sized subwindows of image. [image_rows, image_columns] = size( image); [template_rows, template_columns] = size(template); row_start = floor(template_rows / 2) + 1; row_end = row_start + image_rows - 1; col_start = floor(template_columns / 2) + 1; col_end = col_start + image_columns - 1; result = normxcorr2(template, image); [result_rows, result_columns] = size(result); result(1:template_rows, :) = 0; result((result_rows-template_rows+1):result_rows, :) = 0; result(:, 1:template_columns) = 0; result(:, (result_columns-template_columns+1):result_rows, :) = 0; result = result(row_start:row_end, col_start:col_end);

Invoking normalized_correlation photo = read_gray('vassilis1g.bmp'); result = normalized_correlation(photo, face_filter); photo result result > 0.6

A Trick for Visualizing Results photo = read_gray('vassilis1g.bmp'); result = normalized_correlation(photo, face_filter); visualization = max((result > 0.6)*255, photo * 0.7) ; photo resultvisualization

Problem: Different Scales photo = read_gray('vassilis1e.bmp'); result = normalized_correlation(photo, face_filter); visualization = max((result > 0.35)*255, photo * 0.7) ; photoresult visualization

Solution: Multiscale Search function... [result, max_scales] = multiscale_correlation(image, template, scales) % function result = multiscale_correlation(image, template, scales) % % for each pixel, search over the specified scales, and record: % - in result, the max normalized correlation score for that pixel % over all scales % - in max_scales, the scale that gave the max score

Solution: Multiscale Search function... [result, max_scales] = multiscale_correlation(image, template, scales) result = ones(size(image)) * -10; max_scales = ones(size(image)) * -10; for scale = scales; % for efficiency, we either downsize the image, or the template, % depending on the current scale if scale >= 1 scaled_image = imresize(image, 1/scale, 'bilinear'); temp_result = normalized_correlation(scaled_image, template); temp_result = imresize(temp_result, size(image), 'bilinear'); else scaled_image = image; scaled_template = imresize(template, scale, 'bilinear'); temp_result = normalized_correlation(image, scaled_template); end higher_maxes = (temp_result > result); max_scales(higher_maxes) = scale; result(higher_maxes) = temp_result(higher_maxes); end

Results of multiscale_correlation photo = read_gray('vassilis1e.bmp'); scales = 0.5:0.1:3; [result2, max_scales] =... multiscale_correlation(photo, face_filter, scales); visualization2 = max((result2 > 0.6)*255, photo * 0.7); photoresult2 visualization2

Handling Rotations load face_filter; photo = read_gray('vassilis2b.bmp'); [result, boxes] =... template_detector_demo(photo, face_filter, 0.5:0.1:3., 0, 1); photo result

Handling Rotations load face_filter; photo = read_gray('vassilis2b.bmp'); [resultb, boxes] =... template_detector_demo(photo, face_filter, 0.5:0.1:3., 0, 2); photo resultb

Code for Template Search Useful functions: –template_search –find_template –template_detector_demo

function [max_responses, max_scales, max_rotations] =... template_search(image, template, scales, rotations, result_number) % function [result, max_scales, max_rotations] =... % template_search(image, template, scales, rotations, result_number) % % for each pixel, search over the specified scales and rotations, % and record: % - in result, the max normalized correlation score for that pixel % over all scales % - in max_scales, the scale that gave the max score % - in max_rotations, the rotation that gave the max score % % clockwise rotations are positive, counterclockwise rotations are % negative. % rotations are specified in degrees

function [max_responses, max_scales, max_rotations] =... template_search(image, template, scales, rotations, result_number) max_responses = ones(size(image)) * -10; max_scales = zeros(size(image)); max_rotations = zeros(size(image)); for rotation = rotations rotated = imrotate(image, -rotation, 'bilinear', 'crop'); [responses, temp_max_scales] =... multiscale_correlation(rotated, template, scales); responses = imrotate(responses, rotation, 'nearest', 'crop'); temp_max_scales = imrotate(temp_max_scales, rotation,... 'nearest', 'crop'); higher_maxes = (responses > max_responses); max_responses(higher_maxes) = responses(higher_maxes); max_scales(higher_maxes) = temp_max_scales(higher_maxes); max_rotations(higher_maxes) = rotation; end

function [result, boxes] =... template_detector_demo(image, template,... scales, rotations, result_number) % function [result, boxes] = % template_detector_demo(image, template,... % scales, rotations, result_number) % % returns an image that is a copy of the input image, with % the bounding boxes drawn for each of the best matches for % the template in the image, after searching all specified % scales and rotations. boxes = find_template(image, template, scales,... rotations, result_number); result = image; for number = 1:result_number result = draw_rectangle1(result, boxes(number, 1),... boxes(number, 2),... boxes(number, 3), boxes(number, 4)); end

Handling Rotations load face_filter; photo = read_gray('vassilis2b.bmp'); [resultb, boxes] =... template_detector_demo(photo, face_filter, 0.5:0.1:3., 0, 2); photo resultb

Handling Rotations load face_filter; photo = read_gray('vassilis2b.bmp'); scales = 0.5:0.1:3; rotations = -10:5:10; [result2, boxes] = template_detector_demo(photo, face_filter,..., scales, rotations, 1); photo result2