mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
facedetect: simplify repeated code.
Store the value of r.height / 2 instead of repeating the operation line three times.
This commit is contained in:
parent
73bc2cf7b0
commit
28f9ff1312
1 changed files with 4 additions and 3 deletions
|
@ -640,6 +640,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
|
||||||
guint rnx = 0, rny = 0, rnw, rnh;
|
guint rnx = 0, rny = 0, rnw, rnh;
|
||||||
guint rmx = 0, rmy = 0, rmw, rmh;
|
guint rmx = 0, rmy = 0, rmw, rmh;
|
||||||
guint rex = 0, rey = 0, rew, reh;
|
guint rex = 0, rey = 0, rew, reh;
|
||||||
|
guint rhh = r.height / 2;
|
||||||
gboolean have_nose, have_mouth, have_eyes;
|
gboolean have_nose, have_mouth, have_eyes;
|
||||||
|
|
||||||
/* detect face features */
|
/* detect face features */
|
||||||
|
@ -648,7 +649,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
|
||||||
rnx = r.x + r.width / 4;
|
rnx = r.x + r.width / 4;
|
||||||
rny = r.y + r.height / 4;
|
rny = r.y + r.height / 4;
|
||||||
rnw = r.width / 2;
|
rnw = r.width / 2;
|
||||||
rnh = r.height / 2;
|
rnh = rhh;
|
||||||
gst_face_detect_run_detector (filter, filter->cvNoseDetect, mw, mh,
|
gst_face_detect_run_detector (filter, filter->cvNoseDetect, mw, mh,
|
||||||
Rect (rnx, rny, rnw, rnh), nose);
|
Rect (rnx, rny, rnw, rnh), nose);
|
||||||
have_nose = !nose.empty ();
|
have_nose = !nose.empty ();
|
||||||
|
@ -660,7 +661,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
|
||||||
rmx = r.x;
|
rmx = r.x;
|
||||||
rmy = r.y + r.height / 2;
|
rmy = r.y + r.height / 2;
|
||||||
rmw = r.width;
|
rmw = r.width;
|
||||||
rmh = r.height / 2;
|
rmh = rhh;
|
||||||
gst_face_detect_run_detector (filter, filter->cvMouthDetect, mw,
|
gst_face_detect_run_detector (filter, filter->cvMouthDetect, mw,
|
||||||
mh, Rect (rmx, rmy, rmw, rmh), mouth);
|
mh, Rect (rmx, rmy, rmw, rmh), mouth);
|
||||||
have_mouth = !mouth.empty ();
|
have_mouth = !mouth.empty ();
|
||||||
|
@ -672,7 +673,7 @@ gst_face_detect_transform_ip (GstOpencvVideoFilter * base, GstBuffer * buf,
|
||||||
rex = r.x;
|
rex = r.x;
|
||||||
rey = r.y;
|
rey = r.y;
|
||||||
rew = r.width;
|
rew = r.width;
|
||||||
reh = r.height / 2;
|
reh = rhh;
|
||||||
gst_face_detect_run_detector (filter, filter->cvEyesDetect, mw, mh,
|
gst_face_detect_run_detector (filter, filter->cvEyesDetect, mw, mh,
|
||||||
Rect (rex, rey, rew, reh), eyes);
|
Rect (rex, rey, rew, reh), eyes);
|
||||||
have_eyes = !eyes.empty ();
|
have_eyes = !eyes.empty ();
|
||||||
|
|
Loading…
Reference in a new issue