Skip to content

Commit

Permalink
Merge pull request dyne#75 from rrrapha/facedetect-classifier
Browse files Browse the repository at this point in the history
facedetect: do not retry if loading of the cascade classifier fails.
  • Loading branch information
jaromil authored Feb 22, 2019
2 parents 777ff13 + 4b6e946 commit bd36127
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/filter/facedetect/facedetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class FaceDetect: public frei0r::filter
bool antialias;
double alpha;
f0r_param_color color[5];


std::string old_classifier;

public:
FaceDetect(int width, int height)
: count(0)
Expand Down Expand Up @@ -115,9 +117,10 @@ class FaceDetect: public frei0r::filter
{
if (cascade.empty()) {
cv::setNumThreads(cvRound(threads * 100));
if (classifier.length() > 0) {
if (classifier.length() > 0 && classifier != old_classifier) {
if (!cascade.load(classifier.c_str()))
fprintf(stderr, "ERROR: Could not load classifier cascade %s\n", classifier.c_str());
old_classifier = classifier;
}
else {
memcpy(out, in, size * 4);
Expand Down

0 comments on commit bd36127

Please sign in to comment.