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

网上说的好多都错了,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(在轮廓上)

measureDist为true时判断距离,返回点与最近的轮廓之间的距离。

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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值