1. 程式人生 > >opencv-特徵檢測與描述

opencv-特徵檢測與描述

參考:

3、https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html

4、https://github.com/makelove/OpenCV-Python-Tutorial# 進階教程

5、https://docs.opencv.org/3.3.0/index.html  官方英文教程

9、https://github.com/opencv/opencv   官方github

10、https://github.com/abidrahmank/OpenCV2-Python-Tutorials

注:安裝的版本 opencv_python-3.3.0

-cp36-cp36m-win_amd64.whl

參考:https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html

Harris角檢測

目標

In this chapter,

  • We will understand the concepts behind Harris Corner Detection.
  • We will see the functions:cv2.cornerHarris(),cv2.cornerSubPix()

OpenCV中的Harris Corner Detector

OpenCV具有函式cv2.cornerHarris()。 其引數是:

img - 輸入影象,它應該是灰度和float32型別。
blockSize - 角點檢測所考慮的鄰域大小
ksize - 所用Sobel衍生物的孔徑引數。
k - 哈里斯檢測器自由引數的方程式。


import cv2
import numpy as np

filename = 'chessboard.jpg'
img = cv2.imread(filename)
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()

Harris Corner Detection

Corner與SubPixel精度

有時,您可能需要以最高的精度找到角落。 OpenCV帶有一個函式cv2.cornerSubPix(),進一步優化了用子畫素精度檢測到的角。 以下是一個例子。 像往常一樣,我們需要首先找到哈里角。 然後我們通過這些角的質心(在一個角落可能有一堆畫素,我們採取他們的質心)來細化它們。 哈里斯角被標記為紅色畫素,精緻的角落標記為綠色畫素。 對於此功能,我們必須定義何時停止迭代。 我們在指定次數的迭代之後停止,或者達到一定的準確度,以先到者為準。 我們還需要定義它將搜尋角落的鄰域的大小。
import cv2
import numpy as np

filename = 'chessboard.jpg'
img = cv2.imread(filename)
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.imwrite('subpixel5.png',img)
cv2.imshow('subpixel5.png',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

Shi-Tomasi角檢測儀及追蹤功能

目標

In this chapter,

  • We will learn about the another corner detector: Shi-Tomasi Corner Detector
  • We will see the function:cv2.goodFeaturesToTrack()

程式碼

OpenCV有一個功能,cv2.goodFeaturesToTrack()。 它通過Shi-Tomasi方法(或Harris Corner Detection,如果您指定)在影象中找到N個最強的角落。 像往常一樣,影象應該是灰度影象。 然後指定要查詢的角數。 然後指定質量水平,這是0-1之間的值,表示每個人被拒絕的最低角度質量。 然後我們提供檢測到的角落之間的最小歐幾里德距離。

有了所有這些資訊,該功能會在影象中找到角落。 質量水平以下的所有角落都被拒絕。 然後按照降序對質量進行排序。 然後功能首先是最強的角落,丟擲最小距離範圍內的所有附近角落,並返回N個最強的角落。

In below example, we will try to find 25 best corners:

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

img = cv2.imread('chessboard.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

corners = cv2.goodFeaturesToTrack(gray,25,0.01,10)
corners = np.int0(corners)

for i in corners:
    x,y = i.ravel()
    cv2.circle(img,(x,y),3,255,-1)

plt.imshow(img),plt.show()
Shi-Tomasi Corners

SIFT簡介(Scale-Invariant Feature Transform)

目標

In this chapter,
  • We will learn about the concepts of SIFT algorithm
  • We will learn to find SIFT Keypoints and Descriptors.

SIFT演算法主要涉及四個步驟。 我們會一個一個看到他們。

1. Scale-space Extrema Detection

尺度空間極值檢測

2. Keypoint Localization

關鍵點本地化

3. Orientation Assignment

定位任務

4. Keypoint Descriptor

關鍵描述符

5. Keypoint Matching

關鍵點匹配

SIFT in OpenCV

所以現在看看OpenCV中提供的SIFT功能。 我們從關鍵點檢測開始,並繪製它們。 首先我們要構造一個SIFT物件。 我們可以傳遞不同的引數,它們是可選的,它們在文件中有很好的解釋。
import cv2
import numpy as np


img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

sift = cv2.SIFT()
kp = sift.detect(gray,None)

img=cv2.drawKeypoints(gray,kp)

# cv2.imwrite('sift_keypoints.jpg',img)
cv2.imshow('sift_keypoints.jpg',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

sift.detect()函式在影象中找到關鍵點。 如果您只想搜尋影象的一部分,您可以mask。 每個關鍵點是一個特殊的結構,它具有許多屬性,如(x,y)座標,有意義的鄰域的大小,指定其方向的角度,指定關鍵點強度的響應等。

OpenCV還提供cv2.drawKeyPoints()函式,它在關鍵點的位置繪製小圓。 如果你通過一個標誌cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS,它將繪製一個大小為關鍵點的圓圈,甚至顯示它的方向。 見下面的例子。

img=cv2.drawKeypoints(gray,kp,flags=cv2.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv2.imwrite('sift_keypoints.jpg',img)

SIFT Keypoints


現在要計算描述符,OpenCV提供了兩種方法。

1、既然你已經找到了關鍵點,你可以呼叫sift.compute(),它從我們發現的關鍵點計算描述符。 例如:kp,des = sift.compute(gray,kp)
2、如果沒有找到關鍵點,可以使用函式sift.detectAndCompute()在單個步驟中直接找到關鍵點和描述符。

sift = cv2.SIFT()
kp, des = sift.detectAndCompute(gray,None)

這裡的kp將是一個關鍵點列表,des是一個numpy陣列的形狀Number\_of\_Keypoints \times 128

所以我們得到了關鍵點,描述符等。現在我們想看看如何匹配不同影象中的關鍵點。 我們將在下一章中學習。

Introduction to SURF (Speeded-Up Robust Features)

目標

In this chapter,
  • We will see the basics of SURF
  • We will see SURF functionalities in OpenCV

SURF in OpenCV

OpenCV就像SIFT一樣提供SURF功能。 您可以啟動具有一些可選條件的SURF物件,如64/128-dim描述符,直立/正常SURF等。所有的細節都在文件中有很好的解釋。 那麼就像我們在SIFT中一樣,我們可以使用SURF.detect(),SURF.compute()等來找到關鍵點和描述符。

首先,我們將看到一個關於如何找到SURF關鍵點和描述符並繪製它的簡單演示。 所有示例都顯示在Python終端中,因為它與SIFT相同。
>>> img = cv2.imread('fly.png',0)

# Create SURF object. You can specify params here or later.
# Here I set Hessian Threshold to 400
>>> surf = cv2.SURF(400)

# Find keypoints and descriptors directly
>>> kp, des = surf.detectAndCompute(img,None)

>>> len(kp)
 699

1199個關鍵點太多,無法在圖片中顯示。 我們把它減少到50左右,畫一幅影象。 在匹配的時候,我們可能需要所有這些功能,但現在不是。 所以我們增加了Hessian Threshold。
# Check present Hessian threshold
>>> print surf.hessianThreshold
400.0

# We set it to some 50000. Remember, it is just for representing in picture.
# In actual cases, it is better to have a value 300-500
>>> surf.hessianThreshold = 50000

# Again compute keypoints and check its number.
>>> kp, des = surf.detectAndCompute(img,None)

>>> print len(kp)
47
>>> img2 = cv2.drawKeypoints(img,kp,None,(255,0,0),4)

>>> plt.imshow(img2),plt.show()
看下面的結果。 您可以看到SURF更像是一個blob檢測器。 它檢測蝴蝶翅膀上的白色斑點。 您可以使用其他影象進行測試。

SURF Keypoints with Orientation

現在我要應用U-SURF,以便找不到方向。

# Check upright flag, if it False, set it to True
>>> print surf.upright
False

>>> surf.upright = True

# Recompute the feature points and draw it
>>> kp = surf.detect(img,None)
>>> img2 = cv2.drawKeypoints(img,kp,None,(255,0,0),4)

>>> plt.imshow(img2),plt.show()

看下面的結果。 所有方向都顯示在相同的方向。 它比以前更快。 如果您正在處理方向不是問題的情況(如全景拼接)等,這更好。

Upright-SURF

最後,我們檢查描述符大小,如果只有64-dim,則將其更改為128。

# Find size of descriptor
>>> print surf.descriptorSize()
64

# That means flag, "extended" is False.
>>> surf.extended
 False

# So we make it to True to get 128-dim descriptors.
>>> surf.extended = True
>>> kp, des = surf.detectAndCompute(img,None)
>>> print surf.descriptorSize()
128
>>> print des.shape
(47, 128)

FAST演算法進行角檢測

目標

In this chapter,
  • We will understand the basics of FAST algorithm
  • We will find corners using OpenCV functionalities for FAST algorithm.

OpenCV中的快速特徵檢測器

它被稱為OpenCV中的任何其他特徵檢測器。 如果需要,您可以指定閾值,是否應用非最大抑制,要使用的鄰域等。

對於鄰域,定義了三個標誌:cv2.FAST_FEATURE_DETECTOR_TYPE_5_8,cv2.FAST_FEATURE_DETECTOR_TYPE_7_12和cv2.FAST_FEATURE_DETECTOR_TYPE_9_16。 以下是有關如何檢測和繪製FAST特徵點的簡單程式碼。
import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('simple.jpg',0)

# Initiate FAST object with default values
fast = cv2.FastFeatureDetector()

# find and draw the keypoints
kp = fast.detect(img,None)
img2 = cv2.drawKeypoints(img, kp, color=(255,0,0))

# Print all default params
print "Threshold: ", fast.getInt('threshold')
print "nonmaxSuppression: ", fast.getBool('nonmaxSuppression')
print "neighborhood: ", fast.getInt('type')
print "Total Keypoints with nonmaxSuppression: ", len(kp)

cv2.imwrite('fast_true.png',img2)

# Disable nonmaxSuppression
fast.setBool('nonmaxSuppression',0)
kp = fast.detect(img,None)

print "Total Keypoints without nonmaxSuppression: ", len(kp)

img3 = cv2.drawKeypoints(img, kp, color=(255,0,0))

cv2.imwrite('fast_false.png',img3)
FAST Keypoints

BRIEF (二進位制魯棒獨立基本特徵)


BRIEF in OpenCV

下面的程式碼顯示了在CenSurE檢測器的幫助下的BRIEF描述符的計算。 (CenSurE檢測器在OpenCV中稱為STAR檢測器)

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

img = cv2.imread('simple.jpg',0)

# Initiate STAR detector
star = cv2.FeatureDetector_create("STAR")

# Initiate BRIEF extractor
brief = cv2.DescriptorExtractor_create("BRIEF")

# find the keypoints with STAR
kp = star.detect(img,None)

# compute the descriptors with BRIEF
kp, des = brief.compute(img, kp)

print brief.getInt('bytes')
print des.shape

函式brief.getInt('bytes')給出以位元組為單位的n_d大小。 預設情況下為32.下一個是匹配,這將在另一章中完成。

ORB (定向快速旋轉簡介)

ORB in OpenCV

像往常一樣,我們必須建立一個帶有函式cv2.ORB()或使用feature2d通用介面的ORB物件。 它有多個可選引數。 最有用的是nFeatures,其表示要保留的最大特徵數(預設為500),scoreType表示Harris分數或FAST分數以排列特徵(預設為Harris分數)等。另一引數WTA_K決定點數 它產生定向Brief描述符的每個元素。 預設情況下是兩個,即一次選擇兩個點。 在這種情況下,為了匹配,使用NORM_HAMMING距離。 如果WTA_K為3或4,則需要3或4個點來生成簡要描述符,則通過NORM_HAMMING2定義匹配距離。

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

img = cv2.imread('simple.jpg',0)

# Initiate STAR detector
orb = cv2.ORB()

# find the keypoints with ORB
kp = orb.detect(img,None)

# compute the descriptors with ORB
kp, des = orb.compute(img, kp)

# draw only keypoints location,not size and orientation
img2 = cv2.drawKeypoints(img,kp,color=(0,255,0), flags=0)
plt.imshow(img2),plt.show()

特徵匹配

強力匹配ORB描述符

在這裡,我們將看到一個關於如何匹配兩個影象之間的功能的簡單示例。 在這個例子,我有一個queryImage和一個trainImage。 我們將嘗試使用特徵匹配在trainImage中查詢queryImage。 (圖片是/samples/c/box.png和/samples/c/box_in_scene.png)

我們正在使用SIFT描述符來匹配特徵。 所以我們開始載入影象,查詢描述符等
import numpy as np
import cv2
from matplotlib import pyplot as plt

img1 = cv2.imread('box.png',0)          # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
orb = cv2.ORB()

# find the keypoints and descriptors with SIFT
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)

接下來,我們建立一個帶距離測量的BFMatcher物件cv2.NORM_HAMMING(因為我們使用ORB),並且開啟crossCheck以獲得更好的結果。 然後我們使用Matcher.match()方法在兩個影象中獲得最佳匹配。 我們按照他們的距離的升序對它們進行排序,以便最好的匹配(低距離)來到前面。 然後我們只畫出前10個匹配(只是為了能見度,你可以隨意增加)

# create BFMatcher object
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

# Match descriptors.
matches = bf.match(des1,des2)

# Sort them in the order of their distance.
matches = sorted(matches, key = lambda x:x.distance)

# Draw first 10 matches.
img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:10], flags=2)

plt.imshow(img3),plt.show()
ORB Feature Matching with Brute-Force

什麼是Matcher物件?

matches=bf.match(des1,des2)行的結果是DMatch物件的列表。 此DMatch物件具有以下屬性:

DMatch.distance - 描述符之間的距離。 越低越好。
DMatch.trainIdx - 訓練描述符中描述符的索引
DMatch.queryIdx - 查詢描述符中描述符的索引
DMatch.imgIdx - 訓練影象的索引。

強力匹配SIFT描述符和比率測試

這一次,我們將使用BFMatcher.knnMatch()獲得最佳匹配。 在這個例子中,我們將k = 2,以便我們可以在他的論文中應用D.Lowe解釋的比例測試。
import numpy as np
import cv2
from matplotlib import pyplot as plt

img1 = cv2.imread('box.png',0)          # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv2.SIFT()

# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)

# BFMatcher with default params
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1,des2, k=2)

