You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
This function ObjectDetection is an implementation of the Detection in the Viola-Jones framework. In this framework Haar-like features are used for rapid object detection. It supports the trained classifiers in the XML files of OpenCV which can be download as part of the OPENCV software on opencv.willowgarage.com
Objects=ObjectDetection(I,FilenameHaarcasade,Options)
inputs,
I : 2D image, or Filename of an image
FilenameHaarcasade : The filename of a Matlab file with a Haarcasade which is created from an OpenCV xml file
Options : A struct with options
Options.ScaleUpdate : The scale update, default 1/1.2
Options.Resize : If boolean is true (default), the function will
resize the image to maximum size 384 for less cpu-time
Options.Verbose : Display process information
outputs,
Objects : An array n x 4 with [x y width height] of the detected
objects
Literature :
- Rainer Linehart and Jochend Maydt, "An Extended Set of Haar-like
Features for Rapid Object Detection"
- Paul viola and Michael J. Jones, "Rapid Object Detection using
a Boosted Cascade of Simple Features", 2001
Example 1,
% % Convert an OpenCV classifier XML file to a Matlab file
% ConvertHaarcasadeXMLOpenCV('HaarCascades/haarcascade_frontalface_alt.xml');
% % Detect Faces
% Options.Resize=false;
% ObjectDetection('Images/1.jpg','HaarCascades/haarcascade_frontalface_alt.mat',Options);
Cite As
Dirk-Jan Kroon (2026). Viola Jones Object Detection (https://www.mathworks.com/matlabcentral/fileexchange/29437-viola-jones-object-detection), MATLAB Central File Exchange. Retrieved .
Categories
Find more on Code Generation, GPU, and Third-Party Support in Help Center and MATLAB Answers
General Information
- Version 1.1.0.0 (224 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
