티스토리 뷰
[CS5670] Lecture 4: Local features & Harris corner detection
미남잉 2022. 5. 23. 23:35| Today's topic is Features extraction - Corners and blobs.
| Key points
- feature extraction
- local feature
- Harris corner detection
Motivation: Automatic panoramas
The human visual system has a field of view of around 135 x 200 degrees, but a typical camera has a field of view of only 35 x 50 degrees. Panoramic image mosaicing works by taking lots of pictures from an ordinary camera, and stitching them together to form a composite image with a much larger field of view.
reference: AutoStitch

Process



Why extract features?
- Motivation: panorama stitching
- We have two images how do we combine them?

- Step 1: extract features
- Step 2: match features

- Step 1: extract features
- Step 2: match features
- Step 3: align images

Application: Visual SLAM
Simultaneous Localization and Mapping

Image matching


Harder case

Maybe it's because these two photos are from different angles.
Harder still?


Answer below (look for tiny colored squares…)


NASA Mars Rover images with SIFT feature matches.
Feature matching for object search

Feature matching

Invariant local features
- Find features that are invariant to transformations
- geometric invariance: translation, rotation, scale
- photometric invariance: brightness, exposure, …

Advantages of local features
Locality
- features are local, so robust to occlusion and clutter
Quantity
- hundreds or thousands in a single image
Distinctiveness
- can differentiate a large database of objects
Efficiency
- real time performance achievable
More motivation…

Feature points are used for:
- Image alignment (e.g., mosaics)
- 3D reconstruction
- Motion tracking (e.g. for AR)
- Object recognition
- Image retrieval
- Robot/car navigation
- –… other
Approach
- Feature detection: find it
- Feature descriptor: represent it
- Feature matching: match it
Feature tracking: track it, when motion
Local features: main components

1) Detection: Identify the interest points

2) Descroption: Extract vector feature descriptor surrounding each interest point

3) Matching: Determine correspondence between descriptors in two views
What makes a good feature?
Want uniqueness
Look for image regions that are unusual
– Lead to unambiguous matches in other images
How to define “unusual”?
Local measures of uniqueness
- Suppose we only consider a small window of pixels
– What defines whether a feature is a good or bad candidate?

- How does the window change when you shift it?
- Shifting the window in any direction causes a big change

Harris corner detection: the math
Consider shifting the window W by (u,v)
- how do the pixels in W change?
- compare each pixel before and after by summing up the squared differences (SSD)
- this defines an SSD “error” E(u,v)

E(u,v)=Σ(x,y)∈W[I(x+u,y+v)−I(x,y)]2
- We are happy if this error is high
- Slow to compute exactly for each pixel and each offset (u,v)
Small motion assumption
Talor series expansion of l:
I(x+u,y+v)=I(x,y)+∂I∂xu+∂I∂yv + higher order terms
If the motion (u,v) is small, then first order approximation is good
I(x+u,y+v)≈I(x,y)+∂I∂xu+∂I∂yv
≈I(x,y)+[Ix,Iy][00]
Shorthand: Ix=∂I∂x
Plugging this into the formula on the previous slide…
Corner detection: the math
Consider shifting the window W by (u,v)
- defines an SSD “error” E(u,v)
E(u,v)=Σ[I(x+u,y+v)−I(x,y)]2
≈Σ(x,y)∈W[I(x,y)+Ixu+Iyv−I(x,y)]2
≈Σ(x,y)∈W[Ixu+Iyv]2
≈Au2+2Buv+Cv2

Thus, E(u,v) is locally approximated as a quadratic error function.
The second moment matrix
The surface E(u,v) is locally approximated by a quadratic form.
E(u,v)≈Au2+2Buv+Cv2
≈[uv][ABBC][uv]
H=[ABBC]




General case
We can visualize H as an ellipse with axis lengths determined by the eigenvalues of H and orientation
determined by the eigenvectors of H
Ellipse equation:
≈[uv]H[uv]=const

