Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
Computer Vision &
Pattern Recognition Lab.
Computer Vision & Pattern Recognition Lab.
제9장 영상 인식
Computer Vision & Pattern Recognition Lab. 2 /26 2014-02-13
영상 인식
Computer Vision & Pattern Recognition Lab. 3 /26 2014-02-13
영상 인식
일반적인 영상 인식은 매우 어려운 문제임
제한된 환경, 여러 가지 가정 하에서 수행
영상의 종류를 알 경우: 얼굴, 문자, 지문, 번호판, …
배경이 단순하다고 가정
실내와 같이 제한된 환경일 경우
객체의 texture가 단순하다고 가정
물체의 겹침이 없다고 가정
Computer Vision & Pattern Recognition Lab. 4 /26 2014-02-13
Image high-level
processing
Low-level
processing
Intermediate-level
processing
영상 인식의 과정
Low-level processing: 전처리 (eg: Contrast 개선, 잡음제거)
Intermediate-level processing: 영상분할, 특징 추출
High-level processing: 영상 인식 (eg: 얼굴인식, 문자인식)
전처리 --> 영상분할 --> 특징추출 --> 인식
인식
Computer Vision & Pattern Recognition Lab. 5 /26 2014-02-13
[1] 영상 분할 (Image Segmentation)
목표: 영상에 존재하는 서로 다른 영역들을 구분
(예: 영역별로 서로 다른 번호가 할당됨)
수행방법: 이진화 + Connected Component Labeling
Computer Vision & Pattern Recognition Lab. 6 /26 2014-02-13
영상 분할을 위한 이진화(Thresholding)
물체와 배경을 분리
이진화(Thresholding)
Computer Vision & Pattern Recognition Lab. 7 /26 2014-02-13
T=165
최적의 Threshold 값의 결정 방법
Computer Vision & Pattern Recognition Lab. 8 /26 2014-02-13
(1) Global thresholding ( Manual thresholding )
-. 주어진 threshold 값을 영상 전체에 적용
-. 환경의 제어가 용이한 경우에 가능 (예: industrial inspection)
(2) P-tile thresholding
-. 밝기값 0부터의 히스토그램 값을 더한 것이 전체 화소의 P% 가
되는 지점을 계산
-. Find T such that
NxNy * =
-. 전체 영상에서 물체가 차지하는 면적이 일정한 경우 (예: 지문 인식)
T
0i
H(i)100
P
Computer Vision & Pattern Recognition Lab. 9 /26 2014-02-13
(3) Otsu ( Minimum within-group variance )
가정 :
- 물체와 배경이 Bimodal 히스토그램
- 하나의 물체는 밝기값이 거의 같음
(즉, 밝기값의 variance가 작음. 무늬가 없음)
t
Computer Vision & Pattern Recognition Lab. 10 /26 2014-02-13
(1) 영상의 히스토그램 H(i)를 계산 함.
2(t) = H(i)
i =t+1
i H(i)
i = t+1
I
I
t
1(t) =
i H(i)
i =0
H(i) i =0
t
t
(2) t = 0 부터 255까지 모든 t 값에 대해서
(2.1) 왼쪽과 오른쪽의 평균을 각각 계산함.
(2.2) 왼쪽 분산값과 오른쪽 분산값의 합을 계산함.
(3) 값이 최소가 되는 t 값을 구함. 2(t)
[ i – 2(t) ]2 · H(i)
i=t+1
I
H(i) i =0
t 2(t) = i =0
t
[ i – 1(t) ]2 · H(i)
H(i) i =t+1
I +
Otsu 방법의 알고리즘
Computer Vision & Pattern Recognition Lab. 11 /26 2014-02-13
• 조명에 관계없이 배경과 물체를 정확히 분리
Computer Vision & Pattern Recognition Lab. 12 /26 2014-02-13
목표: 주어진 이진 영상에 대해서, 연결된 영역들에 서로 다른 숫자를 할당함. (연결성의 판별: 4-connected, 8-connected)
Algorithm (4-connected의 경우)
1) Scan the image left to right, top to bottom
2) For each non-zero pixel, look at top and left
If they are zero, assign a new label to the current pixel
If one of them is non-zero, assign that label
If both are non-zero, assign any label and
write down the equivalence
3) Relabel using equivalence.
Connected component labeling
Computer Vision & Pattern Recognition Lab. 13 /26 2014-02-13
0 0 0 0 0 0 0 0
0 0 1 1 0 2 2 0
0 1 1 1 0 2 2 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 1 1 0 2 2 0
0 3 1 1 0 2 2 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 1 1 0 1 1 0
0 1 1 1 0 1 1 0
0 0 0 0 0 0 0 0
3 = 1
Labeling의 과정
Computer Vision & Pattern Recognition Lab. 14 /26 2014-02-13
Segmentation 의 결과
Computer Vision & Pattern Recognition Lab. 15 /26 2014-02-13
[2] 특징 추출 (Feature Extraction)
목표: 분할된 각 영역에 대한 특징값들을 정량적으로 추출
결과: 각 영역별로 특징값이 벡터의 형태로 표현됨
Issues:
어떠한 특징값(면적, 둘레, 평균밝기, 등)을 사용할 것인가?
특징값의 T, R, S invariance
Computer Vision & Pattern Recognition Lab. 16 /26 2014-02-13
(1) Boundary-based features
-. Boundary length = Number of pixels at bndry
-. Diameter = Max [ D(Pi, Pj) ], Pi, Pj : boundary pixels
-. Major axis = line segment joining 2 pts farthest from each other
-. Minor axis = perpendicular to major axis
-. Eccentricity = Major axis 길이 / Minor axis 길이
Computer Vision & Pattern Recognition Lab. 17 /26 2014-02-13
(2) Region-based features
-. Area = f(x,y), f(x,y) is binary image
-. Compactness = Perimeter2 / Area (T, R, S, invariant)
-. Mean gray level
-. Min. gray level
-. Max. gray level
-. Number of pixels above mean
-. Variance of gray level
-. Elongation
Computer Vision & Pattern Recognition Lab. 18 /26 2014-02-13
(3) Moment-based features
Moment of order (p+g): mpq = f(x,y) xp yq
Central moment: pq = f(x,y) (x-x)p (y-y)q,
x = m10 / m00 ,
y = m01/ m00
* Central moment is translation invariant!
-. Area = m00
-. Centroid : x = m10 / m00 , y = m01 / m00
-. Orientation : = tan-1 [ 211 / (20 – 02 ) ] 1
2
Computer Vision & Pattern Recognition Lab. 19 /26 2014-02-13
-. Bounding rectangle
l = max – min , = x cos + y sin ( : orientation)
w = max – min , = -x sin + y cos boundary(x,y)
-. Best fit ellipse
a = , b=
Imax = [ ( x- x ) cos + ( y- y ) sin ]2
Imin = [ - ( x- x ) sin + ( y- y ) cos ]2
-. Eccentricity =
m00
( 20 - 02)2 +4 11
4
Imin
Imax3
4
Imax
Imin3
1/4 1/8 1/4 1/8
Computer Vision & Pattern Recognition Lab. 20 /26 2014-02-13
Normalized Central moment :
pq = pq / r00 , r = (p+q)/2 +1, p+q = 2,3, ...
* Normalized central moment is Translation, Scaling invariant !
Invariant moments : Moments which are invariant to T, R, S
==> Useful features for object recognition
(1) 1 = 20 + 02
(2) 2 = ( 20 - 02)2 + 4 2
11
(3) 3 = ( 30 - 312)2 + ( 321 - 03)
2
(4) 4 = ( 30 + 12)2 + ( 21 + 03)
2
(5) 5 = ( 30 - 312) ( 30 + 12)[ ( 30 + 12)2 - 3( 21 + 03)
2] +
( 321 - 03) ( 21 + 03)[3( 30 + 12)2 - ( 21 + 03)
2 ]
(6) 6 = ( 20 - 02)[( 30 + 12)2 - ( 21 + 03)
2] + 411( 30 + 12) ( 21 + 03)
(7) 7 = ( 321 - 30) ( 30 + 12)[( 30 + 12)2 - 3( 21 + 03)
2 ] +
( 312 - 30) ( 21 + 03)[( 30 + 12)2 - ( 21 + 03)
2 ]
Computer Vision & Pattern Recognition Lab. 21 /26 2014-02-13
[3] 인식 (Recognition)
목표: 영역별 특징값 벡터로부터 각 영역을 인식
1. Pattern classification (분류):
Assignment of objects into one of several pre-specified
categories(classes, 예: 볼트, 너트, 못, 망치)
2. Scene understanding (이해):
classification + analysis of relations between objects
==> Solutions are highly problem dependent
Computer Vision & Pattern Recognition Lab. 22 /26 2014-02-13
Classification 문제로 국한한 컴퓨터의 인식 방법
Training 과정 + Classification 과정
인식의 과정
(1) Training
- 반복적인 학습에 의한 유아의 인지 과정을 모방
- 주어지는 샘플들의 특징 정보를 축적, 기억
- 축적된 training 샘플들의 정보로부터 Classifier를 설계
(2) Classification
- 반복적인 학습에 의해 인지 능력이 확보된 후
- 설계된 Classifier를 이용하여 unknown input을 분류
Computers should learn (imitate) from human !!!
Computer Vision & Pattern Recognition Lab. 23 /26 2014-02-13
0
50
100
150
200
250
300
0 50 100 150 200 250
X 2
X 1
- 4 종류의 물체가 존재 : w1, w2, w3 , w4
- 분류를 위하여 2 가지의 정보를 추출
X1 : average gray level
X2 : boundary length
- 2차원 특징 벡터 X = [x1, x2]
인식 문제의 예
Computer Vision & Pattern Recognition Lab. 24 /26 2014-02-13
인식(Classification) 문제에서 해결해야할 Issue 들:
-. What kind of features? ==> Problem dependent
(예: 사과와 배는 색상으로는 구별 가능하지만
면적으로는 구별하기 어려움.)
-. How to partition the feature space into regions (one
region for each class) to minimize classification error
Computer Vision & Pattern Recognition Lab. 25 /26 2014-02-13
[1] Minimum distance classifier
(1) Classifier design (Training)
각각의 class j에 대해서, 그 class에 속한 training sample 들의 특징 벡터(X)의 평균을 계산
mj = X / Nj j=1,...,M mj : 평균 벡터
Nj : class j 에 속한 샘플의 수
j : j-th class
M : class 의 수
x j
(2) Classification
미지의 sample X에 대해서,
1) 각 Class 평균까지의 거리를 계산
dj(X) = | X - mj | j=1,..,M
2) di(X) 가 최소인 class i 로 분류
Classification 알고리즘
Computer Vision & Pattern Recognition Lab. 26 /26 2014-02-13
[2] K-NN (K Nearest Neighbor) classifier
1. 미지의 샘플과 모든 training 샘플과의 특징 벡터의 거리를 계산
2. 가장 가까운 K 개 샘플들의 label 중에서 다수의 label 로 분류
Example:
| | | | | | | | | | | |
| | | | | |
Computer Vision & Pattern Recognition Lab. 27 /26 2014-02-13
Clustering (군집화)
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
군집화의 특성
주관성: 군집화 결과의 품질은 응용이 처한 상황과 요구 사항에 따라 다름
Clustering (군집화)
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
순차 알고리즘
특성 군집 개수를 찾아준다. (대신 임계값을 설정해주어야 한다.)
순서에 민감하다. 빠르다 (선형 시간).
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
k-means 알고리즘
특성 가장 널리 쓰인다. (직관적 이해. 구현 간편)
군집 개수를 설정해주어야 한다.
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
7개 샘플을 k=3개의 군집으로 만드는 예제
초기화에 의해
(그림 (a)),
라인 5에 의해
(그림 (b)),
k-means 알고리즘
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
두 번째 루프를 실행하면
(그림 (c)),
세 번째 루프는 그 이전과 결과가 같다. 따라서 멈춘다.
결국 출력은
k-means 알고리즘
패턴인식(교보문고), 전북대학교 오일석 교수님
2014-02-13
항상 지역 최적점으로 수렴한다. (전역 최적점 보장
못함)
초기 군집 중심에 민감
빠르다.
outlier에 민감하다.
(진파랑은 k-medoids, 연파랑은 k-means)
k-means 알고리즘
패턴인식(교보문고), 전북대학교 오일석 교수님