亚洲中字慕日产2020,大陆极品少妇内射AAAAAA,无码av大香线蕉伊人久久,久久精品国产亚洲av麻豆网站

資訊專欄INFORMATION COLUMN

opencv python Harris角點(diǎn)檢測(cè)

宋華 / 687人閱讀

摘要:角點(diǎn)角點(diǎn)所具有的特征輪廓之間的交點(diǎn)對(duì)于同一場(chǎng)景,即使視角發(fā)生變化,通常具備穩(wěn)定性質(zhì)的特征該點(diǎn)附近區(qū)域的像素點(diǎn)無(wú)論在梯度方向上還是其梯度幅值上有著較大變化角點(diǎn)檢測(cè)基本原理使用一個(gè)固定窗口在圖像上進(jìn)行任意方向上的滑動(dòng),比較滑動(dòng)前與滑動(dòng)后兩種情況

Harris Corner Detection

角點(diǎn)

角點(diǎn)所具有的特征:

輪廓之間的交點(diǎn)

對(duì)于同一場(chǎng)景,即使視角發(fā)生變化,通常具備穩(wěn)定性質(zhì)的特征

該點(diǎn)附近區(qū)域的像素點(diǎn)無(wú)論在梯度方向上還是其梯度幅值上有著較大變化

角點(diǎn)檢測(cè)基本原理

使用一個(gè)固定窗口在圖像上進(jìn)行任意方向上的滑動(dòng),比較滑動(dòng)前與滑動(dòng)后兩種情況,窗口中的像素灰度變化程度,如果存在任意方向上的滑動(dòng),都有著較大灰度變化,那么我們可以認(rèn)為該窗口中存在角點(diǎn).

OpenCV中的Harris角點(diǎn)檢測(cè)器

cv2.cornerHarris(src, blockSize, ksize, k[, dst[, borderType]])

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread("img5.png")
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)

#result is dilated for marking the corners, not important
dst = cv2.dilate(dst,None)

# Threshold for an optimal value, it may vary depending on the image.
img[dst>0.01*dst.max()]=[0,0,255]

cv2.imshow("dst",img)
if cv2.waitKey(0) & 0xff == 27:
    cv2.destroyAllWindows()

亞像素級(jí)的角點(diǎn)

有時(shí)需要以最高精度找到角落,
cv2.cornerSubPix(image, corners, winSize, zeroZone, criteria)

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread("img5.png")
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

# find Harris corners
gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)
dst = cv2.dilate(dst,None)
ret, dst = cv2.threshold(dst,0.01*dst.max(),255,0)
dst = np.uint8(dst)

# find centroids
ret, labels, stats, centroids = cv2.connectedComponentsWithStats(dst)

# define the criteria to stop and refine the corners
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 100, 0.001)
corners = cv2.cornerSubPix(gray,np.float32(centroids),(5,5),(-1,-1),criteria)

# Now draw them
res = np.hstack((centroids,corners))
res = np.int0(res)
img[res[:,1],res[:,0]]=[0,0,255]
img[res[:,3],res[:,2]] = [0,255,0]


cv2.imshow("dst",img)
if cv2.waitKey(0) & 0xff == 27:
    cv2.destroyAllWindows()

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://www.ezyhdfw.cn/yun/42068.html

相關(guān)文章

  • opencv python SIFT(尺度不變特征變換)

    摘要:理論前面講的角點(diǎn)檢測(cè)器中的角點(diǎn)在旋轉(zhuǎn)的圖像中也是角點(diǎn),但是縮放呢如果縮放圖像,則角可能不是角例如,檢查下面的簡(jiǎn)單圖像,當(dāng)在同一窗口中放大時(shí),小窗口內(nèi)的小圖像中的角是平坦的所以角點(diǎn)檢測(cè)器不是尺度不變的所以,在年,不列顛哥倫比亞大學(xué)的在他的論 Introduction to SIFT (Scale-Invariant Feature Transform) 理論 前面講的Harris角點(diǎn)檢...

    marek 評(píng)論0 收藏0
  • opencv python Shi-Tomasi角點(diǎn)檢測(cè)

    摘要:低于質(zhì)量水平的所有角落都被拒絕,然后它根據(jù)質(zhì)量按降序?qū)κS嗟慕沁M(jìn)行排序 Shi-Tomasi Corner Detector & Good Features to Track cv2.goodFeaturesToTrack(image, maxCorners, qualityLevel, minDistance[, corners[, mask[, blockSize[, useHa...

    red_bricks 評(píng)論0 收藏0
  • Programming Computer Vision with Python (學(xué)習(xí)筆記九)

    摘要:角檢測(cè)還可以用在運(yùn)動(dòng)檢測(cè)物體識(shí)別等方面。角檢測(cè)角檢測(cè)也叫角檢測(cè)是目前可用的最簡(jiǎn)單的角檢測(cè)算法。為使得計(jì)算更方便,角測(cè)量給出了去除系數(shù)的方法,只要計(jì)算或?yàn)橐粋€(gè)很小的正的常量,我們暫且稱此為方法。你還可以查看我的其它筆記參考資料 角檢測(cè)(Corner detection)是指檢測(cè)圖像中具有代表性的(我們感興趣的)角點(diǎn),一般講為形狀或邊緣的拐角處,這些點(diǎn)可以大略標(biāo)記對(duì)象在圖像中的輪廓和位置,...

    focusj 評(píng)論0 收藏0
  • Programming Computer Vision with Python (學(xué)習(xí)筆記十)

    摘要:如下圖所示,左右是兩張稍有不同的圖片,但都包含了廣州塔,左圖紅色框中標(biāo)出了兩個(gè)感興趣的點(diǎn),我期望找出它們?cè)谟覉D的對(duì)應(yīng)位置即對(duì)應(yīng)點(diǎn)。 現(xiàn)在考慮一個(gè)全景圖拼接的應(yīng)用場(chǎng)景,假設(shè)現(xiàn)有兩張圖片需要拼接成一張全景圖,這兩張圖片是通過(guò)相機(jī)右轉(zhuǎn)一定角度拍攝出來(lái)的,兩張圖片有部分取景是重疊的。如何實(shí)現(xiàn)拼接?當(dāng)然這是一個(gè)不簡(jiǎn)單的問(wèn)題,我們現(xiàn)在只考慮實(shí)現(xiàn)拼接目標(biāo)的第一步:找出圖像中重疊的內(nèi)容,以及分別在兩張...

    lunaticf 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

最新活動(dòng)
閱讀需要支付1元查看
<