文章图片
一张白色图片,只有一个黑点,使用find contour能够找到,但是使用查找find area返回0.0
【opencv 查找白色图片的一个黑点】
解决原因:
The area of polygon is 0 instead of 1, because the polygon is not a square with 1 pixel edge, but a point. This happened because polygon returned by findContours() is the polygon that connects centers of neighbor edge pixels (and there is a very good reason for this behavior). Your object has only one pixel and so returned polygon has only one vertex.
In general polygons returned by findContours() are not exact, and thus their area will almost always somewhat different from number of white pixels.
推荐阅读
- 人脸识别|【人脸识别系列】| 实现自动化妆
- OpenCV|OpenCV-Python实战(18)——深度学习简介与入门示例
- opencv|图像处理之椒盐噪声的添加与去除
- 人脸识别|【人脸识别系列】| 实现人脸截图保存并编写128维特征向量
- opencv|网络爬虫入门练习
- OpenCV|【OpenCV 完整例程】89. 带阻滤波器的传递函数
- OpenCV|【OpenCV 完整例程】90. 频率域陷波滤波器
- OpenCV|【OpenCV 完整例程】22. 图像添加非中文文字
- OpenCV|【OpenCV 完整例程】91. 高斯噪声、瑞利噪声、爱尔兰噪声
- opencv|python+opencv车道线,实线虚线的检测