Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

Similar documents
Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

Digital Image Processing

Image Processing for feature extraction

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Image Enhancement using Histogram Equalization and Spatial Filtering

Filtering in the spatial domain (Spatial Filtering)

Image Filtering. Median Filtering

Non Linear Image Enhancement

An Adaptive Kernel-Growing Median Filter for High Noise Images. Jacob Laurel. Birmingham, AL, USA. Birmingham, AL, USA

Digital Image Processing. Lecture # 3 Image Enhancement

Preparing Remote Sensing Data for Natural Resources Mapping (image enhancement, rectifications )

A Spatial Mean and Median Filter For Noise Removal in Digital Images

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

Frequency Domain Enhancement

Image Enhancement in spatial domain. Digital Image Processing GW Chapter 3 from Section (pag 110) Part 2: Filtering in spatial domain

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

EE482: Digital Signal Processing Applications

Computer Vision, Lecture 3

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

Computing for Engineers in Python

Digital Image Processing. Lecture # 4 Image Enhancement (Histogram)

Computer Vision. Intensity transformations

Image filtering, image operations. Jana Kosecka

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Image preprocessing in spatial domain

Image Enhancement. DD2423 Image Analysis and Computer Vision. Computational Vision and Active Perception School of Computer Science and Communication

CSE 564: Scientific Visualization

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

VLSI Implementation of Impulse Noise Suppression in Images

An Efficient Noise Removing Technique Using Mdbut Filter in Images

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

Digital Image Processing

Filip Malmberg 1TD396 fall 2018 Today s lecture

Computer Vision for HCI. Noise Removal. Noise in Images

ELEC Dr Reji Mathew Electrical Engineering UNSW

>>> from numpy import random as r >>> I = r.rand(256,256);

Filtering Images in the Spatial Domain Chapter 3b G&W. Ross Whitaker (modified by Guido Gerig) School of Computing University of Utah

Reading Instructions Chapters for this lecture. Computer Assisted Image Analysis Lecture 2 Point Processing. Image Processing

TDI2131 Digital Image Processing

Image Denoising using Filters with Varying Window Sizes: A Study

Midterm Review. Image Processing CSE 166 Lecture 10

PERFORMANCE ANALYSIS OF LINEAR AND NON LINEAR FILTERS FOR IMAGE DE NOISING

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Image Denoising Using Statistical and Non Statistical Method

Impulse Noise Removal and Detail-Preservation in Images and Videos Using Improved Non-Linear Filters 1

Image Filtering Josef Pelikán & Alexander Wilkie CGG MFF UK Praha

Chapter 6. [6]Preprocessing

A Study On Preprocessing A Mammogram Image Using Adaptive Median Filter

Image Enhancement in Spatial Domain

Analysis of the SUSAN Structure-Preserving Noise-Reduction Algorithm

Image Processing by Bilateral Filtering Method

Noise and Restoration of Images

Digital Image Processing

Practical Image and Video Processing Using MATLAB

ECC419 IMAGE PROCESSING

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Chapter 3. Study and Analysis of Different Noise Reduction Filters

Weaving Density Evaluation with the Aid of Image Analysis

Image Processing COS 426

DIGITAL IMAGE PROCESSING (COM-3371) Week 2 - January 14, 2002

Images and Filters. EE/CSE 576 Linda Shapiro

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Image processing. Image formation. Brightness images. Pre-digitization image. Subhransu Maji. CMPSCI 670: Computer Vision. September 22, 2016

Very High Resolution Satellite Images Filtering

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

Direction based Fuzzy filtering for Color Image Denoising

Chapter 2 Image Enhancement in the Spatial Domain

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

Last Lecture. Lecture 2, Point Processing GW , & , Ida-Maria Which image is wich channel?

On the evaluation of edge preserving smoothing filter

COMPARITIVE STUDY OF IMAGE DENOISING ALGORITHMS IN MEDICAL AND SATELLITE IMAGES

Digital Image Fundamentals and Image Enhancement in the Spatial Domain

High density impulse denoising by a fuzzy filter Techniques:Survey

Postprocessing of nonuniform MRI

Performance Analysis of Average and Median Filters for De noising Of Digital Images.

A New Impulse Noise Detection and Filtering Algorithm

Mod. 2 p. 1. Prof. Dr. Christoph Kleinn Institut für Waldinventur und Waldwachstum Arbeitsbereich Fernerkundung und Waldinventur

CAP 5415 Computer Vision. Marshall Tappen Fall Lecture 1

1.Discuss the frequency domain techniques of image enhancement in detail.

