脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - Python中OpenCV图像特征和harris角点检测

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

2022-01-06 00:26一痴傻人 Python

Harris角点检测算子是于1988年由CHris Harris & Mike Stephens提出来的。在具体展开之前,不得不提一下Moravec早在1981就提出来的Moravec角点检测算子。本文重点给大家介绍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角点检测

到此这篇关于Python中OpenCV图像特征和harris角点检测的文章就介绍到这了,更多相关OpenCV-图像特征-harris角点检测内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/erfan_lang/article/details/120262257

延伸 · 阅读

精彩推荐