D10K-6C01 Pengolahan Citra PCD-05 Algoritma Pengolahan Citra 2 Area Process Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran Semester Genap 2015-2016
Algoritma Pengolahan Citra 2 Operasi berbasis area (Area Process) Deskripsi Area Process A category of image-processing techniques that calculate the value of each output-image pixel from the corresponding input-image pixel and its neighbours. Examples include halftoning, sharpening and median filtering. Point Process vs Area Process Point processes: operate on a pixel based solely on that pixel’s value. Area processes: use the input pixel as well as the pixels around it to generate a new pixel. Point processes are easily implemented as “look -up tables”.
Limitations of Point Operations They don’t know where they are in an image They don’t know anything about their neighbors Most image features (edges, textures, etc) involve a spatial neighborhood of pixels If we want to enhance or manipulate these features, we need to go beyond point operations
What Point Operations Can’t Do Blurring/smoothing Sharpening
Pixel Neigborhood Any pixel p(x, y) has two vertical and two horizontal neighbors, given by This set of pixels are called the 4-neighbors of P, and is denoted by N4(P). Each of them are at a unit distance from P.
Pixel Neigborhood The four diagonal neighbors of p(x,y) are given by, This set is denoted by ND(P). Each of them are at Euclidean distance of 1.414 from P.
Pixel Neigborhood The points ND(P) and N4(P) are together known as 8-neighbors of the point P, denoted by N8 (P). Some of the points in the N4, ND and N8 may fall outside image when P lies on the border of image.
Terminologi Lainnya Pixel Adjacency Pixel Connectivity Path Connected Components Regions Boundaries Distances (Jarak)
Konvolusi
Konvolusi Image 1 6 3 2 9 11 10 5 7 8 4 1/9 New value: 5 7 8 4 1/9 Filter/mask/ operator New value: 6/9 + 9/9 + 7/9 + 0/9 + 2/9 + 8/9 + 2/9 + 9/9 + 10/9 = 5.889 Image 03
Konvolusi 1 6 3 2 9 11 10 5 7 8 4 1/9 5 Filtered Image: Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 1/9 5 value = 1x1/9 + 6x1/9 + 3x1/9 + 2x1/9 + 11x1/9 + 3x1/9 + 5x1/9 + 10x1/9 + 6x1/9 = 47/9 = 5.222 03
Konvolusi 1 6 3 2 9 11 10 5 7 8 4 1/9 5 7 Filtered Image: Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 1/9 5 7 value = 6x1/9 + 3x1/9 + 2x1/9 + 11x1/9 + 3x1/9 + 10x1/9 + 10x1/9 + 6x1/9 + 9x1/9 = 60/9 = 6.667 03
Konvolusi 1 6 3 2 9 11 10 5 7 8 4 5 7 5 5 6 5 4 5 6 Filtered Image: Original Image: Filtered Image: 1 6 3 2 9 11 10 5 7 8 4 5 7 5 5 6 5 4 5 6 03
PROBLEM PADA KONVOLUSI (BOUNDARY PROBLEM) Bagaimana untuk menentukan piksel-piksel yang berada pada batas citra Solusi: Zero padding Treat the empty cells in the convolution window as zero Fit-Position Start convolving at the first position where the window doesn’t overlap the image Enlarging Enlarging the original image before convolving by duplicating the edges Wrapping Wrap the image.
Penanganan Boundary Pixels
Spatial Filtering The word “filtering” has been borrowed from the frequency domain. Filters are classified as: Low-pass (i.e., preserve low frequencies) High-pass (i.e., preserve high frequencies) Band-pass (i.e., preserve frequencies within a band) Band-reject (i.e., reject frequencies within a band)
Spatial Filtering Linier Spatial FIltering Teknik Dengan mask (konvolusi) Tanpa mask Kombinasi: Filer morfologis Mask/Operator/Subwindows Matriks berukuran kecil, pada umumnya bujursangkar dan berordo ganjil Digunakan dalam proses konvolusi
Ilustrasi Output Image w(i,j) f(i,j)
Efek-efek Spatial Filtering Smoothing/Blurring Low-pass (i.e., preserve low frequencies) Sharpening High-pass (i.e., preserve high frequencies) Edge Detection Emboss
Filter Low Pass
Smoothing original 3x3 9x9 15x15
Smoothing dg Gaussian Mask The weights are samples of the Gaussian function σ = 1.4 mask size is a function of σ :
CONVOLUTION MASKS LAIN Embossing Blurring Sharpening W=9a-1
HIGH PASS FILTERING Tujuan Lawan dari Low Pass Filtering Mempertajam tepi citra Lawan dari Low Pass Filtering Nama lain : edge sharpening Pengolahan Citra Dijital
HIGH PASS FILTERING Syarat Contoh Elemen filter boleh positif, negatif atau nol Jumlah semua elemen pada filter adalah 0 atau 1 Contoh Pengolahan Citra Dijital
Sharpening Filters (High Pass filtering) Useful for emphasizing transitions in image intensity (e.g., edges).
Sharpening Filters (cont’d) Note that the response of high-pass filtering might be negative. Values must be re-mapped to [0, 255] sharpened images original image
Sharpening Filters: Unsharp Masking Obtain a sharp image by subtracting a lowpass filtered (i.e., smoothed) image from the original image: - =
Sharpening Filters: High Boost Image sharpening emphasizes edges but details (i.e., low frequency components) might be lost. High boost filter: amplify input image, then subtract a lowpass image. (A-1) + =
Sharpening Filters: High Boost (cont’d) If A=1, we get a high pass filter If A>1, part of the original image is added back to the high pass filtered image.
Sharpening Filters: High Boost (cont’d)
Sharpening Filters: Derivatives Taking the derivative of an image results in sharpening the image. The derivative of an image can be computed using the gradient.
Sharpening Filters: Derivatives (cont’d) The gradient is a vector which has magnitude and direction: or (approximation)
Sharpening Filters: Derivatives (cont’d) Magnitude: provides information about edge strength. Direction: perpendicular to the direction of the edge.
Sharpening Filters: Gradient Computation Approximate gradient using finite differences: sensitive to vertical edges Δx sensitive to horizontal edges
Sharpening Filters: Gradient Computation (cont’d)
Example
Sharpening Filters: Gradient Computation (cont’d) We can implement and using masks: (x+1/2,y) good approximation at (x+1/2,y) (x,y+1/2) * * good approximation at (x,y+1/2) Example: approximate gradient at z5
Sharpening Filters: Gradient Computation (cont’d) A different approximation of the gradient: good approximation (x+1/2,y+1/2) * We can implement and using the following masks:
Sharpening Filters: Gradient Computation (cont’d) Example: approximate gradient at z5 Other approximations Sobel
Example
Sharpening Filters: Laplacian The Laplacian (2nd derivative) is defined as: (dot product) Approximate derivatives:
Sharpening Filters: Laplacian (cont’d) Laplacian Mask detect zero-crossings
Sharpening Filters: Laplacian (cont’d) Sobel Laplacian
Filtering Median Filtering Averaging Filter Minimum/Maksimum Filter Menghilangkan impulse noise (bedakan dengan Gaussian Noise yang dapat dihilangkan dengan Low-pass filter) Impulse noise has a number of pixels that have conspicuosly wrong intensities like 0 or 255 Averaging Filter Mengganti nilai piksel fokus dengan rata-rata jumlah piksel dalam window Minimum/Maksimum Filter Mengganti nilai piksel fokus dengan nilai piksel minimum/maksimum piksel sekitar
Median Filter
Ilustrasi Median Filer 3x3 median 7x7 median
Filter Morfologis Kasus Khusus Filtering Dua operasi dasar: erosi : menipiskan Dilasi : menebalkan Operasi gabungan: opening : an erosion followed by a dilation closing: a dilation followed by an erosion Menggunakan mask/operator yang disebut structuring element Jenis Structuring element: Block, Plus, Cross, Ring, Square Definisi:
Jenis-jenis Structuring Element Box Plus Cross Dot Square Custom
Erosi Erosi
Dilasi Dilasi
Ilustrasi Erosi Dilasi
Ilustrasi Erosi Dilasi
Skeletonization one-pixel thick, through the "middle" of the object, and, preserves the topology of the object.
Hole Filing
BLOB separation
Hole Removal
MATLAB
Examples: Deblurring
Examples: Image Enhancement
Examples: Image Registration
Examples: Image Segmentation
Examples: Spatial Transformation
Examples: Measuring Image Features