diff options
author | vanechipi <vchipirras6@gmail.com> | 2015-08-10 19:13:11 +0200 |
---|---|---|
committer | Luis de Bethencourt <luis@debethencourt.com> | 2015-08-11 11:18:50 +0100 |
commit | 28f9ff131276e3e0df5d0b6d6e5c03ce01f5319e (patch) | |
tree | 28e515abf6861025afca7ecc50ad70641aa913e0 /ext | |
parent | 73bc2cf7b05e026bef776e0ccb843e98b008c72d (diff) | |
download | gstreamer-plugins-bad-28f9ff131276e3e0df5d0b6d6e5c03ce01f5319e.tar.gz |
facedetect: simplify repeated code.
Store the value of r.height / 2 instead of repeating the operation line
three times.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opencv/gstfacedetect.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/opencv/gstfacedetect.cpp b/ext/opencv/gstfacedetect.cpp index cac7b177d..a5e4b99ec 100644 --- a/ext/opencv/gstfacedetect.cpp +++ b/ext/opencv/gstfacedetect.cpp @@ -640,6 +640,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, guint rnx = 0, rny = 0, rnw, rnh; guint rmx = 0, rmy = 0, rmw, rmh; guint rex = 0, rey = 0, rew, reh; + guint rhh = r.height / 2; gboolean have_nose, have_mouth, have_eyes; /* detect face features */ @@ -648,7 +649,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, rnx = r.x + r.width / 4; rny = r.y + r.height / 4; rnw = r.width / 2; - rnh = r.height / 2; + rnh = rhh; gst_face_detect_run_detector (filter, filter->cvNoseDetect, mw, mh, Rect (rnx, rny, rnw, rnh), nose); have_nose = !nose.empty (); @@ -660,7 +661,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, rmx = r.x; rmy = r.y + r.height / 2; rmw = r.width; - rmh = r.height / 2; + rmh = rhh; gst_face_detect_run_detector (filter, filter->cvMouthDetect, mw, mh, Rect (rmx, rmy, rmw, rmh), mouth); have_mouth = !mouth.empty (); @@ -672,7 +673,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf, rex = r.x; rey = r.y; rew = r.width; - reh = r.height / 2; + reh = rhh; gst_face_detect_run_detector (filter, filter->cvEyesDetect, mw, mh, Rect (rex, rey, rew, reh), eyes); have_eyes = !eyes.empty (); |