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,:]
logoSet.py 文件源码
python
阅读 40
收藏 0
点赞 0
评论 0
评论列表
文章目录