opencv improc 与连通域及轮廓相关的函数

https://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=pointpolygontest#pointpolygontest

官方文档

pointPolygonTest

判断一个点与所给轮廓的位置关系。

Parameters:

  • contour – Input contour. 轮廓
  • pt – Point tested against the contour. 点
  • measureDist – If true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not. true则返回距离否则返回 1  0 -1

返回正数为在轮廓内,负数在轮廓外,0在轮廓上

原文地址:https://www.cnblogs.com/klitech/p/8876176.html