# Apply ratio test
good = []
for m,n in matches:
    if m.distance < 0.75*n.distance:
        good.append([m])

# cv2.drawMatchesKnn expects list of lists as matches.
img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,good,flags=2)

plt.imshow(img3),plt.show()
SIFT Descriptor with ratio test

基於FLANN的Matcher

FLANN代表近似近鄰的快速庫。 它包含針對大型資料集中的快速最近鄰搜尋和高維度特徵優化的演算法集合。 它比BFMatcher對於大型資料集的工作速度更快。 我們將看到FLANN的匹配器的第二個例子。

對於基於FLANN的匹配器,我們需要通過兩個指定要使用的演算法的字典及其相關引數。首先是IndexParams。 對於各種演算法,FLANN文件將介紹要傳遞的資訊。總之,對於像SIFT,SURF等演算法,您可以傳遞以下內容:

index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)

使用ORB時,可以傳遞以下內容。 根據文件推薦註釋的值,但在某些情況下不提供必需的結果。 其他值工作得很好

index_params= dict(algorithm = FLANN_INDEX_LSH,
table_number = 6, # 12
key_size = 12,     # 20
multi_probe_level = 1) #2

第二個字典是SearchParams。 它指定索引中的樹應該遞迴遍歷的次數。 更高的值提供更好的精度,但也需要更多的時間。 如果要更改該值,請傳遞search_params=dict(checks=100)

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

