summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorvanechipi <vchipirras6@gmail.com>2015-08-10 19:02:10 +0200
committerLuis de Bethencourt <luis@debethencourt.com>2015-08-11 11:13:23 +0100
commit73bc2cf7b05e026bef776e0ccb843e98b008c72d (patch)
treee2a760912adf2e6e2cf16edb68b09d3ab45ef8e0 /ext
parent9720c07f237ca6f2e4f45bf48b5ac5367e9b211e (diff)
downloadgstreamer-plugins-bad-73bc2cf7b05e026bef776e0ccb843e98b008c72d.tar.gz
facedetect: Redundancy exists in code.
Checking the vector is not empty and checking the vector size is greater than zero are the same thing, this is a redundancy in the code. Only checking the vector is not empty is sufficient, therefore removing the other check.
Diffstat (limited to 'ext')
-rw-r--r--ext/opencv/gstfacedetect.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp
index 7a2450182..cac7b177d 100644
--- a/ext/opencv/gstfacedetect.cpp
+++ b/ext/opencv/gstfacedetect.cpp
@@ -602,7 +602,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
post_msg = TRUE;
break;
case GST_FACEDETECT_UPDATES_ON_CHANGE:
- if (!faces.empty () && (faces.size () > 0)) {
+ if (!faces.empty ()) {
if (!filter->face_detected)
post_msg = TRUE;
} else {
@@ -612,7 +612,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
}
break;
case GST_FACEDETECT_UPDATES_ON_FACE:
- if (!faces.empty () && (faces.size () > 0)) {
+ if (!faces.empty ()) {
post_msg = TRUE;
} else {
post_msg = FALSE;
@@ -626,7 +626,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
break;
}
- filter->face_detected = !faces.empty ()? faces.size () > 0 : FALSE;
+ filter->face_detected = !faces.empty ()? TRUE : FALSE;
if (post_msg) {
msg = gst_face_detect_message_new (filter, buf);
@@ -651,7 +651,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
rnh = r.height / 2;
gst_face_detect_run_detector (filter, filter->cvNoseDetect, mw, mh,
Rect (rnx, rny, rnw, rnh), nose);
- have_nose = (!nose.empty () && nose.size ());
+ have_nose = !nose.empty ();
} else {
have_nose = FALSE;
}
@@ -663,7 +663,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
rmh = r.height / 2;
gst_face_detect_run_detector (filter, filter->cvMouthDetect, mw,
mh, Rect (rmx, rmy, rmw, rmh), mouth);
- have_mouth = (!mouth.empty () && mouth.size ());
+ have_mouth = !mouth.empty ();
} else {
have_mouth = FALSE;
}
@@ -675,7 +675,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
reh = r.height / 2;
gst_face_detect_run_detector (filter, filter->cvEyesDetect, mw, mh,
Rect (rex, rey, rew, reh), eyes);
- have_eyes = (!eyes.empty () && eyes.size ());
+ have_eyes = !eyes.empty ();
} else {
have_eyes = FALSE;
}
@@ -806,7 +806,7 @@ gst_face_detect_load_profile (GstFaceDetect * filter, gchar * profile)
GST_ERROR_OBJECT (filter, "Invalid profile file: %s", profile);
delete (cascade);
return NULL;
- }
+ }
return cascade;
}