(1) Image search : Search for ;
(2) jigsaw puzzle ;
(3) Image mosaic : Join two related graphs together ;
Image features refer to meaningful image areas , It's unique , Legibility , Like corners , Spots and high density areas .
Corner point : The most important feature is the corner ; The pixel corresponding to the maximum value of the gray gradient ; The intersection of two lines ; Extreme points ( The first derivative is the largest , The second derivative is 0)
The first rectangle represents a flat area , Moving in all directions , The pixel value in the window does not change ;
The second rectangle represents an edge feature (Edges), If you move vertically ( Gradient direction ), The pixel value will change ; If you move along the edge ( Parallel to the edge ) , Pixel values don't change ;
The third picture is a rectangle , It's a corner (Corners), No matter which direction you move it , Pixel values can change a lot .
This algorithm is not sensitive to the change of brightness and contrast .
Operators have rotation invariance .
Operators do not have scale invariance .
cornerHarris(src, blockSize, ksize, k, dst=None, borderType=None)
Src: Input the original image ;
Blocksize: Detect the size of the window
Ksize: volume Sobel Size of product kernel ;
K: Weight factor , Empirical value , Usually take 0.02-0.04 Between .
Dst: Output image
borderType:⽤ It is used to infer a certain boundary pattern of external pixels of an image , Have default values BORDER_DEFAULT.
import os
import cv2
# Read the picture
img=cv2.imread('images/HaLiSi.jpg')
# Zoom in and out
img=cv2.resize(src=img,dsize=(450,450))
# Go to grayscale
gray=cv2.cvtColor(src=img,code=cv2.COLOR_RGB2GRAY)
# Harris test
halisi=cv2.cornerHarris(src=gray,blockSize=2,ksize=3,k=0.03)
# Judge the corner “ quality ”
img[halisi>0.01*halisi.max()]=[0,255,0]
# Display images
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
if __name__ == '__main__':
print('Pycharm')