You are on page 1of 43

XỬ LÝ ẢNH

Võ Tuấn Kiệt
Bộ môn Viễn thông (112B3)
Đại học Bách Khoa TpHCM
Email: kietvo@hcmut.edu.vn
Chương 6: Xử lý hình thái học
Lý thuyết tập hợp
Các phép toán hình thái học ảnh nhị
phân
Giãn nở
Xói mòn
Mở
Đóng
Các phép toán hình thái học ảnh xám

2
Lý thuyết tập hợp

3
4
5
( A) z  c c  a  z, for a  A

Bˆ   w w  b, for b  B

6
Thành phần cấu trúc (kernel)

7
Hit and Fit

8
Phép toán xói mòn

9
Ví dụ

10
Đặc tính phép toán xói mòn

11
Ví dụ
Vấn đề: đếm số đồng xu trong trường
hợp các đồng xu chạm vào nhau?
Giải pháp:

12
Phép toán giãn nở

13
14
15
Ví dụ

16
Đặc tính phép toán giãn nở

17
18
Ví dụ
Vấn đề: phát hiện đường biên?
Giải pháp:

19
Tính đối ngẫu giữa xói mòn và
giãn nở

20
Phép toán mở

21
Ví dụ

22
Phép toán đóng

23
Ví dụ

24
Tính đối ngẫu của mở và đóng

25
Ví dụ

26
Hit-or-miss Transformation

27
28
29
Boundary Extraction
Boundary of a set A
∗ Denoted by β(A)
∗ Extracted by eroding A by a suitable
\[\ o min us ] /

se B and computing set difference


between A and its erosion

30
Boundary Extraction (example)

31
Ví dụ

32
Hole Filling
Hole (region) filling: A hole may be defined as a
background region surrounded by a connected border of
foreground pixels.

Let A denote a set whose elements are 8-connected


boundaries, each boundary enclosing a background region
(i.e., a hole). Given a point in each hole, the objective is to fill
all the holes with 1s.

1. Forming an array X0 of 0s (the same size as the array


containing A), except the locations in X0 corresponding to
the given point in each hole, which we set to 1.

2. Xk = (Xk-1 + B) Ac k =1,2,3,…

Stop the iteration if Xk = Xk-1

33
Ví dụ Hole Filling
 

Khởi tạo với kích thước bằng A, tất cả


phần tử đều là zero ngoại trừ một điểm
trong boundary
X k  ( X k 1  B )  Ac k  1,2,3,...
X k  ( X k 1  B )  Ac k  1,2,3,...
Extraction of Connected
Components
Extraction of connected components:
Central to many automated image
analysis applications.
Convex Hull
Convex Hull
- A set A is said to be convex if the straight line segment joining any two
points in A lies entirely within A.

- The convex hull H or of an arbitrary set S is the smallest convex set


containing S.

- Set difference H − S is called the convex deficiency of S


Convex Hull Algorithm
Let B i , i  1, 2, 3, 4, represent the four structuring elements.
The procedure consists of implementing the equation:
X ki  ( X k 1 # B i )  A
i  1, 2,3, 4 and k  1, 2,3,...
with X 0i  A.
When the procedure converges, or X ki  X ki 1 , let D i  X ki ,
the convex hull of A is
4
C ( A)   D i
i 1
Ôn tập
Các phép toán tập hợp?
Các thành phần cấu trúc (hình thái)
cơ bản?
Thực hiện các phép toán hình thái?
Đặc tính và ứng dụng của các phép
toán hình thái?

42
Matlab
im2bw, imcomplement
strel
imerode, imdilate, imopen, imclose

43

You might also like