python opencv3 滤波器 卷积核】的更多相关文章

git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np from scipy import ndimage # 3*3 的高通卷积核 kernel_3x3 = np.array([ [-1, -1, -1], [-1, 8, -1], [-1, -1, -1] ]) # 5*5 高通卷积核 kernel_5x5 = np.array([ [-1, -1, -1, -1…
不需要编译或其他操作,只需一句话安装第三方库利用sift等特征提取算法: sudo pip3 install opencv-contrib-python 附网站:https://pypi.python.org/pypi/opencv-contrib-python…
转自:https://www.cnblogs.com/arkenstone/p/6961453.html opencv3.2将中文输出到图片上 opencv自带的putText函数无法输出utf8类型的字符,因此无法将中文打印到图片上.用这篇文章的freetype可以实现中文输出,但是需要将字符解码转码比较麻烦,而Pillow的Image函数输出中文则相对容易些,因此这里的做法是现将图片从从cv2格式转到PIL格式,加上中文后再转成cv2格式输出. 1. 下载中文字体库 这里可以参考之前matp…
git:https://github.com/linyi0604/Computer-Vision # coding:utf8 import cv2 import numpy as np # 读入图像 img = cv2.imread("../data/line1.png") # 转为灰度图像 gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # Canny边缘检测 edges = cv2.Canny(gray, 50, 100) "&q…
python opencv练习 自定义一张[512, 512, 3]的图像 在上面写写字,画画圈和矩形 显示 代码为: import cv2 import numpy as np img = np.zeros([512, 512, 3], dtype=np.uint8) for i in range(512): for j in range(512): img[i, j, :] = [i % 256, j % 256, (i + j) % 256] cv2.rectangle(img, (200…
git:https://github.com/linyi0604/Computer-Vision 使用mog2算法进行背景分割 # coding:utf-8 import cv2 # 获取摄像头对象 cap = cv2.VideoCapture(0) # 背景分割器对象 mog = cv2.createBackgroundSubtractorMOG2() while True: ret, frame = cap.read() fgmask = mog.apply(frame) cv2.imsho…
git:https://github.com/linyi0604/Computer-Vision 思路:  开启摄像头后 设置一个当前帧为背景, 在之后检测到的帧都与背景对比不同,对不同的地方进行检测 # coding:utf-8 """ 计算帧之间的差异 考虑背景帧与其他帧之间的差异 """ import cv2 import numpy as np # 调用摄像头 camera = cv2.VideoCapture(0) kernel = n…
git:https://github.com/linyi0604/Computer-Vision # coding:utf-8 import cv2 # 检测i方框 包含o方框 def is_inside(o, i): ox, oy, ow, oh = o ix, iy, iw, ih = i return ox > ix and ox + ow < ix + iw and oy + oh < iy + ih # 将人外面的方框画出来 def draw_person(image, per…
git:https://github.com/linyi0604/Computer-Vision 匹配准确率非常高. 单应性指的是图像在投影发生了 畸变后仍然能够有较高的检测和匹配准确率 # coding:utf-8 """ 单应性匹配: 两幅图像中的一幅 出现投影畸变的时候,他们还能彼此匹配 """ import cv2 import numpy as np # 最小匹配数量设为10个, 大于这个数量从中筛选出10个最好的 MIN_MATCH_…
git:https://github.com/linyi0604/Computer-Vision bf暴力匹配: # coding:utf-8 import cv2 """ orb特征检测和匹配 两幅图片分别是 乐队的logo 和包含该logo的专辑封面 利用orb进行检测后进行匹配两幅图片中的logo """ # 按照灰度图像的方式读入两幅图片 img1 = cv2.imread("../data/logo1.png", c…