Falafel Vision Processing.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:Millennium-Eye 作者: Elysium1937 项目源码 文件源码
def shapeFiltering(img):
    contours = cv2.findContours(img, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)[0]

    if len(contours) == 0:
        print "shapeFiltering: Error, no contours found"
        return 1

    good_shape = []

    for c in contours:
        x,y,w,h = cv2.boundingRect(c)
        #if h == 0:
        #    continue
        ratio = w / h
        ratio_grade = ratio / (TMw / TMh)
        if 0.2 < ratio_grade < 1.8:
            good_shape.append(c)

    return good_shape
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号