- cvRound, cvFloor, cvCeil
函数 cvRound, cvFloor, cvCeil 用一种舍入方法将输入浮点数转换成整数。 cvRound 返回和参数最接近的整数值。 cvFloor 返回不大于参数的最大整数值。cvCeil 返回不小于参数的最小整数值。
- pointPolygonTest
判断点是否在多边形区域内
double cv::pointPolygonTest (InputArray contour,
Point2f pt,
bool measureDist
)
contour: 可以通过 findContours() 获得
pt: 待验证的点
measureDist: false 只返回在边界内,边界外或者边界上(+1, -1,or 0);true:返回点到边界点的空间距离。
The function determines whether the point is inside a contour, outside, or lies on an edge (or coincides with a vertex). It returns positive (inside), negative (outside), or zero (on an edge) value, correspondingly. When measureDist=false , the return value is +1, -1, and 0, respectively. Otherwise, the return value is a signed distance between the point and the nearest contour edge