一、查找图像轮廓
opencv-python中查找图像轮廓的API为:findContours函数
该函数接受二值图作为参数,根据参数,可查找物体外轮廓、内外轮廓,保存轮廓点、压缩等等...
如:contours, hierarchy = cv2.findContours(binary,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
def findContours(image, mode, method, contours=None, hierarchy=None, offset=None): # real signature unknown; restored from __doc__
"""
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy
. @brief Finds contours in a binary image.
.
. The function retrieves contours from the binary image using the algorithm @cite Suzuki85 . The contours
. are a useful tool for shape analysis and object detection and recognition. See squares.cpp in the
. OpenCV sample directory.
. @note Since opencv 3.2 source image is not modified by this function.
.