img1 = cv2.imread('box.png',0)          # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv2.SIFT()

# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)

# FLANN parameters
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks=50)   # or pass empty dictionary
flann = cv2.FlannBasedMatcher(index_params,search_params)

matches = flann.knnMatch(des1,des2,k=2)

# Need to draw only good matches, so create a mask
matchesMask = [[0,0] for i in xrange(len(matches))]

# ratio test as per Lowe's paper
for i,(m,n) in enumerate(matches):
    if m.distance < 0.7*n.distance:
        matchesMask[i]=[1,0]

draw_params = dict(matchColor = (0,255,0),
singlePointColor = (255,0,0),
matchesMask = matchesMask,
flags = 0)

img3 = cv2.drawMatchesKnn(img1,kp1,img2,kp2,matches,None,**draw_params)

plt.imshow(img3,),plt.show()
FLANN based matching

特徵匹配+Homography 查詢物件

程式碼

首先,像往常一樣,讓我們在影象中找到SIFT特徵,並應用比例測試來找到最佳匹配。

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

MIN_MATCH_COUNT = 10
img1 = cv2.imread('box.png',0)          # queryImage
img2 = cv2.imread('box_in_scene.png',0) # trainImage
# Initiate SIFT detector
sift = cv2.SIFT()

# find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)

FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks = 50)

flann = cv2.FlannBasedMatcher(index_params, search_params)

matches = flann.knnMatch(des1,des2,k=2)

# store all the good matches as per Lowe's ratio test.
good = []
for m,n in matches:
    if m.distance < 0.7*n.distance:
        good.append(m)

現在我們設定一個條件,至少10個匹配(由MIN_MATCH_COUNT定義)在那裡找到物件。 否則,只需顯示一條訊息,表示不存在足夠的匹配。

如果找到足夠的匹配,我們在兩個影象中提取匹配的關鍵點的位置。 他們被傳遞到找到相應的轉型。 一旦我們得到這個3x3變換矩陣,我們可以使用它將queryImage的角點轉換成trainImage中的相應點。 然後我們畫它。

if len(good)>MIN_MATCH_COUNT:
    src_pts = np.float32([ kp1[m.queryIdx].pt for m in good ]).reshape(-1,1,2)
    dst_pts = np.float32([ kp2[m.trainIdx].pt for m in good ]).reshape(-1,1,2)

    M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC,5.0)
    matchesMask = mask.ravel().tolist()

    h,w = img1.shape
    pts = np.float32([ [0,0],[0,h-1],[w-1,h-1],[w-1,0] ]).reshape(-1,1,2)
    dst = cv2.perspectiveTransform(pts,M)

    img2 = cv2.polylines(img2,[np.int32(dst)],True,255,3, cv2.LINE_AA)

else:
    print "Not enough matches are found - %d/%d" % (len(good),MIN_MATCH_COUNT)
    matchesMask = None

最後,我們繪製我們的內聯(如果成功找到物件)或匹配關鍵點(如果失敗)。

draw_params = dict(matchColor = (0,255,0), # draw matches in green color
singlePointColor = None,
matchesMask = matchesMask, # draw only inliers
flags = 2)

img3 = cv2.drawMatches(img1,kp1,img2,kp2,good,None,**draw_params)

plt.imshow(img3, 'gray'),plt.show()
Finding object with feature homography

相關推薦

opencv-特徵檢測描述

參考: 3、https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_tutorials.html 4、https://github.com/makelove/OpenCV-Pytho

《python+opencv實踐》四、影象特徵提取描述——30Harris 角點檢測

目標• 理解Harris 角點檢測的概念 • 學習函式:cv2.cornerHarris(),cv2.cornerSubPix() 原理 在上一節我們已經知道了角點的一個特性:向任何方向移動變化都很大。Chris_Harris 和Mike_Stephens 早在1988 年

OpenCv-C++-ORB特徵檢測匹配

影象的特徵點可以簡單的理解為影象中比較顯著顯著的點,如輪廓點,較暗區域中的亮點,較亮區域中的暗點等。 ORB的全稱是ORiented Brief,採用FAST(features from accelerated segment test)演算法來檢測特徵點。 與Brisk,AKAZE

OpenCv-C++-BRISK特徵檢測匹配

BRISK:Binary Robust Invariant Scalable Keypoints。它是一種二進位制的特徵描述運算元。它具有較好的旋轉不變性、尺度不變性,較好的魯棒性等。在對有較大模糊的影象配準時,BRISK演算法在其中表現最為出色。 演算法原理參考下面這篇文章,其中的表達

OpenCV學習筆記】三十七、特徵檢測匹配(二)——SIFT特徵點匹配

特徵檢測與匹配(二)——SIFT特徵點匹配 1.SIFT特徵點提取 2.繪製特徵點 3.特徵點描述符(特徵向量)提取 4.使用暴力匹配器進行暴力匹配 5.對匹配結果進行篩選(依據DMatch結構體中的float型別變數distance進行篩選) 6.繪製匹配結果 先上ppt

opencv(30)---特徵檢測匹配(1)---SIFT特徵點提取

基本概念 特徵點的檢測和匹配是計算機視覺中非常重要的技術之一, 在物體識別、視覺跟蹤、三維重建等領域都有很廣泛的應用。OpenCV提供瞭如下幾種特徵檢測方法: “FAST”——FastFeatureDetector “STAR”——StarFeatureD

openCV-人臉檢測特徵點識別

