网络编程
位置:首页>> 网络编程>> Python编程>> Python中OpenCV图像特征和harris角点检测

Python中OpenCV图像特征和harris角点检测

作者:一痴傻人  发布时间:2023-08-04 22:32:56 

标签:OpenCV,图像特征,harris,角点检测

概念

Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测

第一步:计算一个梯度 Ix,Iy

Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测

第二步:整合矩阵,计算特征值

Python中OpenCV图像特征和harris角点检测

第三步:比较特征值的大小

Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测

第四步: 非极大值抑制,把真正的角点留下来,角点周围的过滤掉

代码实现

Python中OpenCV图像特征和harris角点检测


import cv2
import numpy as np

img =cv2.imread('pie.png')
print('img.shape',img.shape)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)
print('dst.shape',dst.shape)

Python中OpenCV图像特征和harris角点检测


img[dst>0.01*dst.max()]=[0,0,255]
cv2.imshow('dst',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测
Python中OpenCV图像特征和harris角点检测

来源:https://blog.csdn.net/erfan_lang/article/details/120262257

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com