find_circles.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:eclipse2017 作者: google 项目源码 文件源码
def findCircles(image):
    image_cols, image_rows, _ = image.shape

    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    first, second = getRescaledDimensions(gray.shape[1], gray.shape[0], HD_MAX_X, HD_MAX_Y)
    gray = cv2.resize(gray, (first, second))
    blurred = cv2.bilateralFilter(gray, 9, 75, 75)
    gray = cv2.addWeighted(gray, 1.5, blurred, -0.5, 0)
    gray = cv2.bilateralFilter(gray, 9, 75, 75)

    # # detect circles in the image
    dp = 1
    c1 = 100
    c2 = 15
    circles = cv2.HoughCircles(gray, cv2.cv.CV_HOUGH_GRADIENT, dp, second / 8, param1=c1, param2=c2)
    if not len(circles):
        return None
    return circles[0][0]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号