【发布时间】:2020-10-03 21:38:33
【问题描述】:
在我的网站上,我收到一张包含用户指纹和签名的图片,我不想提取这两条信息。
例如: Original Image
import os
import cv2
import numpy as np
def imshow(label, image):
cv2.imshow(label, image)
cv2.waitKey(0)
cv2.destroyAllWindows()
#read image
rgb_img = cv2.imread('path')
rgb_img = cv2.resize(rgb_img, (900, 600))
gray_img = cv2.cvtColor(rgb_img, cv2.COLOR_BGR2GRAY)
#canny edge detection
canny = cv2.Canny(gray_img, 50, 120)
# Morphology Closing
kernel = np.ones((7, 23), np.uint8)
closing = cv2.morphologyEx(canny, cv2.MORPH_CLOSE, kernel)
# Find contours
contours, hierarchy = cv2.findContours(closing.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
# Sort Contors by area and then remove the largest frame contour
n = len(contours) - 1
contours = sorted(contours, key=cv2.contourArea, reverse=False)[:n]
copy = rgb_img.copy()
# Iterate through contours and draw the convex hull
for c in contours:
if cv2.contourArea(c) < 750:
continue
hull = cv2.convexHull(c)
cv2.drawContours(copy, [hull], 0, (0, 255, 0), 2)
imshow('Convex Hull', copy)
现在我的目标是:
- 知道哪一部分是签名,哪一部分是指纹
- 解决轮廓重叠(如果存在)
P.S:我不确定前面的步骤是否是最终步骤,如果您有更好的步骤,请告诉我。
【问题讨论】:
-
指纹的颜色好像不一样,可以用其中一种分割方法来分离指纹。对于签名,你可以通过一些文本检测算法删除上面不断打印的文字,剩下的就是签名了。
-
我希望它这么简单,但是指纹颜色可能会因用户使用的 inc 颜色而异(或者如果图像被扫描仪扫描),并且文本检测在手写并输入文字。
标签: matlab opencv image-processing computer-vision opencv3.0