綜述 最近在做計算機視覺的一些基礎訓練,用opencv做了做人臉檢測。 注意opencv的人臉檢測不是基於深度學習的。後期我還做了用tensorflow搞人臉識別的demo,到時候再發一下。 環境 mac os pycharm 使用opencv3

OpenCV學習筆記__特徵檢測匹配之 SURF演算法

SURF 演算法  ——“加速版的具有魯棒性的特徵”演算法 步驟: 特徵檢測 —— 特徵描述 —— 特徵匹配 實現流程: (1)特徵檢測:SurfFeatureDetector類 . detec

【CV】實驗二:特徵檢測匹配

概述   特徵檢測與匹配的目標是識別一個影象中的關鍵點與另一個影象中的對應點之間的配對。在此實驗中,你將編寫程式碼以檢測影象中的特徵點(對於平移、旋轉和照明具有一定的不變性),並在另一個影象中找到最佳匹配特徵。   實施細節 特徵檢測 參考資料 Harris角點檢測演算法——lwzkil

特徵檢測特徵匹配

一、使用surf演算法實現 1、繪製關鍵點函式 void drawKeyPoints(const Mat &image,const vector<KeyPoint>&keypoints,Mat &outImage,const Scalar &color

opencv——特徵檢測

繪製關鍵點的drawKeypoints()函式: void drawKeypoints( const Mat &image,//輸入影象 const vector<KeyPoint> &keypoints,//

SURF特徵檢測匹配

好的特徵應該具有以下幾個特點: 重複性:不同影象相同的區域應該能被重複檢測到,而且不受到旋轉、模糊、光照等因素的影響; 可區分性:不同的檢測子,應該可以被區分出來,而為了區分它們,應運而生的就是與檢測對應的描述子了; 數量適宜:檢測子可別太多,不然啥阿貓阿狗都能出

基於Harris的特徵檢測匹配

<span style="font-size:10px; font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-weight: normal;">

OpenCV特徵提取影象檢索實現(附程式碼)

翻譯 | AI科技大本營(ID:rgznai100) 參與 | 張蔚敏 審校 | reason_W “拍立淘”“一鍵識花”“街景匹配”……不知道大家在使用這些神奇的功能的時候,有沒有好奇過它們背後的技術原理?其實這些技術都離不開最基本的影象檢索技術。本篇文

SIFT特徵檢測RANSAC過濾

/* *@function SiftDetect.cpp *@brief 對sift特徵檢測和匹配進行測試,並實現RANSAC演算法進行過濾錯配點 *@author ltc *@date 11:20 Saturday,28 November,2015 */ #in

OpenCV特徵檢測出現Unhandled exception at……Access violation reading location 0x00000000.

OpenCV版本為2.4.12,Visual Studio 開發環境中執行。 在影象特徵檢測、匹配中出現了執行錯誤: Unhandled exception at 0x569D1C00 (opencv_features2d2412d.dll) in Macher.exe:

【MFC基礎入門】OpenCV人臉檢測馬賽克

這是OpenCV的程式碼,在這基礎上加了馬賽克。 void CFaceDetectionDlg::detect_and_draw( IplImage* img ) { //static CvScalar colors[] = //{ // {{0,

【CV現狀-3.3】特徵提取描述

#磨染的初心——計算機視覺的現狀 【這一系列文章是關於計算機視覺的反思,希望能引起一些人的共鳴。可以隨意傳播,隨意噴。所涉及的內容過多,將按如下內容劃分章節。已經完成的會逐漸加上鍊接。】 緣起 三維感知 目標識別 3.0. 目標是什麼 3.1. 影象分割 3.2. 紋理與材質 3.3. 特徵提取與分類 目標

opencv學習筆記二十九:SIFT特徵檢測匹配

SIFT(Scale-invariant feature transform)是一種檢測區域性特徵的演算法,該演算法通過求一幅圖中的特徵點(interest points,or corner points)及其有關scale 和 orientation 的描述子得到特徵並進行

opencv學習筆記三十六:AKAZE特徵檢測匹配

KAZE是日語音譯過來的 , KAZE與SIFT、SURF最大的區別在於構造尺度空間,KAZE是利用非線性方式構造,得到的關鍵點也就更準確(尺度不變性 ); Hessian矩陣特徵點檢測 ,方向指定,基於一階微分影象(旋轉不變性 ) ; 描述子生成 ,歸一化處理(光照不變