我正在尝试使用OoenCV中的Hough变换从图像中检测圆圈

时间:2018-03-13 19:17:32

标签: python opencv3.0 hough-transform canny-operator

import cv2
import numpy as np
import time 
img = cv2.imread('img.jpg',0)

ccimg=cv2.Canny(img,100,100)
cv2.imwrite("image.jpg",ccimg)

image=cv2.imread('image.jpg',0)
image = cv2.bilateralFilter(image,9,75,75)
cv2.imshow('Canny[enter image description here][1]',image)


circles = cv2.HoughCircles(image,cv2.HOUGH_GRADIENT,1,20,
                        param1=50,param2=30)

circles = np.uint16(np.around(circles))
print circles
for i in circles[0,:]:
    cv2.circle(img,(i[0],i[1]),i[2],(0,255,0),2)

cv2.imshow('detected circles',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

所以基本上我想要做的是我正在阅读一个图像并将其转换为精确的图像然后我使用那个精巧的图像作为 Hough Gradient 参数..

0 个答案:

没有答案