# 导入工具包
from imutils import contours
import numpy as np
import argparse
import cv2
import myutils# 设置参数
# ap = argparse.ArgumentParser()
# ap.add_argument("-i", "--image", required=True,
# help="path to input image")
# ap.add_argument("-t", "--template", required=True,
# help="path to template OCR-A image")
# args = vars(ap.parse_args())# 指定信用卡类型
FIRST_NUMBER = {"3": "American Express","4": "Visa","5": "MasterCard","6": "Discover Card"
}
# 绘图展示
def cv_show(name,img):cv2.imshow(name, img)cv2.waitKey(0)cv2.destroyAllWindows()
# 读取一个模板图像
# img = cv2.imread(args["template"])
img=cv2.imread('ocr_a_reference.png')
cv_show('img',img)
# 灰度图
ref = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# cv_show('ref',ref)
# 二值图像
ref = cv2.threshold(ref, 10, 255, cv2.THRESH_BINARY_INV)[1]
# cv_sho