MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / RoiRect

Function RoiRect

jni/stasm/faceroi.cpp:21–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19// ASM search, but also ensuring that the rect is in the image boundaries.
20
21static Rect RoiRect(
22 const DetectorParameter& detpar, // in
23 int nimgcols, // in
24 int nimgrows, // in
25 bool flip, // in: mirror the ROI
26 double botfrac, // in: distance from center to bottom marg
27 double leftfrac, // in: dist from center to left marg
28 double topfrac, // in
29 double rightfrac) // in
30{
31 int ixmin, ixmax;
32 if (flip)
33 {
34 ixmin = MAX(0, cvRound(detpar.x - rightfrac * detpar.width));
35 ixmax = MIN(nimgcols, cvRound(detpar.x + leftfrac * detpar.width));
36 }
37 else
38 {
39 ixmin = MAX(0, cvRound(detpar.x - leftfrac * detpar.width));
40 ixmax = MIN(nimgcols, cvRound(detpar.x + rightfrac * detpar.width));
41 }
42 const int iymin = MAX(0, cvRound(detpar.y - botfrac * detpar.height));
43 const int iymax = MIN(nimgrows, cvRound(detpar.y + topfrac * detpar.height));
44
45 Rect roi;
46
47 roi.x = ixmin;
48 roi.y = iymin;
49 roi.width = ixmax - ixmin;
50 roi.height = iymax - iymin;
51
52 CV_Assert(roi.width > 0);
53 CV_Assert(roi.height > 0);
54
55 return roi;
56}
57
58static bool IsRoiEntireImg(
59 const Rect& roi, // in

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected