Computer vision - Edge Detecting

DYN.kim·2024년 9월 21일

computer vision

목록 보기
2/6

edge란 이미지에서 물체의 경계를 나타낸다. 보통 matching이나 recognition에 사용된다.

급격한 intensity의 불연속성이 나타나면 이를 edge라고 할 수 있다.

edge detection을 위해서는 derivative를 사용한다. 불연속성이 생기면 미분값이 커지는 것을 활용한다.

위의 edge detection operator는 x+h에서의 weight는 1, x에서의 weight는 -1이므로 다음과 같게 된다.

central differance를 사용하면 아래와 같이 나타낼 수 있다.

h = 2인 discrete한 signal에서는 다음과 같이 바꿀 수 있으며 이떄 derivative filter은 다음과 같다.

Sobel filter

sobel filter는 smoothing filter와 derivative filter를 연속적으로 적용한 것과 같은 형태를 띈다. smoothing filter를 통해 노이즈를 줄여 안정적으로 edge를 검출할 수 있게 된다.

horiziontal sobel filter

vertical sobel filter

image gradient 계산

x에 대한 derivative와 y에 대한 derivative 계산

위에서 계산한 derivative를 통해 방향과 크기등을 계산

edge detection에서 gaussian filter를 통해 blur를 먼저 진행하는 이유는 noise를 줄이기 위해서이다.

derivative filter만 적용할 경우

gaussian filter를 적용할 경우

Laplace Filter

laplace filter는 2차 미분개념을 적용하여 더 정확한 edge detection을 위한 필터이다.

x와 y에 대해 이차 미분

laplacian filter의 형태는 다음과 같다.

그래프상으로 보면 zero crossing이 발생하는 부분이 edge라고 할 수 있다.

laplacian filter vs derivative filter

canny edge detection

canny edge detection은 총 4단계로 나뉜다.
1. image의 gaussian derivative를 계산
2. derivative를 이용하여 magnitude와 direction 계산
3. non maximum suppression을 통해 thin한 edge계산
4. Linking and thresholding

자세히 설명하면 1, 2과정은 위에서 다 설명했으니 넘어가고 non maximum suppression이란 계산한 direction을 통해 neighborhood를 찾아 크기를 비교하여 가장 큰 값을 가지는 부분만 edge로 선택하여 더 얇은 edge를 검출하는 방법이다. 이 과정에서 neighborhood가 존재하지 않을 경우 interpolating을 통해 neighborhood를 결정한다.

thesholding이란 두 개의 임계값 T, t를 정하여 3개의 case로 나누어 강한 edge만 남겨 noise를 줄이는 과정이다.
1. R > T: strong edge
2. t < R < T: weak edge
3. R < t: no edge

connecting이란 case를 나눈 후 strong edge는 edge로 weak edge 중 strong edge와 연결되어 있으면 edge로 하여 연결하는 방법이다.

canny edge detector에서도 gaussian blur를 사용하기 때문에 가우시안 분포의 분산과 두개의 임계값 T, t등이 파라미터라고 할 수 있겠다.

만일 분산이 커지면 더 넓은 범위의 edge를 구하는 거고 edge가 작으면 더 fine한 edge를 검출할 수 있게 된다.

profile
AI 개발자를 목표로 하고 있는 꿈 많은 공대생입니다. a deo vocatus rite paratus

0개의 댓글