DIGITAL IMAGE DE-NOISING FILTERS A COMPREHENSIVE STUDY

Frequency Domain Median-like Filter for Periodic and Quasi-Periodic Noise Removal

Prof. Feng Liu. Winter /10/2019

Sensors and Sensing Cameras and Camera Calibration

Historical Document Preservation using Image Processing Technique

>>> from numpy import random as r >>> I = r.rand(256,256);

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

TIRF, geometric operators

Chapter 3 Image Enhancement in the Spatial Domain. Chapter 3 Image Enhancement in the Spatial Domain

Digital Image Processing. Lecture 5 (Enhancement) Bu-Ali Sina University Computer Engineering Dep. Fall 2009

Fourier Transform. Any signal can be expressed as a linear combination of a bunch of sine gratings of different frequency Amplitude Phase

Simple Pixel Operations 4S1

Image Enhancement contd. An example of low pass filters is:

CoE4TN4 Image Processing. Chapter 4 Filtering in the Frequency Domain

Transcription:

CSc I6716 Spring 211 Introduction Part I Feature Extraction (1) Zhigang Zhu, City College of New York zhu@cs.ccny.cuny.edu Image Enhancement What are Image Features? Local, meaningful, detectable parts of the image. 1

More Color Woes Squares with dots in them are the same color Topics Image Enhancement Brightness mapping Contrast stretching/enhancement Contrast stretching/enhancement Histogram modification Noise Reduction... Mathematical Techniques Convolution Gaussian Filtering Edge and Line Detection and Extraction Region Segmentation Contour Extraction Corner Detection 2

