原文链接:http://answers.opencv.org/question/134783/android-opencv-finding-extreme-points-in-contours/
导 读:本例子使用轮廓分析,寻找到轮廓的极点;使用了STD的SORT特性。
提出问题:
Good Evening,
I have a trouble with finding extreme points in frames. I am detecting all contours, but I want find there one extreme point, which is lowest from others (southernmost contour). Here is a preview of screen, what I have.
And here is a preview of screen, what I want ! For example, lowest point will bounded by red rectangle.
.
优质解答:
程序解读:本程序的基本思路是很简答的,就是遍历轮廓,找到轮廓中x和y最大的点,这个点就是极值点。但是有两个地方需要注意:
1、是使用了std的sort特性,应该说简化了程序设计;
2、是findcontours的第二个参数,使用的是“只寻找第一层轮廓”。那么对于本例来说,这样做是合理的。