institutionen fÖr systemteknik/file/e0005e... · •dip section 10.2.6 •dip 3ed page 717 ”to...
TRANSCRIPT
INSTITUTIONEN FÖR SYSTEMTEKNIK
LULEÅ TEKNISKA UNIVERSITET
2012-09-17 E0005E, Lecture 3 1
Lecture 3 Preliminary Notes
• Attendance – Make sure you are registered
• Course Guide – Any questions?
• MATLAB Tips – Anything missing that you need?
• Plagarism - ”copying another persons work and presenting it as your own”
- http://www.youtube.com/watch?v=Mwbw9KF-ACY&feature=related
- Ephorus compares your submission against millions of documents from the internet and against past submissions in this course
• More on Thresholding, DIP Textbook 10.3
2012-09-17 E0005E, Lecture 3 2
INSTITUTIONEN FÖR SYSTEMTEKNIK
LULEÅ TEKNISKA UNIVERSITET
2012-09-17 E0005E, Lecture 3 3
Edges, Lines, Points Neighbourhood operations (spatial filters)
Matthew Thurley
Industrial Image Processing
Last Lecture
• Histogram Equalisation (you used this in Lab 1)
• Geometric Transformations
• Point Operations
• Neighbourhood Operations
• Noise Filtering
- Linear filtering
- Median Filtering
- Edge Preserving Filtering
2012-09-17 E0005E, Lecture 3 4
Note to the lecturer -
review how to do this
This Lecture
• Edge Detection
- Textbook: DIP 10.2 Point, Line & Edge Detection, 3.4, 3.5, 3.6
- First Order Derivative Operators (Sobel)
- Second Order (Laplacian)
- First Order Diagonal (Compass) Operators
- Laplace of Gaussian Operator
• Image Sharpening
• Scale Space : Pyramid Scheme
• Binary Edges 2012-09-17 E0005E, Lecture 3 5
2012-09-17 6
Edges
• Edges are one of the most important features in an image as they are strong indicators of object boundaries.
• Sharp edges help us observe features and objects
E0005E, Lecture 3
Image with blurred edges Image with sharp edges
Edges
• Edge shape and position can be seen as an effective representation of an object.
• One could extract a polygonal representation of the boudary of both objects.
• In practise this requires a very controlled environment like the one shown with few objects and good contrast between the objects and the background.
2012-09-17 E0005E, Lecture 3 7
2012-09-17 E0005E, Lecture 3 8
What sort of features are of interest?
Different types of filters will be suited to different kinds of feaures
Gradient neighbourhood operation
• Numerical difference (first order derivative)
• Centre difference
• First difference approximation
in an image
• Differentiation as a sliding window operation
2012-09-17 E0005E, Lecture 3 9
1 -1
Gradient
• For computational reasons we may approximate this by |Di| + |Dj|
• In both cases the magnitude of the gradient is no longer restricted to the interval [0..255]
• Histogram of the gradient image will look somewhat like a negative exponential curve.
2012-09-17 E0005E, Lecture 3 10
Gradient
• Roberts cross gradient operators
• Sobel Operators using centre difference gradient
- The two simple differentiators Di and Dj are expanded to two square 3x3 image operators
• The components sum to 0 which is a property of a gradient operator. This ensures that in an area of constant intensity the result of the operator will be 0
2012-09-17 E0005E, Lecture 3 11
Textbook: DIP 10.2.1-10.2.5, 3.6.1, 3.6.4 Gradient
Sobel Edge Detector
2012-09-17 E0005E, Lecture 3 12
2012-09-17 E0005E, Lecture 3 13
2nd Order Derivative
2012-09-17 E0005E, Lecture 3 14
Textbook: DIP 10.2.1-10.2.5, 3.6.2
2012-09-17 E0005E, Lecture 3 15
Laplacian Edge Detector
• The laplace will give a double response to an edge often the zero crossings are used to detect the edge
• Histogram of a laplacian edge image will look like a very narrow bell curve centered about 0.
2012-09-17 E0005E, Lecture 3 16
Compare First & Second Order Derivatives
2012-09-17 E0005E, Lecture 3 17
Edge Detection
2012-09-17 E0005E, Lecture 3 18
Edge Detection
2012-09-17 E0005E, Lecture 3 19
Detection of Isolated Points
2012-09-17 E0005E, Lecture 3 20
• This laplacian filter is isotropic – meaning its reponse is independent of direction (in the four directions, vertical, horizontal, two diagonal)
Detection of Lines
• The sobel first order derivative filters, detect step edges and lines
• Second order laplacian filters can be used to detect lines, such as these masks that provide maximum response for one pixel wide lines
2012-09-17 E0005E, Lecture 3 21
Edge Detection Summary
• First order derivatites produce thicker edges
• Second order have a stronger response to fine detail; thin lines, isolated points, noise
• Second order produce a double-edge response
• Second order zero-crossing (transition from positive to negative or vice-versa) can be a good edge location feature
2012-09-17 E0005E, Lecture 3 22
Group Quiz
• Design a filter that detects 1 pixel wide breaks in horizontal lines that are 1 pixel wide. Explain how your filter will work with some examples.
• Start by thinking about what sort of filter finds a 1 pixel wide horizontal line
• In General a spatial filter / neighbourhood operator can be understood by looking for what feature it returns a maximal response (both positive and negative) and when it returns 0
2012-09-17 E0005E, Lecture 3 23
Image Sharpening using the Laplacian
2012-09-17 E0005E, Lecture 3 24
Blurred Image Laplacian Edges (postive values shown only) 0)
Blurred + Laplacian Blurred + Laplacian
Speaking Notes: Adding the blurred image to the laplacian restored overall intensity variations, increasing contrast at locations of intensity dicontinuities (edges), which are locations of high visibility for humans.
Image Enhancement Example
2012-09-17 E0005E, Lecture 3 25
Textbook: DIP 3.6.7
Diagonal Edge Operators
Compass Operators
• A compass operator set is one that detects vertical, horizontal and diagonal edges.
• The Sobel edge detection masks are shown on the left.
2012-09-17 E0005E, Lecture 3 26
Textbook: DIP page 708-710
2012-09-17 E0005E, Lecture 3 27
Derivatives and Noise
Edges and Noise
• Gradient based edge detections are very susceptable to noise
2012-09-17 E0005E, Lecture 3 28
Linear White Noise Filtering (Smoothing)
2012-09-17 E0005E, Lecture 3 29
Negative side effect in that
prominent edges become
blurred
LoG Edge Detector
2012-09-17 E0005E, Lecture 3 30
More on Gaussian filters
in lecture 6.
The Gaussian filter
performs smoothing with
a mask where the values
in the mask create a 3D
bell curve, and the size of
the mask is defined by
the standard deviation.
G
LoG Edge Detector
2012-09-17 E0005E, Lecture 3 31
Textbook DIP pg. 715
LoG Edge Detector
2012-09-17 E0005E, Lecture 3 32
The key thing to remember is that edge detectors are susceptable to noise, and if necessary
how you will smooth the data without overly degrading the desired edge information.
LoG Edge Detector
• DIP section 10.2.6
• DIP 3ed page 717 ”To specify the size of a Gaussian filter, recall that 99.7% of the volume under a 2D gaussian surface lies between +- 3 standard deviations. … the size of an n x n LoG filter should be such that n is the smallest odd integer greater than or equal to 6 standard deviations. Choosing a filter mask smaller than this will tend to ’truncate’ the LoG function..”
2012-09-17 E0005E, Lecture 3 33
More Info About Spatial Filters
• We have seen many neighbourhood operations (spatial filters)
• If you want to know what a filter does, look for what will give it maximum and minumum response, and look how it combines information
2012-09-17 E0005E, Lecture 3 34
Quiz
• Consider two black and white images of the same size with the same number of black pixels, and white pixels in both images. The left side of the first image is white, and the right side black, whereas the second image is layed out like a chess board in a 8 by 8 grid of black and white squares.
• Suppose that each image is blurred with a 3x3 averaging mask
a) Would the histograms of the blurred images be equal? Explain. If your answer is no, sketch the two histograms
2012-09-17 E0005E, Lecture 3 35
Multiresolution Imaging
• Here we consider down-sampling an image to get less spatial resolution but still include the prominent edges.
• Down-sampling an image in a simple way, eg. discarding every second row and column , can create a more pixelated (aliased) image with more abrupt changes in grey level which can result in erroneous ”edges”.
• Consider this image and its downsampled version from http://en.wikipedia.org/wiki/Shannon_sampling_theorem
2012-09-17 E0005E, Lecture 3 36
Images can exhibit aliasing if the sampling resolution is inadequate. Consider this digital photograph of a wall with high frequency variation in color (color changes often and in a repetitive pattern). Aliasing can occur when it is down sampled. The aliasing appears as a moiré pattern. We can overcome this by blurring (smoothing such as an averaging filter) the image before sampling it.
Multiresolution Imaging
• Sub-sampling the image will create a more pixelated (aliased) image with more abrupt changes in grey level
2012-09-17 E0005E, Lecture 3 37
Original Aliasing with Pre-Smoothing
100x100 25x25 25x25
Multiresolution Imaging
2012-09-17 E0005E, Lecture 3 38
Smoothing & Downsampling
Textbook DIP Ch 7.1.1 Image Pyramids
Upsampling & Interpolating
Lowest resolution
Original (highest) resolution
Multiresolution Imaging
• Development Phase 3: 1. Create a pyramid of down-sampled images of a door using average filtering as the
smoothing filter.
a) Smoothing / Average filter (Gaussian filter is ideal)
b) Down-sample
2. Perform edge detection on the lowest resolution image & threshold to get a binary edge image
3. Successively process higher resolution images in the pyramid, performing edge detection on only the pixels in the higher resolution versions that corresponded to binary edges in the lower resolution images
a) Identify the pixels in the next higher resolution image corresponding to the binary edges in the lower resolution image
b) Perform edge detection on only these pixels
c) Threshold
d) Repeat for the next higher resolution image
2012-09-17 E0005E, Lecture 3 39
Group Work: Pyramid algorithm. Assume a 32x32 image
More detail in Development Phase 3
Binary Edges
2012-09-17 E0005E, Lecture 3 40
Thinning Binary Edges (lecture 4)
2012-09-17 E0005E, Lecture 3 41
Line Detection in Binary Edges (lecture 5)
2012-09-17 E0005E, Lecture 3 42
Summing Up
• Consider the following three questions;
- What do I need to work on?
- What have I learnt today?
- What was the main point left unanswered today?
• Write your answers in the provided journal. Write the lecture number 2 on top of the page. Write your name and student number on the front of the book
2012-09-17 E0005E Industrial Image Analysis 43
End of Lecture
2012-09-17 E0005E, Lecture 3 44
Multiresolution Imaging
• Down-sampling an image in a simple way, eg. discarding every second row and column , can create a more pixelated (aliased) image with more abrupt changes in grey level which can result in erroneous ”edges”.
• We can overcome this by averaging/smoothing as we down-sample.
• The fundamental principle at work here is described by the Nyquist-Shannon sampling theorem [wikipedia, 1], which we can rephrase for images as; if an image contains frequencies (repeating variations in intensity), one every 2C pixels, then it can be completely represented by a series of intensity values every C pixels.
• For an image and a value of C=2, we would need to remove frequencies (repeating changes in color) that happen every 4 pixels or less.
2012-09-17 E0005E, Lecture 3 45
[Wikipedia, 1] http://en.wikipedia.org/wiki/Shannon_sampling_theorem
This slide is too much information