Image Enhancement Goal: improve the visual quality of the image for human viewing for subsequent processing Two typical methods spatial domain techniques... operate directly on image pixels frequency domain techniques... operate on the Fourier transform of the image No general theory of visual quality General assumption: if it looks better, it is better Often not a good assumption Spatial Domain Methods T(I(x,y)) (( neighborhood N I(x,y) I (x,y) Transformation T point - pixel to pixel I (x,y) = T(I(x,y)) area - local area to pixel global - entire image to pixel O=T(I) Neighborhoods typically rectangular typically an odd size: 3x3, 5x5, etc centered on pixel I(x,y) Many IP algorithms rely on this basic notion 3

Point Transforms: General Idea O = T(I) Input pixel value, I, mapped to output pixel value, O, via transfer function T. 255 OU UTPUT Transfer Function T 255 INPUT Grayscale Transforms Photoshop adjust curve command Output gray value I (x,y) Input gray value I(x,y) 4

Point Transforms: Brightness 1 1 1.5.5.5.5 1 4.5 1 4 4.5 1 2 1 2 2.5 1 2.5 1 Point Transforms:Thresholding T is a point-to-point transformation only information at I(x,y) used to generate I (x,y) Thresholding 255 I (x,y) = I max if I(x,y) > t I min if I(x,y) t t 255 t=89 5

Point Transforms: Linear Stretch 255 OUTPUT INPUT 255 Linear Scaling Consider the case where the original image only utilizes a small subset of the full range of gray values: New image uses full range of gray values. What's F? {just the equation of the straight line} K I'(x,y) Input image I(x,y) Gray scale range: [I min, I max ] Output image I'(x,y) = F [ I(x,y)] Desired gray scale range: [, K] I min I(x,y) I max K 6

Linear Scaling F is the equation of the straight line going through the point (I min, ) and (I max, K) K I'(x,y) = I(x,y) - K Imin I max - I min I max - I min I' =mi+b useful when the image gray values do not fill the available range. Implement via lookup tables Scaling Discrete Images Have assumed a continuous grayscale. What happens in the case of a discrete grayscale with K levels? 7 6 5 Empty! y p 4 3 2 1? 1 2 3 4 5 6 7 Input Gray Level 7

Non-Linear Scaling: Power Law O = I γ γ < 1 to enhance contrast in dark regions γ > 1 to enhance contrast in bright regions. 1 γ<1.5 γ=1 γ>1.5 1 Square Root Transfer: γ=.5 1.5.5 1 8

γ=3. 1.5 4 35 3 25 2 15 1 5 5 1 15 2 25.5 1 4 35 3 25 2 15 1 5 5 1 15 2 25 Examples Technique can be applied to color images same curve to all color bands different curves to separate color bands: 9

Point Transforms:Thresholding T is a point-to-point transformation only information at I(x,y) used to generate I (x,y) Thresholding 255 I (x,y) = I max if I(x,y) > t I min if I(x,y) t t 255 t=89 Threshold Selection Arbitrary selection select visually Use image histogram Threshold 1

Histograms The image shows the spatial distribution of gray values. The image histogram discards the spatial information and shows the relative frequency of occurrence of the gray values. Image 3 3 2 5 5 1 1 3 4 5 2 2 2 4 4 4 3 3 4 4 5 5 3 4 5 5 6 6 7 6 6 6 6 5 Gray Value Count Rel. Freq. 2.5 1 2.5 2 4.11 3 6.17 4 7.2 5 8.22 6 6.17 7 1.3 Sum= 36 1. Image Histogram The histogram typically plots the absolute pixel count as a function of gray value: Pixel Count 8 7 6 5 4 3 2 1 1 2 3 4 5 6 7 Gray Value For an image with dimensions M by N I min H ( i) = MN ) i= I min 11

Probability Interpretation The graph of relative frequency of occurrence as a function of gray value is also called a histogram: Relative Frequency.25.2.15.1.5 1 2 3 4 5 6 7 Gray Value Σ Interpreting the relative frequency histogram as a probability distribution, then: P(I(x,y) = i) = H(i)/(MxN) Σ Cumulative Density Function Interpreting the relative frequency histogram as a probability distribution, then:.25 P(I(x,y) = i) = H(i)/(MxN) Relative Freque ency 2.2.15.1.5 1 2 3 4 5 6 7 Gray Value Curve is called the cumulative distribution function Q( i) = i k = P( k) CH ( i) = i k = H ( k) 1.9.8.7.6.5.4.3.2.1 1 2 3 4 5 6 7 Gray Value 12

Examples 1241 256 1693 256 Color Histograms 13

Histogram Equalization Image histograms consist of peaks, valleys, and low plains Peaks = many pixels concentrated in a few grey levels Plains = small number of pixels distributed over a wider range of grey levels 4 35 3 25 2 15 1 5 5 1 15 2 25 Histogram Equalization The goal is to modify the gray levels of an image so that the histogram of the modified image is flat. Expand pixels in peaks over a wider range of gray-levels levels. Squeeze low plains pixels into a narrower range of gray levels. Utilizes all gray values equally Example Histogram: Pixel Cou unt 2 18 16 14 12 1 8 6 4 2 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 Gray Value 14

Desired Histogram All gray levels are used equally. Has a tendency to enhance contrast. 3 25 Pixel Count 2 15 1 5 1 2 3 4 5 6 7 8 9 1 11 12 13 14 15 Gray Value Brute Force Gray Actual Desired How to get it Scale Count Count 256 22 from 7, 234 from 8 1 256 1 from 8, 255 from 9 2 256 195 from 9, 61 from 1 3 256 256 from 1 4 256 256 from 1 5 256 256 from 1 6 256 256 from 1 7 22 256 256 from 1 8 235 256 256 from 1 9 45 256 256 from 1 1 192 256 67 from 1, 189 from 11 11 212 256 23 from 11, 1 from 12, 223 from 13 12 1 256 1 from 13, 246 from 14 13 233 256 256 from 14 14 672 256 17 from 14, 86 from 15 15 342 256 256 from 15 Sum 496 496 How are the gray levels in the original image changed to produce the enhanced image? Method 1. Choose points randomly. Method 2. Choice depends on the gray levels of their neighboring i points. Computationally expensive. Approximations. 15

Histogram Equalization Mapping from one set of grey-levels, Ι, to a new set, Ο. Ideally, the number of pixels, N p, occupying each grey level should be: N p = M*N G To approximate this, apply the transform i = MAX, round CH(j) -1 N p Where CH is the cumulative histogram (see next slide) j is the gray value in the source image i is the gray value in the equalized image G=8 MxN=24 N p =3 CH(j) = Σ H(i) i= j Example j H(j) CH(j) i 1 1 1 8 9 2 2 7 16 4 3 5 21 6 4 1 22 6 5 1 23 7 6 1 24 7 7 24 7 8 8 6 6 4 2 ideal 4 2 1 2 3 4 5 6 8 1 2 3 4 5 6 8 16

Example 4 2 5 1 15 2 25 1.5 5 1 15 2 25 3 4 2 5 1 15 2 25 Comparison Original γ>1 Histogram equalization 17

Why? Given MxN input image I with gray scale p.p k and histogram H(p). Desire output image O with gray scale q.q k and uniform histogram G(q) Treat the histograms as a discrete probability density function. Then monotonic transfer function m = T(n) implies: m Σ G(q i ) = Σ H(p j ) n i= j= The sums can be interpreted as discrete distribution functions From Image Processing, Analysis, and Machine Vision, Sonka et al. Why? continued MxN The histogram entries in G must be: G(i) = qk -q (because G is uniform) Plug this into previous equation to get: m MxN q k -q Σ = Σ H(p i ) i= i= Now translate into continuous domain (can t really get uniform distributions in the discrete domain) q q m MxN ds q k -q MN(q m -q ) q k -q n p n = H(s)ds p 18

Why? continued Solve last equation for q to get: p q k -q n q m = T(p) = H(s)ds + q MN Map back into discrete domain to get: q = T(p) = q k -q m MN Σ H(i) () + q i=p Leads to an algorithm.. p p n Histogram Equalization Algorithm For an NxM image of G gray levels, say -255 Set Create image histogram For cumulative image histogram H c T(p) = round ( G-1 NM H c (p)) Rescan input image and write new output image by setting g q = T(g p ) 19

Observations Acquisition process degrades image Brightness and contrast enhancement implemented by pixel operations No one algorithm universally useful γ > 1 enhances contrast in bright images γ < 1 enhances contrast in dark images Transfer function for histogram equalisation proportional to cumulative histogram Noise Reduction What is noise? How is noise reduction performed? Noise reduction from first principles i Neighbourhood operators linear filters (low pass, high pass) non-linear filters (median) + = image noise grainy image 2

Noise Plot of image brightness. Noise is additive. Noise fluctuations are rapid high frequency. 3 2 1 1-1 3 2 1 Image 5 1 15 2 25 Noise 5 1 15 2 25 Image + Noise 5 1 15 2 25 Sources of Noise Sources of noise = CCD chip. Electronic signal fluctuations in detector. Caused by thermal energy. Worse for infra-red sensors. Electronics Transmission Radiation from the long wavelength IR band is used in most infrared imaging applications 21

Noise Model Plot noise histogram Typical noise distribution is normal or Gaussian Mean(noise) µ = Standard deviation σ 25 2 15 1 2σ 1 η(x) = exp - 1 2πσ 2 2 2 (x-µ) σ 5 5 1 15 2 25 µ Effect of σ Integral under curve is 1 σ=1 σ=2 σ=3 2 1 2 1 2 1 5 1 15 2 25 5 1 15 2 25 5 1 15 2 25 22

Two Dimensional Gaussian Noise Noise varies above and below uncorrupted image. 23 Image 22 21 2 19 18 Image + Noise 17 16 7 8 9 1 11 12 13 14 23

Noise Reduction - 1 How do we reduce 25 2 noise? 15 Consider a uniform 1-d image and add noise. Focus on a pixel neighbourhood. Averaging the three values should result in a value closer to original uncorrupted data Especially if gaussian mean is zero 1 5 25 2 15 1 5 5 1 15 2 25 3 5 1 15 2 25 3 A i-1 A i A i+1 C i Noise Reduction - 1 Averaging smoothes 25 2 the noise fluctuations. 15 1 5 Consider the next pixel A i+1 25 2 Repeat for remainder of 15 1 pixels. 5 5 1 15 2 25 3 5 1 15 2 25 3 C i+ 1 A + Ai + 1 + A 3 i i+ 2 = A i-1 A i A i+1 A i+2 C i+1 24

Neighborhood Operations All pixels can be averaged by convolving 1-d image A with mask B to give enhanced image C. Weights of B must equal one when added together. Why? C = A * B B = [ B1 B2 B3 ] C i = A i-1 B 1 + A i B 2 + A i+1 B 3 1 B = [1 1 1] 3 C i = A i-1 + A i + A i+1 3 2D Analog of 1D Convolution Consider the problem of blurring a 2D image Here s the image and a blurred version: How would we do this? What s the 2D analog of 1D convolution? 25

2D Blurring Kernel C = A * B B becomes B = 1 9 1 1 1 1 1 1 1 1 1 Convolution Extremely important concept in computer vision, image processing, signal processing, etc. Lots of related mathematics (we won t do) General idea: reduce a filtering operation to the repeated application of a mask (or filter kernel) to the image Kernel can be thought of as an NxN image N is usually odd so kernel has a central pixel In practice (flip kernel) Align kernel center pixel with an image pixel Pointwise multiply each kernel pixel value with corresponding image pixel value and add results Resulting sum is normalized by kernel weight Result is the value of the pixel centered on the kernel 26

Result Image Kernel Example Kernel is aligned with pixel in image, multiplicative sum is computed, normalized, and stored in result image. Process is repeated across image. What happens when kernel is near edge of input image? Image Border Problem missing samples are zero missing samples are gray copying last lines reflected indexing (mirror) circular indexing (periodic) truncation of the result 27

Convolution Size Image size = M 1 N 1 Mask size = M 2 N 2 N 1 Convolution size = N 2 M 1 -M 2 +1 N 1 -N 2 +1 N 1 -N 2 +1 Typical Mask sizes = 3 3, 5 5, 7 7, 9 9, 9 11 11 What is the convolved image size for a 128 128 image and 7 7 mask? Convolution Image Data: 1 12 4 16 19 1 14 22 52 1 55 41 1 14 51 21 14 1 32 22 9 9 19 14 41 18 9 22 27 11 1 7 8 8 4 5 Mask: 1 1 1 1-1 S = 1 1 1 1 1 1-1 1 1 Σ Σ 1 k=-1 m=-1 Σ Σ M(k,m) (, I (i,j) = f 1 S 1 Σ Σ 1 k=-1 m=-1 I(i+k,j+m) *M(k,m) = I * M 28

Properties of Convolution Commutative: f 1 (t) * f 2 (t) = f 2 (t) * f 1 (t) Distributive: f 1 (t) * [f 2 (t) + f 3 (t)] = f 1 (t) * f 2 (t) + f 1 (t) * f 3 (t) Associative: f 1 (t) * [f 2 (t) * f 3 (t)] = [f 1 (t) * f 2 (t)] * f 3 (t) Shift: if f 1 (t) * f 2 (t) = c(t), then f 1 (t) * f 2 (t-t) = f 1 (t-t) * f 2 (t) = c(t-t) Convolution with impulse: f(t) *δ(t) = f(t) Convolution with shifted impulse: f(t) *δ(t-t) = f(t-t) Noise Reduction - 1 Image + Noise 23 22 21 2 19 18 17 16 7 8 9 1 11 12 13 14 Image + Noise - Blurred Uncorrupted Image 29

Noise Reduction - 1 Technique relies on high frequency noise fluctuations being blocked by filter. Hence, low-pass filter. Fine detail in image may also be smoothed. Balance between keeping image fine detail and reducing noise. Noise Reduction - 1 Saturn image coarse detail Boat image contains fine detail Noise reduced but fine detail also smoothed 3

Image hmmmmm.. Blurred Image - = Noise Reduction - 2: Median Filter Nonlinear Filter Compute median of points in neighborhood Has a tendency to blur detail less than averaging Works very well for shot or salt and pepper noise Original Low-pass Median 31

Noise Reduction - 2 Low-pass Median 2 18 18 16 16 14 14 12 12 1 1 8 6 8 1 12 14 16 18 8 6 8 1 12 14 16 18 Low-pass: fine detail smoothed by averaging Median: fine detail passed by filter Edge Preserving Smoothing Smooth (average, blur) an image without disturbing Sharpness or position Of the edges Nagoa-Maysuyama Filter Kuwahara Filter Anisotropic Diffusion Filtering (Perona & Malik,...) Spatially variant smoothing 32

Nagao-Matsuyama Filter Calculate the variance within nine subwindows of a 5x5 moving window Output value is the mean of the subwindow with the lowest variance Nine subwindows used: Kuwahara Filter Principle: divide filter mask into four regions (a, b, c, d). In each compute the mean brightness and the variance The output value of the center pixel (abcd) in the window is the mean value of that region that has the smallest variance. 33

Kuwahara Filter Example Original Median (1 iteration) Median (1 iterations) Kuwahara Anisotropic Diffusion Filtering Note: Original Perona-Malik diffusion process is NOT anisotropic, although they erroneously said it was. 34

Example: Perona-Malik In general: Anisotropic diffusion estimates an image from a noisy image Useful for restoration, etc. Only shown smoothing examples Read the literature Observations on Enhancement Set of general techniques Varied goals: enhance perceptual aspects of an image for human observation preprocessing to aid a vision system achieve its goal Techniques tend to be simple, ad-hoc, and qualitative Not universally applicable results depend on image characteristics determined by interactive experimentation Can be embedded in larger vision system selection must be done carefully some techniques introduce artifacts into the image data Developing specialized techniques for specific applications can be tedious and frustrating. 35

Summary Summary Conclusion What is noise? Gaussian distribution Noise reduction first principles Neighbourhood low-pass median Averaging pixels corrupted by noise cancels out the noise. Low-pass can blur image. Median may retain fine image detail that may be smoothed by averaging. 36