logoSet.py 文件源码

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

项目:vehicle_brand_classification_CNN 作者: nanoc812 项目源码 文件源码
def imgSeg(img):
    approx = imgSeg_contour(img, 4,4,4, 0.04)
    himg, wimg , _ = img.shape[:3]
    #h1, h2, w1, w2 = imgSeg_rect(approx, himg, wimg)
    h1, h2, w1, w2 = imgSeg_logo(approx, himg, wimg)
    if (w2-w1) < 20:
        approx = imgSeg_contour(img, 6, 6, 6, 0.02)
        himg, wimg , _ = img.shape[:3]
        #h1, h2, w1, w2 = imgSeg_rect(approx, himg, wimg)
        h1, h2, w1, w2 = imgSeg_logo(approx, himg, wimg)
    if (h2-h1) > (w2-w1): 
        approx = imgSeg_contour(img, 2,2,2, 0.04)
        himg, wimg , _ = img.shape[:3]
        #h1, h2, w1, w2 = imgSeg_rect(approx, himg, wimg)
        h1, h2, w1, w2 = imgSeg_logo(approx, himg, wimg)
    #cv2.rectangle(img,(w1, h1), (w2,h2), 255, 2)
    return img[h1:h2, w1:w2,:]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号