MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / Detect

Function Detect

jni/stasm/misc.cpp:800–838  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

798}
799
800vec_Rect Detect( // detect faces or facial features
801 const Image& img, // in
802 cv::CascadeClassifier& cascade, // in
803 const Rect* searchrect, // in: search in this region, can be NULL
804 double scale_factor, // in
805 int min_neighbors, // in
806 int flags, // in
807 int minwidth_pixels) // in: reduces false positives
808{
809 CV_Assert(!cascade.empty());
810
811 Rect searchrect1; searchrect1.width = 0;
812 if (searchrect)
813 {
814 searchrect1 = *searchrect;
815 ForceRectIntoImg(searchrect1, img);
816 if (searchrect1.height == 0)
817 searchrect1.width = 0;
818 }
819 Image roi(img,
820 searchrect1.width? searchrect1: Rect(0, 0, img.cols, img.rows));
821
822 // TODO If we don't allocate feats now we get a crash on mem release later.
823
824 static const int MAX_NFACES_IN_IMG = int(1e4); // arb, but big
825 vec_Rect feats(MAX_NFACES_IN_IMG);
826
827 // Note: This call to detectMultiScale causes the Peak Working Set
828 // to jump to 160 MBytes (multiface2.jpg) versus less than 50 MBytes
829 // for the rest of Stasm (Feb 2013).
830
831 cascade.detectMultiScale(roi, feats, scale_factor, min_neighbors, flags,
832 cvSize(minwidth_pixels, minwidth_pixels));
833
834 if (!feats.empty() && searchrect1.width)
835 DiscountSearchRegion(feats, searchrect1);
836
837 return feats;
838}
839
840bool IsLeftFacing(EYAW eyaw) // true if eyaw is for a left facing face
841{

Callers 3

DetectAllEyesFunction · 0.85
DetectAllMouthsFunction · 0.85
DetectFacesFunction · 0.85

Calls 2

ForceRectIntoImgFunction · 0.85
DiscountSearchRegionFunction · 0.85

Tested by

no test coverage detected