diff --git a/openbr/plugins/gallery.cpp b/openbr/plugins/gallery.cpp index 23c2b8e..27559ef 100644 --- a/openbr/plugins/gallery.cpp +++ b/openbr/plugins/gallery.cpp @@ -856,8 +856,18 @@ class FDDBGallery : public Gallery for (int i=0; icontext, face, &extractable)) if (!extractable && !detectOnly) continue; + else foundFace = true; cv::Mat m; if (detectOnly) { @@ -272,20 +274,18 @@ class PP5EnrollTransform : public UntrainableMetaTransform // Found a face, nothing else to do (if we aren't trying to find multiple faces). if (!Globals->enrollAll) break; - } + } ppr_free_face_list(face_list); ppr_free_image(image); ppr_raw_image_free(raw_image); } - } - // No faces were detected, output something with FTE set. - if (dstList.empty()) { - dstList.append(srcList.first()); - dstList.first().file.set("FTE",true); - if (!detectOnly) - dstList.first().m() = cv::Mat(); + // No faces were detected when we were expecting one, output something with FTE set. + if (!foundFace && !Globals->enrollAll) { + dstList.append(Template(src.file, detectOnly ? src.m() : cv::Mat())); + dstList.last().file.set("FTE", true); + } } contexts.release(context);