上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页
摘要: # 从摄像头获取图像数据 cap = cv2.VideoCapture(0) while(True): # ret 读取成功True或失败False # frame读取到的图像的内容 # 读取一帧数据 ret,frame = cap.read() # 变为灰度图 gray = cv2.cvtColo 阅读全文
posted @ 2020-08-30 09:23 yunshangyue 阅读(163) 评论(0) 推荐(0) 编辑
摘要: from imutils import * image = imread('image/school.jpg') show(image) def edge_detection(image,minVal=100,maxVal=200): image = cv2.cvtColor(image, cv2. 阅读全文
posted @ 2020-08-30 09:22 yunshangyue 阅读(289) 评论(0) 推荐(0) 编辑
摘要: from imutils import * image = imread('image/bricks.png') show(image) def gradient(image): image = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) # cv2.CV_64F 阅读全文
posted @ 2020-08-30 09:21 yunshangyue 阅读(132) 评论(0) 推荐(0) 编辑
摘要: from imutils import * #载入图片,并以灰度显示 image = imread('image/coins.jpg') show(image) gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY) plt.imshow(gray,'gray' 阅读全文
posted @ 2020-08-30 09:20 yunshangyue 阅读(110) 评论(0) 推荐(0) 编辑
摘要: image = imread('image.jpg') (R, G, B) = cv2.split(image) zeros = np.zeros(image.shape[:2],dtype='uint8') show(cv2.merge([R,zeros,zeros])) show(cv2.mer 阅读全文
posted @ 2020-08-30 09:18 yunshangyue 阅读(197) 评论(0) 推荐(0) 编辑
摘要: #腐蚀:选取kernel区域内的最小值 # 矩形 kernel1 = cv2.getStructuringElement(cv2.MORPH_RECT, (5,5)) print(kernel1) # 椭圆 kernel2 = cv2.getStructuringElement(cv2.MORPH_ 阅读全文
posted @ 2020-08-30 09:15 yunshangyue 阅读(339) 评论(0) 推荐(0) 编辑
摘要: image = imread('image.jpg') show(image) #5个像素的加权平均值 #像素降低 for i in range(4): image = cv2.pyrDown(image) print(image.shape) show(image) #像素提高 for i in 阅读全文
posted @ 2020-08-30 09:13 yunshangyue 阅读(166) 评论(0) 推荐(0) 编辑
摘要: rectangle = np.zeros((300,300,3),dtype='uint8') white = (255,255,255) cv2.rectangle(rectangle, (25,25), (275,275), white, -1) show(rectangle) circle = 阅读全文
posted @ 2020-08-30 09:12 yunshangyue 阅读(150) 评论(0) 推荐(0) 编辑
摘要: # 水平翻转 image = imread("test.jpg") image = cv2.flip(image,1) show(image) # 垂直翻转 image = imread("test.jpg") image = cv2.flip(image,0) show(image) # 水平+垂 阅读全文
posted @ 2020-08-30 09:10 yunshangyue 阅读(194) 评论(0) 推荐(0) 编辑
摘要: image = imread('image.jpg') M = np.float32([[1,0,250],[0,1,500]]) #X轴右移250个像素,Y轴下移500个像素 #前面的0,1 是在选择坐标轴 shifted = cv2.warpAffine(image, M, (image.sha 阅读全文
posted @ 2020-08-30 09:08 yunshangyue 阅读(243) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 19 下一页