標籤:alt 介紹 color nump str free param 調整 key
因為當下的計劃是熟悉語言和庫,而映像特徵提取脫離理論就很沒意思了,並且很可能事倍功半,所以電腦視覺特徵提取這部分跳過,直接開始和深度學習結合較為緊密的目標檢測&識別部分。
本節介紹了OpenCV3中提取映像角點特徵的函數:
1 # coding=utf-8 2 import cv2 3 import numpy as np 4 5 6 ‘‘‘Harris演算法角點特徵提取‘‘‘ 7 8 img = cv2.imread(‘chess_board.png‘) 9 gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)10 gray = np.float32(gray)11 12 # {標記點大小,敏感度(3~31,越小越敏感)}13 # OpenCV函數cv2.cornerHarris() 有四個參數 其作用分別為 :14 #img - Input image, it should be grayscale and float32 type.15 #blockSize - It is the size of neighbourhood considered for corner detection16 #ksize - Aperture parameter of Sobel derivative used.17 #k - Harris detector free parameter in the equation,在0.04 到0.05之間18 dst = cv2.cornerHarris(gray,2,23,0.04)19 img[dst>0.01 * dst.max()] = [0,0,255]20 21 cv2.imshow(‘corners‘,img)22 cv2.waitKey()23 cv2.destroyAllWindows()
dst = cv2.cornerHarris(gray,2,23,0.04)中第3個參數(23)調整對結果影響如下:
取值為3時:
取值為23時:
『python』電腦視覺_OpenCV3角點特徵Harris提取方法