我正在尝试实现一个基本的 RANSAC 算法来检测灰度图像中的圆圈。
问题是,在我对图像进行阈值处理并搜索非零像素后,我得到了正确的形状,但是这些点以某种方式从原始位置离域:
video = cv2.VideoCapture('../video/01_CMP.avi')
video.set(cv2.CAP_PROP_POS_FRAMES,200)
succ, frame = video.read()
frame = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
frame = cv2.normalize(frame,frame, alpha=0,norm_type=cv2.NORM_MINMAX, beta = 255)
ret,frame = cv2.threshold(frame,35,255,cv2.THRESH_BINARY)
points = n.where(frame>0) #Thresholded pixels
#Orienting correctly the points in a (n,2) shape
#needed because of arguments of circle.points_distance()
points = n.transpose(n.vstack([points[0],points[1]]))
plt.imshow(frame,cmap='gray');
plt.plot(points[:,0],points[:,1],'wo')
video.release()
我在这里想念什么?