V
Vivek Bhave
Guest
I would like to detect drill holes and tapering in this product
The drill holes are circled lying on the circular boundary. The red circle at the bottom is where the tapering is to be detected.
I have tried using Hough circles to detect the drill holes
import cv2
import cv2.cv as cv
import numpy as np
img = cv2.imread('DSC_1257.JPG',0)
img = cv2.medianBlur(img,5)
cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img,cv.CV_HOUGH_GRADIENT,1,300,
param1=40,param2=20,minRadius=15,maxRadius=30)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
# draw the outer circle
cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2)
# draw the center of the circle
cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3)
imS2 = cv2.resize(cimg, (960, 540))
cv2.imshow('detected circles',imS2 )
cv2.waitKey(0)
cv2.destroyAllWindows()
This does detect the drill holes but it also detect an additional 7 holes elsewhere which are unwanted. I want to detect only the two drill holes and nothing more.Could you please tell me a solution for that and for the tapering problem as well
Continue reading...
The drill holes are circled lying on the circular boundary. The red circle at the bottom is where the tapering is to be detected.
I have tried using Hough circles to detect the drill holes
import cv2
import cv2.cv as cv
import numpy as np
img = cv2.imread('DSC_1257.JPG',0)
img = cv2.medianBlur(img,5)
cimg = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
circles = cv2.HoughCircles(img,cv.CV_HOUGH_GRADIENT,1,300,
param1=40,param2=20,minRadius=15,maxRadius=30)
circles = np.uint16(np.around(circles))
for i in circles[0,:]:
# draw the outer circle
cv2.circle(cimg,(i[0],i[1]),i[2],(0,255,0),2)
# draw the center of the circle
cv2.circle(cimg,(i[0],i[1]),2,(0,0,255),3)
imS2 = cv2.resize(cimg, (960, 540))
cv2.imshow('detected circles',imS2 )
cv2.waitKey(0)
cv2.destroyAllWindows()
This does detect the drill holes but it also detect an additional 7 holes elsewhere which are unwanted. I want to detect only the two drill holes and nothing more.Could you please tell me a solution for that and for the tapering problem as well
Continue reading...