JeVoisBase
1.22
JeVois Smart Embedded Machine Vision Toolkit Base Modules
|
|
Face detection using OpenCV. More...
#include <jevoisbase/Components/FaceDetection/FaceDetector.H>
Public Member Functions | |
FaceDetector (std::string const &instance) | |
Constructor, loads the cascade classifiers from disk. | |
~FaceDetector () | |
Destructor. | |
void | process (cv::Mat const &img, std::vector< cv::Rect > &faces, std::vector< std::vector< cv::Rect > > &eyes, bool detect_eyes=false) |
Process an image, results are held in our data members. | |
Public Member Functions inherited from jevois::Component | |
Component (std::string const &instance) | |
virtual | ~Component () |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
std::shared_ptr< Comp > | addSubComponent (std::string const &instance, Args &&...args) |
void | removeSubComponent (std::shared_ptr< Comp > &component) |
void | removeSubComponent (std::string const &instance, bool warnIfNotFound=true) |
std::shared_ptr< Comp > | getSubComponent (std::string const &instance) const |
bool | isTopLevel () const |
bool | initialized () const |
std::string const & | className () const |
std::string const & | instanceName () const |
std::vector< std::string > | setParamVal (std::string const ¶mdescriptor, T const &val) |
void | setParamValUnique (std::string const ¶mdescriptor, T const &val) |
std::vector< std::pair< std::string, T > > | getParamVal (std::string const ¶mdescriptor) const |
T | getParamValUnique (std::string const ¶mdescriptor) const |
std::vector< std::string > | setParamString (std::string const ¶mdescriptor, std::string const &val) |
void | setParamStringUnique (std::string const ¶mdescriptor, std::string const &val) |
std::vector< std::pair< std::string, std::string > > | getParamString (std::string const ¶mdescriptor) const |
std::string | getParamStringUnique (std::string const ¶mdescriptor) const |
void | freezeParam (std::string const ¶mdescriptor, bool doit) |
void | freezeAllParams (bool doit) |
std::string | descriptor () const |
void | setParamsFromFile (std::string const &filename) |
std::istream & | setParamsFromStream (std::istream &is, std::string const &absfile) |
virtual void | paramInfo (std::shared_ptr< UserInterface > s, std::map< std::string, std::string > &categs, bool skipFrozen, std::string const &cname="", std::string const &pfx="") |
void | foreachParam (std::function< void(std::string const &compname, ParameterBase *p)> func, std::string const &cname="") |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ParameterCategory const &category) |
std::shared_ptr< DynamicParameter< T > > | addDynamicParameter (std::string const &name, std::string const &description, T const &defaultValue, ValidValuesSpec< T > const &validValuesSpec, ParameterCategory const &category) |
void | setDynamicParameterCallback (std::string const &name, std::function< void(T const &)> cb, bool callnow=true) |
void | removeDynamicParameter (std::string const &name, bool throw_if_not_found=true) |
void | setPath (std::string const &path) |
std::filesystem::path | absolutePath (std::filesystem::path const &path="") |
Public Member Functions inherited from jevois::ParameterRegistry | |
virtual | ~ParameterRegistry () |
Protected Member Functions | |
void | postInit () override |
Protected Member Functions inherited from jevois::Component | |
virtual void | preInit () |
virtual void | preUninit () |
virtual void | postUninit () |
virtual void | preInit () |
virtual void | preUninit () |
virtual void | postUninit () |
Protected Member Functions inherited from jevois::ParameterRegistry | |
void | addParameter (ParameterBase *const param) |
void | removeParameter (ParameterBase *const param) |
void | callbackInitCall () |
Protected Attributes | |
std::shared_ptr< cv::CascadeClassifier > | itsFaceCascade |
std::shared_ptr< cv::CascadeClassifier > | itsEyesCascade |
Related Symbols | |
(Note that these are not member symbols.) | |
JEVOIS_DECLARE_PARAMETER (face_cascade, std::string, "File name of the face cascade", JEVOIS_SHARE_PATH "/facedetector/haarcascade_frontalface_alt.xml", ParamCateg) | |
Parameter. | |
JEVOIS_DECLARE_PARAMETER (eye_cascade, std::string, "File name of the eye cascade, or empty to not detect eyes", JEVOIS_SHARE_PATH "/facedetector/haarcascade_eye_tree_eyeglasses.xml", ParamCateg) | |
Parameter. | |
Face detection using OpenCV.
See tutorial at http://docs.opencv.org/trunk/d7/d8b/tutorial_py_face_detection.html
Definition at line 40 of file FaceDetector.H.
FaceDetector::FaceDetector | ( | std::string const & | instance | ) |
Constructor, loads the cascade classifiers from disk.
Definition at line 22 of file FaceDetector.C.
FaceDetector::~FaceDetector | ( | ) |
Destructor.
Definition at line 27 of file FaceDetector.C.
|
overrideprotectedvirtual |
Reimplemented from jevois::Component.
Definition at line 31 of file FaceDetector.C.
References jevois::Component::absolutePath(), itsEyesCascade, itsFaceCascade, and LFATAL.
void FaceDetector::process | ( | cv::Mat const & | img, |
std::vector< cv::Rect > & | faces, | ||
std::vector< std::vector< cv::Rect > > & | eyes, | ||
bool | detect_eyes = false |
||
) |
Process an image, results are held in our data members.
The given image should be grayscale and with histogram equalized, for example by doing:
If detect_eyes is true, throws if an eye cascade was not successfully loaded. Even if we do not detect eyes, the eyes vector will be resized to one (possibly empty) vector of eyes per face, so that it is safe to assume that one entry exists in eyes for each entry in faces.
Definition at line 49 of file FaceDetector.C.
References itsEyesCascade, and itsFaceCascade.
|
related |
Parameter.
|
related |
Parameter.
|
protected |
Definition at line 69 of file FaceDetector.H.
Referenced by postInit(), and process().
|
protected |
Definition at line 68 of file FaceDetector.H.
Referenced by postInit(), and process().