Digital Image Processing COSC 6380/4393 Lecture 21 Nov 16 th, 2017 Pranav Mantini Ack: Shah. M
Image Processing Geometric Transformation Point Operations Filtering (spatial, Frequency) Input Restoration/ Reconstruction Color Image Processing... Semantic meaning Output
Edge Detection Edge Detection Identify pixels that represent edges in the image
Why detect edges 1. Visual system The importance of using edges is also supported by nature The visual systems of mammals contain cells with gradient-based Gabor-like response. Initial stages of mammalian vision systems involve detection of edges and local features 2. Computer vision algorithms for Object detection and recognition Object recognition, stereo, texture analysis, motion analysis, image enhancement, image compression
Edge Formation
Edge Detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded in the edges Source: D. Lowe
What is an Edge? Discontinuity of intensities in the image Edge models
Characterizing edges An edge is a place of rapid change in the image intensity function Slide Credit: James Hays
Characterizing edges An edge is a place of rapid change in the image intensity function Slide Credit: James Hays
Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal
Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal Where is the edge?
Solution: smooth first
Solution: smooth first
Derivative theorem of convolution Differentiation is convolution, and convolution is associative:
Derivative theorem of convolution
Derivative theorem of convolution
Tradeoff between smoothing and localization Smoothed derivative removes noise, but blurs edge. Also finds edges at different scales.
Derivative in Two-Dimensions Definition Approximation Convolution kernels
Image Derivatives
Edge Detection Goals
Edge Detection Goals 1. Good detection: Low false alarm rate and low false dismissal rate: maximize S/ N ratio 2. Good localization: Mark point closest to center of true edge: minimize distance between marked point and center 3. Uniqueness: Only one response to a single edge 4. Good property measurement: Orientation, contrast, etc.
1D Edge Detection An ideal edge is a step function 22
1D Edge Detection The first derivative of I (x) has a peak at the edge The second derivative of I (x) has a zero crossing at the edge 23
Edge Detectors First order derivative based Second order derivative based
Edge Detectors First order derivative based Prewit Sobel Second order derivative based Marr-Hildreth (Laplacian of Gaussian ) Canny (Gradient of Gaussian)
First order edge detectors 1. Compute derivatives In x and y directions 2. Find gradient magnitude 3. Threshold gradient magnitude
Prewit: Compute derivatives In x directions Image Average smoothing in Y direction 1 1 1 Smooth image Gradient in X direction 1 0 1 Edges in X 1 0 1 1 0 1 1 0 1
Prewit: Compute derivatives In x and y directions Image Image Average smoothing in Y direction 1 1 1 Average smoothing in X direction 1 1 1 Smooth image Smooth image Gradient in X direction 1 0 1 Gradient in Y direction 1 0 1 Edges in X 1 0 1 1 0 1 1 0 1 Edges in Y 1 1 1 0 0 0 1 1 1
Sobel : Compute derivatives In x and y directions Image Image Average smoothing in Y direction 1 2 1 Average smoothing in X direction 1 2 1 Smooth image Smooth image Gradient in X direction 1 0 1 Gradient in Y direction 1 0 1 Edges in X 1 0 1 2 0 2 1 0 1 Edges in Y 1 2 1 0 0 0 1 2 1
Sobel Edge Detector
Pros: 1. Quick and simple Prewitt and Sobel Cons: 1. Detection: sensitive to noise 2. Uniqueness: Multiple responses (dependent on smoothing) 3. Requires tuning to define threshold
Second Order Derivative Edge Detection Methods Marr Hildreth Edge Detector 1. Smooth image by Gaussian filter S 2. Apply second order derivative to S 2 S (Laplacian) 3. Find zero crossings Scan along each row, record an edge point at the location of zero-crossing. Repeat above step along each column
Marr Hildreth Edge Detector Gaussian smoothing Find Laplacian
Marr Hildreth Edge Detector Laplacian of Gaussian (LoG)
Finding Zero Crossings 1. Four cases of zero-crossings : {+,-} {+,0,-} {-,+} {-,0,+} 2. Slope of zero-crossing {a, -b} is a+b. 3. To mark an edge compute slope of zero-crossing Apply a threshold to slope
Example
Marr Hildreth Edge Detector 1. Apply LoG to the Image 2. Find zero-crossings from each row 3. Find slope of zero-crossings 4. Apply threshold to slope and mark edges
Quality of an Edge
Quality of an Edge
Quality of an Edge
Quality of an Edge
Canny Edge Detector Criterion 1: Good Detection: The optimal detector must minimize the probability of false positives as well as false negatives. Criterion 2: Good Localization: The edges detected must be as close as possible to the true edges. Single Response Constraint: The detector must return one point only for each edge point.
Canny Edge Detector Steps 1. Smooth image with Gaussian filter
Canny Edge Detector Steps 1. Smooth image with Gaussian filter 2. Compute derivative of filtered image
Canny Edge Detector Steps 1. Smooth image with Gaussian filter 2. Compute derivative of filtered image 3. Find magnitude and orientation of gradient
Canny Edge Detector Steps 1. Smooth image with Gaussian filter 2. Compute derivative of filtered image 3. Find magnitude and orientation of gradient 4. Apply Non-maximum Suppression
Canny Edge Detector Steps 1. Smooth image with Gaussian filter 2. Compute derivative of filtered image 3. Find magnitude and orientation of gradient 4. Apply Non-maximum Suppression 5. Apply Hysteresis Threshold
Smoothing Canny Edge Detector First Two Steps Derivative
Canny Edge Detector Derivative of Gaussian
Canny Edge Detector Derivative of Gaussian
Canny Edge Detector Derivative of Gaussian
Canny Edge Detector First Two Steps
Canny Edge Detector First Two Steps
Canny Edge Detector First Two Steps
Canny Edge Detector Third Step Gradient magnitude and gradient direction
Canny Edge Detector Third Step Gradient magnitude and gradient direction
Canny Edge Detector Third Step Gradient magnitude and gradient direction
Example
Derivative of Gaussian filter
Compute Gradients (DoG)
Edge Direction Vs Gradient Direction Gradient is maximum in the direction perpendicular to the edge Edge direction Maximum gradient direction Edge
Get Orientation at Each Pixel Threshold at minimum level Get orientation theta = tan 1 gy/gx
Canny Edge Detector Fourth Step Non maximum suppression
Canny Edge Detector Fourth Step Non maximum suppression
Canny Edge Detector Non-Maximum Suppression Suppress the pixels in S which are not local maximum
Canny Edge Detector Non-Maximum Suppression Suppress the pixels in S which are not local maximum
Canny Edge Detector Non-Maximum Suppression
Canny Edge Detector Hysteresis Thresholding If the gradient at a pixel is above High, declare it as an edge pixel below Low, declare it as a non-edge-pixel between low and high Consider its neighbors iteratively then declare it an edge pixel if it is connected to an edge pixel directly or via pixels between low and high.
Connectedness Canny Edge Detector Hysteresis Thresholding
Connectedness Canny Edge Detector Hysteresis Thresholding
Connectedness Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding Scan the image from left to right, topbottom.
Canny Edge Detector Hysteresis Thresholding Scan the image from left to right, topbottom. The gradient magnitude at a pixel is above a high threshold declare that as an edge point
Canny Edge Detector Hysteresis Thresholding Scan the image from left to right, topbottom. The gradient magnitude at a pixel is above a high threshold declare that as an edge point Then recursively consider the neighbors of this pixel. If the gradient magnitude is above the low threshold declare that as an edge pixel.
Canny Edge Detector Hysteresis Thresholding
Canny Edge Detector Hysteresis Thresholding
Before Non-max Suppression Slide
Before Non-max Suppression Slide
Hysteresis thresholding Threshold at low/high levels to get weak/strong edge pixels Do connected components, starting from strong edge pixels
Final Canny Edges
Effect of σ (Gaussian kernel spread/size) The choice of σ depends on desired behavior large σ detects large scale edges small σ detects fine features
Digital Image Processing
1. Pin hole camera Image Acquisition
Image Acquisition 1. Pin hole camera 2. OPTICS OF THE EYE
Image Acquisition 1. Pin hole camera 2. OPTICS OF THE EYE 3. OPTICAL IMAGING GEOMETRY light source (point source) emitted rays image object sensing plate, emulsion, etc focal length lens reflected rays
Image Acquisition 1. Pin hole camera 2. OPTICS OF THE EYE 3. OPTICAL IMAGING GEOMETRY 4. Image Sampling and Quantization
Image Acquisition 1. Pin hole camera 2. OPTICS OF THE EYE 3. OPTICAL IMAGING GEOMETRY 4. Image Sampling and Quantization 5. Spatial and Intensity Resolution 6. Resampling
Digital Image Processing
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM 2. THRESHOLDING
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM 2. THRESHOLDING 3. LOGICAL OPERATIONS
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM 2. THRESHOLDING 3. LOGICAL OPERATIONS 4. BLOB COLORING
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM 2. THRESHOLDING 3. LOGICAL OPERATIONS 4. BLOB COLORING 5. BINARY MORPHOLOGY
BINARY IMAGES Processing 1. GRAY-LEVEL IMAGE HISTOGRAM 2. THRESHOLDING 3. LOGICAL OPERATIONS 4. BLOB COLORING 5. BINARY MORPHOLOGY 6. Binary image Compression
Digital Image Processing
Image Enhancement and Filtering 1. Linear Point operations
Image Enhancement and Filtering 1. Linear Point operations 2. Histogram shaping
Image Enhancement and Filtering 1. Linear Point operations 2. Histogram shaping 3. Algebraic Operations
Image Enhancement and Filtering 1. Linear Point operations 2. Histogram shaping 3. Algebraic Operations 4. DFT
Image Enhancement and Filtering 1. Linear Point operations 2. Histogram shaping 3. Algebraic Operations 4. DFT 5. Spatial filtering
Image Enhancement and Filtering 1. Linear Point operations 2. Histogram shaping 3. Algebraic Operations 4. DFT 5. Spatial filtering 6. Convolution Theorem 7. Frequency Filtering
Digital Image Processing
1. Degradation model Image Restoration
Image Restoration 1. Degradation model 2. Modelling and estimating Noise
Image Restoration 1. Degradation model 2. Modelling and estimating Noise 3. Statistical and periodic noise
Image Restoration 1. Degradation model 2. Modelling and estimating Noise 3. Statistical and periodic noise 4. Mean and order statistic filters
Image Restoration 1. Degradation model 2. Modelling and estimating Noise 3. Statistical and periodic noise 4. Mean and order statistic filters 5. Model degradation functions
Image Restoration 1. Degradation model 2. Modelling and estimating Noise 3. Statistical and periodic noise 4. Mean and order statistic filters 5. Model degradation functions 6. Inverse filtering
Digital Image Processing
Color Image Processing 1. Color Fundamentals
Color Image Processing 1. Color Fundamentals 2. Color Models
Color Image Processing 1. Color Fundamentals 2. Color Models 3. Psuedo color image processing
Color Image Processing 1. Color Fundamentals 2. Color Models 3. Psuedo color image processing 4. Full color image processing
Digital Image Processing
1. Edge Formation Edge Detection
Edge Detection 1. Edge Formation 2. Characterizing edges
Edge Detection 1. Edge Formation 2. Characterizing edges 3. First order Derivatives 4. Second order derivatives 5. Canny edge detector
Digital Image Processing ~