0% found this document useful (0 votes)
19 views14 pages

Week5 - Filter Design

The document discusses convolution and correlation in image processing. It defines convolution and correlation mathematically. It also discusses properties like filtering and how convolution and correlation are used to process images by applying kernels or filters.

Uploaded by

Peswoc Peswoc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views14 pages

Week5 - Filter Design

The document discusses convolution and correlation in image processing. It defines convolution and correlation mathematically. It also discusses properties like filtering and how convolution and correlation are used to process images by applying kernels or filters.

Uploaded by

Peswoc Peswoc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

28/02/2023

Image Processing
INT3404 1/ INT3404E 21
Giảng viên: TS. Nguyễn Thị Ngọc Diệp
Email: [email protected]

Schedule
Tuần Nội dung Yêu cầu đối với sinh viên (ngoài việc đọc tài liệu tham khảo)
1
Giới thiệu môn học Cài đặt môi trường: Python 3, OpenCV 3, Numpy, Jupyter Notebook

2 Ảnh số (Digital image) – Phép toán điểm (Point operations)


Làm quen với OpenCV + Python
3 Làm bài tập 1: điều chỉnh gamma tìm contrast hợp lý
Điều chỉnh độ tương phản (Contrast adjust)– Ghép ảnh (Combining images)
4 Histogram - Histogram equalization Thực hành ở nhà
5 Phép lọc trong không gian điểm ảnh (linear processing filtering) Thực hành ở nhà
6 Phép lọc trong không gian điểm ảnh cont. (linear processing filtering)
Bài tập mid-term
Thực hành: Ứng dụng của histogram; Tìm ảnh mẫu (Template matching)
7 Trích rút đặc trưng của ảnh
Thực hành ở nhà
Cạnh (Edge) và đường (Line) và texture
8 Các phép biến đổi hình thái (Morphological operations) Làm bài tập 2: tìm barcode
9 Chuyển đổi không gian – Miền tần số – Phép lọc trên miền tần số
Đăng ký thực hiện đồ án môn học
Thông báo liên quan đồ án môn học
10 Xử lý ảnh màu (Color digital image) Làm bài tập 3: Chuyển đổi mô hình màu và thực hiện phân vùng
11 Thực hành ở nhà
Các phép biến đổi hình học (Geometric transformations)
12 Nhiễu – Mô hình nhiễu – Khôi phục ảnh (Noise and restoration) Thực hành ở nhà
13 Nén ảnh (Compression) Thực hành ở nhà
14 Hướng dẫn thực hiện đồ án môn học Trình bày đồ án môn học
15 Hướng dẫn thực hiện đồ án môn học
Trình bày đồ án môn học
Tổng kết cuối kỳ 2

1
28/02/2023

This week outline


1. Recall Spatial Filtering (Week 4)
2. Some properties of Convolution and correlation
3. Filter design
1. Non-DL
2. DL

Recall week 4: Spatial filtering


• Neighbors of a pixel
• Distance between two pixels
• Correlation

• Convolution

• Filter kernels

2
28/02/2023

Correlation and Convolution in 2D


158 Chapter 3 Intensity Transformations and Spatial Filtering

FIGURE 3.30 Padded f


Correlation 0 0 0 0 0 0 0
(middle row) and Origin f 0 0 0 0 0 0 0
convolution (last 0 0 0 0 0 0 0 0 0 0 0 0
row) of a 2-D 0 0 0 0 0 w 0 0 0 1 0 0 0
kernel with an 0 0 1 0 0 1 2 3 0 0 0 0 0 0 0
image consisting 0 0 0 0 0 4 5 6 0 0 0 0 0 0 0
of a discrete unit 0 0 0 0 0 7 8 9 0 0 0 0 0 0 0
impulse. The 0’s
(a) (b)
are shown in gray
to simplify visual
Initial position for w Correlation result Full correlation result
analysis. Note that
correlation and 1 2 3 0 0 0 0 0 0 0 0 0 0 0
convolution are 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
functions of x and 7 8 9 0 0 0 0 0 9 8 7 0 0 0 9 8 7 0 0
y. As these 0 0 0 1 0 0 0 0 6 5 4 0 0 0 6 5 4 0 0
variable change, 0 0 0 0 0 0 0 0 3 2 1 0 0 0 3 2 1 0 0
they 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
displace one 0 0 0 0 0 0 0 0 0 0 0 0 0 0
function with (c) (d) (e)
respect to the
other. See the Rotated w Convolution result Full convolution result
discussion of Eqs. 9 8 7 0 0 0 0 0 0 0 0 0 0 0
(3-36) and (3-37) 6 5 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
regarding full 3 2 1 0 0 0 0 0 1 2 3 0 0 0 1 2 3 0 0
correlation and 0 0 0 1 0 0 0 0 4 5 6 0 0 0 4 5 6 0 0
convolution. 0 0 0 0 0 0 0 0 7 8 9 0 0 0 7 8 9 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
(f) (g) (h)
Source: Fig. 3.30, Gonzalez

