加载中...

摘要: 轮廓 #return contours(轮廓列表) hierarchy (轮廓层级) #ApproximationMode CHAIN_APPROX_NONE保存轮廓所有点 #CHAIN_APPROX_SIMPLE只保存角点 #查找轮廓 findContours(img, mode, Approxi 阅读全文
posted @ 2022-03-22 20:30 江上莲花香 阅读(78) 评论(0) 推荐(0)
摘要: 图像二值化 #全局二值化 threshold(img,thresh,maxVal,type) #局部二值化 adaptiveThreshold(img,maxVal,adaptiveMethod, type, blockSize,C) 腐蚀 #获取卷积核 getStructuringElement( 阅读全文
posted @ 2022-03-22 16:24 江上莲花香 阅读(46) 评论(0) 推荐(0)
摘要: 低通滤波 去除噪音或平滑图像 img = cv2.imread('dog.jpeg') kernal = np.ones((5,5),np.float32) / 25 dst = cv2.filter2D(img, -1, kernel) #均值滤波 均匀取值 dst = cv2.blur(img, 阅读全文
posted @ 2022-03-22 14:06 江上莲花香 阅读(83) 评论(0) 推荐(0)
摘要: 图像相加 #图的属性要一样 res = cv2.add(dog, img) #减法要注意顺序,dog - img res = cv2.subtract(dog, img) res = multiply(dog, img) divide(dog, img) 图像融合 #图片属性要一样 #alpha和b 阅读全文
posted @ 2022-03-22 11:35 江上莲花香 阅读(65) 评论(0) 推荐(0)
摘要: 绘制图形 import cv2 import numpy as np #(y,x) img = np.zeros((480, 640, 3), np.uint8) #图片、起点、 终点、 线的颜色 (x,y) 线宽 cv2.line(img, (10, 20), (300, 400), (0,0,2 阅读全文
posted @ 2022-03-22 00:44 江上莲花香 阅读(51) 评论(0) 推荐(0)
摘要: 创建矩阵 import numpy as np a = np.array([1,2,3]) b = np.array([[1,2,3],[4,5,6]]) #高 宽 c = np.zeros((480, 640, 3), np.uint8) d = np.ones((8,8,3), np.uint8 阅读全文
posted @ 2022-03-22 00:17 江上莲花香 阅读(66) 评论(0) 推荐(0)