首页 > 其他 > 详细

np使用创建图像 霍夫圆检测 video操作,显示canny边缘

时间:2020-07-09 23:43:34      阅读:96      评论:0      收藏:0      [点我收藏+]
np使用创建图像
def creat_image():
image = np.zeros([400, 400, 3], np.uint8) //三通道
image[:, :, 2] = np.ones([400, 400])*255
cv.imshow(‘creat image‘, image )


霍夫圆检测
def detect_circle_Demo(image):
dst = cv.pyrMeanShiftFiltering(image, 10, 100)
cv.imshow(‘sdasda‘,dst)
cimage = cv.cvtColor(dst, cv.COLOR_BGR2GRAY)
circles = cv.HoughCircles(cimage, cv.HOUGH_GRADIENT, 1, 200, param1=50, param2=30, minRadius=0, maxRadius=0)
circles = np.uint16(np.around(circles))
for i in circles[0, :]:
cv.circle(image, (i[0], i[1]), i[2], (0, 0, 255), 2)
cv.circle(image, (i[0], i[1]), 2, (0, 0, 255), 2)
cv.imshow(‘circles‘, image)
  
video操作,显示canny边缘
def video_Demo():
capture = cv.VideoCapture(0)
while True:
ret, frame = capture.read()
frame = cv.flip(frame, 1)
frame_gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
canny = cv.Canny(frame_gray, 50, 150)
cv.imshow(‘video‘, canny)
c = cv.waitKey(50)
if c == 27:
break

技术分享图片

 

np使用创建图像 霍夫圆检测 video操作,显示canny边缘

原文:https://www.cnblogs.com/qianxunslimg/p/13276760.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!