这是一个用OpenCV计算机视觉库结合python对带有二维码的图片或者电子票据进行识别并处理的项目; 现在只做了对原有二维码进行批量识别并替换的功能; 其他的功能可以在改项目基础上进行扩展、改进。
加入:
alpha = 1.8 # 对比度因子
beta = -35 # 亮度因子
adjusted_image = cv2.convertScaleAbs(image, alpha=alpha, beta=beta)
# cv2.imshow('Adjusted Image', adjusted_image)
# cv2.waitKey(0)
# cv2.destroyAllWindows()
gray = cv2.cvtColor(adjusted_image, cv2.COLOR_BGR2GRAY)
# cv2.imshow('Grayscale Image', gray)
# cv2.waitKey(0)
filter_image = cv2.bilateralFilter(gray, 13, 26, 6)
# cv2.imshow('Filtered Image', filter_image)
# cv2.waitKey(0)
_, binary_image = cv2.threshold(filter_image, 210, 255, cv2.THRESH_BINARY_INV)
# cv2.imshow('Binary Image', binary_image)
# cv2.waitKey(0)
