2024年04月的文章 第4页
python SIFT算法源代码
import cv2 as cv import matplotlib.pyplot as plt # 1读取图像 img = cv.imread('./image/tv.jpg') gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) # 2sift关键点检测 # 2.1实例化sit对象 sift ...
python Shi-Tomasi角点检测源代码
import cv2 as cv import matplotlib.pyplot as plt # 1读取图像 img = cv.imread('./image/tv.jpg') gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) # 2角点检测 corners = cv.goodFeaturesToTra...
python harris角点检测源代码
import cv2 as cv import matplotlib.pyplot as plt import numpy as np # 1读取图像,并转换成灰度图像 img = cv.imread('./image/chess.jpg') gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) # ...
python霍夫线检测源代码
import cv2 as cv import matplotlib.pyplot as plt import numpy as np # 1.加载图片,转为二值图 img = cv.imread('./image/calendar.jpg') gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) edge...
python人脸识别源码
import cv2 as cv import matplotlib.pyplot as plt # 1图像和模板读取 img = cv.imread('./image/wulin.jpg') template = cv.imread('./image/man.jpg') h, w, I = template.shape # 2模板匹配...
python四种边缘检测
import cv2 as cv import matplotlib.pyplot as plt # 统一图片路径 img_url = './image/horse.jpg' # Sober边缘检测 # 1读取图像 img = cv.imread(img_url, 0) # 2计算Sobel卷积结果 x = cv.So...
python图像均值、高斯和中值滤波源代码
import cv2 as cv import matplotlib.pyplot as plt # 1图像读取 img = cv.imread('./image/pic1.jpg') # 2均值滤波 blur = cv.blur(img, (5, 5)) # 3图像显示 plt.rc('font', family='Microsof...
python图像的腐蚀、膨胀、开闭运算、礼帽和黑帽源码
import numpy as np import cv2 as cv import matplotlib.pyplot as plt # 1读取图像 pic_url = './images/pic1.png' img = cv.imread(pic_url) # 2创建核结构 kernel = np.ones((5, 5), np.uin...
python 图像缩放、平移、旋转、仿射、透视、金字塔源代码
import numpy as np import cv2 as cv import matplotlib.pyplot as plt # 1.读取图片 print('欢迎来到图像放大、缩小、平移、旋转、仿射、透视小程序!') pic_url = input('请输入你的图片所在...
python 图像的叠加与混合
import numpy as np import cv2 as cv import matplotlib.pyplot as plt # 1读取图像 img1 = cv.imread('pic1.jpg') img2 = cv.imread('pic2.jpg') # 2加法操作 img3 = cv.add(img1, img2) # CV...
python 图像的绘制源代码
import numpy as np import cv2 as cv import matplotlib.pyplot as plt # 1 创建一个空白的图像 img = np.zeros((512, 512, 3), np.uint8) # 2 绘制图形 cv.line(img, (0, 0), (511, 511), (25...
python图像的io操作源代码
import numpy as np import cv2 as cv import matplotlib.pyplot as plt # 读取图像 img = cv.imread('bilibili.jpg',0) # 显示图像 # 2.1 OPENCV # cv.imshow('bilibili', img) # cv.waitKey(0...