opencv 判断点相对于轮廓的位置关系

来源:互联网 发布:pc端软件界面设计 编辑:程序博客网 时间:2024/05/22 04:32

网上说的好多都错了,opencv里的pointPolygonTest()函数确实可以判断点相对于轮廓的位置关系,

但关于参数measureDist的作用却说错了,官方文档解释如下:

Performs a point-in-contour test.

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.

翻译过来就是:

measureDist为false时才能判断位置关系,返回值+1(在轮廓里面)、-1(在轮廓外面)、0(在轮廓上)

官方文档说是Test的函数,可能是说判断结果不太准确,慎用。

0 1
原创粉丝点击