Quick eigenvalue/eigenvector review
The eigenvectors of a matrix A are the vectors x that satisfy:
Ax=λx
The scalar λ is the eigenvalue corresponding to x
– The eigenvalues are found by solving:
det(A−λI)=0
– In our case, A=H is a 2x2 matrix, so we have

– The solution:
λ±=12[(h11+h22)±√4h12h21+(h11−h22)2]
Once you know λ, you find x by solving
[h11−λh12h21h22−λ][xy]
Corner detection: the math

E(u,v)≈[uv][ABBC][uv]
- Hxmax=λmaxxmax
- Hxmin=λminxmin
Eigenvalues and eigenvectors of H
- Define shift directions with the smallest and largest change in error
- xmax = direction of largest increase in E
- λmax = amount of increase in direction xmax
- xmin = direction of smallest increase in E
- λmin = amount of increase in direction xmin
How are λmax, xmax, λmin and xmin
- What’s our feature scoring function?
Want E(u,v) to be large for small shifts in all directions.
- the minimum of E(u,v) should be large, over all unit vectors [uv]
- this minimum is given by the smaller eigenvalue λmin of H

Interpreting the eigenvalues
Classification of image points using eigenvalues of M

Corner detection summary

Here’s what you do:
- Compute the gradient at each point in the image
- For each pixel:
- Create the H matrix from nearby gradient values
- Compute the eigenvalues.
- Find points with large response (λmin > threshold)
- Choose those points where λmin is a local maximum as features
Find points with large response (λmin > threshold)

The Harris operator
λmin is a variant of the "Harris operator" for feature detection
f=λ1λ2λ1λ2
=determinant(H)trace(H)
- The trace is the sum of the diagonals, i.e., trace(H)=h11+h22
- Very similar to λmin but less expensive (no square root)
- Called the Harris Corner Detector or Harris Operator
- Lots of other detectors, this is one of the most popular
Alternate Harris operator
For Project 2, you will use an alternate definition of the Harris operator:
R=λ1λ2−k⋅(λ1+λ2)2=det(M)−k⋅tr(M)2
The Harris operator

Harris detector example

f value (red high, blue low)

Threshold (f > value)

Find local maxima of f (non-max suppression)

Harris features (in red)

Weighting the derivatives
In practice, using a simple window W doesn’t work too well

Instead, we’ll weight each derivative value based on its distance from the center pixel

Harris Detector
Second moment matrix

1. Image derivatives

μ(σI,σD=g(σI)⋇[I2x(σD)IxIy(σD)IxIy(σD)I2y(σD)]
2. Square of derivatives

detM=λ1λ2
traceM=λ1+λ2
3. Gaussian filter g(sI)

4. Cornerness function – both eigenvalues are strong

5. Non-maxima suppression
Harris Corners – Why so complicated?

Can’t we just check for regions with lots of gradients in the x and y directions?
– No! A diagonal line would satisfy that criteria
Reference: Lecture 4: Local features & Harris corner detection
'AI > Computer Vision' 카테고리의 다른 글
[CS5670] Lecture 5: Feature Invariance (0) | 2022.06.23 |
---|---|
Aliasing(엘리어싱) - 발생 이유, 결과, 방지 방법 (0) | 2022.06.01 |
[CS5670] Lecture 3: Image Resampling & Interpolation (0) | 2022.05.23 |
[CS5670] Lecture 2: Edge detection (0) | 2022.05.19 |
[CS5670] Lecture 1: Images and image filtering (0) | 2022.05.19 |
- Total
- Today
- Yesterday
- 퓨샷러닝
- clip
- 서버구글드라이브연동
- stylegan
- CNN
- 파이썬 딕셔너리
- style transfer
- few-shot learning
- python
- 딥러닝
- 구글드라이브다운
- 도커 컨테이너
- 파이썬 클래스 계층 구조
- 서버에다운
- 도커
- 프롬프트
- support set
- 파이썬 클래스 다형성
- 구글드라이브서버다운
- 파이썬
- NLP
- Prompt
- cs231n
- prompt learning
- vscode 자동 저장
- docker
- 구글드라이브서버연동
- 구글드라이브연동
- Unsupervised learning
- 데이터셋다운로드
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |