我试着检测OMR纸上的气泡,它看起来像这样:
我的边缘检测和轮廓显示代码引用自here。然而,在找到实际轮廓之前,我试图检测边缘,但不知何故无法设置正确的参数值。
我得到的是:
代码:from imutils.perspective import four_point_transform
from imutils import contours
import numpy as np
import argparse
import imutils
import cv2
def auto_canny(image, sigma=0.50):
# compute the median of the single channel pixel intensities
v = np.median(image)
# apply automatic Canny edge detection using the computed median
lower = int(max(0, (1.0 - sigma) * v))
upper &