For example, the unit impulse in Fig. 3.29(a) is given by d( x − 3) in the 1-D version of
5 Recall that A = 1 for a
unit impulse.
the preceding equation. Similarly, the impulse in Fig. 3.30(a) is given by d( x − 2, y − 2)
[remember, the origin is at (0, 0) ].
Summarizing the preceding discussion in equation form, the correlation of a
kernel w of size m × n with an image f ( x, y), denoted as (w ! f )( x, y), is given by
Eq. (3-31), which we repeat here for convenience:
a b
(w ! f )( x, y) = ∑ ∑ w(s, t ) f ( x + s, y + t )
s = −a t = −b
(3-34)

Because our kernels do not depend on ( x, y), we will sometimes make this fact explic-
it by writing the left side of the preceding equation as w ! f ( x, y). Equation (3-34) is

Padding evaluated for all values of the displacement variables x and y so that the center point
of w visits every pixel in f,† where we assume that f has been padded appropriately.


As we mentioned earlier, the minimum number of required padding elements for a 2-D correlation is (m − 1) 2
rows above and below f, and (n − 1) 2 columns on the left and right. With this padding, and assuming that f
is of size M × N , the values of x and y required to obtain a complete correlation are x = 0, 1, 2, … , M − 1 and
y = 0, 1, 2, … , N − 1. This assumes that the starting configuration is such that the center of the kernel coincides
with the origin of the image, which we have defined to be at the top, left (see Fig. 2.19).

DIP4E_GLOBAL_Print_Ready.indb 158 6/16/2017 2:03:40 PM

Image size: MxN


Kernel size: mxn
Output: (M + m – 1) x (N +n – 1) MxN (M-m+1) x (N – n + 1)

3
28/02/2023

Padding values at borders


• Pad a constant value (black)
• Wrap around (circulate the image)
• Copy edge (replicate the edges’ pixels)
• Reflect across edges (symmetric)

Filter kernels
• Smoothing/Noise reduction/Blurring
• Box filter
• Lowpass Gaussian filter
• Order-statistic (nonlinear) filter
• Max, min, median
• Other applications:
• Shading correction
• Unsharp masking

4
28/02/2023

Properties

Fundamental properties of convolution and


correlation

10

5
28/02/2023

Simpler convolution computation?

11

Separable filter kernels


• A 2-D function G(x, y) is separable if it can be written as the product
of two 1-D functions, G1(x, y) and G2(x, y)

𝐺 𝑥, 𝑦 = 𝐺! 𝑥, 𝑦 𝐺" (𝑥, 𝑦)
• Associative property of convolution

12

6
28/02/2023

Computational advantage

Input size: MxN


Kernel size: mxn

13

Week 5: Filter design

14

7
28/02/2023

15

Kernels with negative values?

16

8
28/02/2023

Edge detection

17

Filter learning
• With DL
• Automatic learning <-- With a lot of engineering skills
• Without DL
• With a lot of a priori knowledge

18

9
28/02/2023

Topic:
Edge-preserving smoothing filters

19

Kuwahara-type filter

Ref:
Burger, Wilhelm, and Mark J. Burge. "Edge-Preserving Smoothing
Filters." Digital Image Processing. Springer, London, 2016. 413-451.

20

10
28/02/2023

Kuwahara-type filter

21

Kuwahara-type filter

22

11
28/02/2023

Nagao-Matsuyama filter

23

Domain filter vs Range filter


• Domain filter: weights depend only on the distance in the spatial
domain
Cause some spatial effect upon the
image: blurring or sharpening

• Range filter: weights depend only upon the differences in pixel values
or range
Act as a point opration

24

12
28/02/2023

Bilateral filter
• Combining both domain filtering and range filtering

25

26

13
28/02/2023

[6] B. Ham, M. Cho, and J. Ponce, “Robust guided image filtering using nonconvex potentials,” IEEE Transactions on Pattern Analysis
and Machine Intelligence, 2017.

[7] L. Xu, C. Lu, Y. Xu, and J. Jia, “Image smoothing via l 0 gradient minimization,” in ACM Transactions on Graphics (TOG), vol. 30, no.
6. ACM, 2011, p. 174.

[8] D. Min, S. Choi, J. Lu, B. Ham, K. Sohn, and M. N. Do, “Fast global image smoothing based on weighted least squares,” IEEE
Transactions on Image Processing, vol. 23, no. 12, pp. 5638–5653, 2014.

[9] L. Bao, Y. Song, Q. Yang, H. Yuan, and G. Wang, “Tree filtering: Efficient structure-preserving smoothing with a minimum spanning
tree,” IEEE Transactions on Image Processing, vol. 23, no. 2, pp. 555–569, 2014.

[10] Q. Zhang, L. Xu, and J. Jia, “100+ times faster weighted median filter (wmf),” in Proceedings of the IEEE Conference on Computer
Vision and Pattern Recognition, 2014, pp. 2830–2837.

[11] S. Paris, S. W. Hasinoff, and J. Kautz, “Local laplacian filters: Edge- aware image processing with a laplacian pyramid.” ACM Trans.
Graph., vol. 30, no. 4, pp. 68–1, 2011.

[12] S. Bi, X. Han, and Y. Yu, “An l 1 image transform for edge-preserving smoothing and scene-level intrinsic decomposition,” ACM
Transactions on Graphics (TOG), vol. 34, no. 4, p. 78, 2015.

27

14

You might also like