#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2023/7/12 14:48:16

@author: LiuKuan
@copyright: Apache License, Version 2.0
'''
import cv2

# ===============================================================================
r'''
'''
# ===============================================================================
__all__ = ['find_contour_external', 'find_contour_list', 'find_contour_twolevel',

]

def find_contour_external(img, method = cv2.CHAIN_APPROX_SIMPLE):
    contours, hierarchy = cv2.findContours(img, mode=cv2.RETR_EXTERNAL, method=method)
    return contours

def find_contour_list(img, method = cv2.CHAIN_APPROX_SIMPLE):
    contours, hierarchy = cv2.findContours(img, mode=cv2.RETR_LIST, method=method)
    return contours

def find_contour_twolevel(img, method = cv2.CHAIN_APPROX_SIMPLE):
    contours, hierarchy = cv2.findContours(img, mode=cv2.RETR_CCOMP, method=method)
    return contours