Computer Vision – Lecture 2

Slides:



Advertisements
Similar presentations
電腦視覺 Computer and Robot Vision I
Advertisements

Binary Image Analysis Selim Aksoy Department of Computer Engineering Bilkent University
1 Video Processing Lecture on the image part (8+9) Automatic Perception Volker Krüger Aalborg Media Lab Aalborg University Copenhagen
Image Segmentation Image segmentation (segmentace obrazu) –division or separation of the image into segments (connected regions) of similar properties.
電腦視覺 Computer and Robot Vision I Chapter2: Binary Machine Vision: Thresholding and Segmentation Instructor: Shih-Shinh Huang 1.
Each pixel is 0 or 1, background or foreground Image processing to
Introduction to Morphological Operators
Perceptual and Sensory Augmented Computing Computer Vision WS 08/09 Computer Vision Binary Image Analysis Bastian Leibe RWTH Aachen
Edges and Binary Images
September 10, 2013Computer Vision Lecture 3: Binary Image Processing 1Thresholding Here, the right image is created from the left image by thresholding,
Image Indexing and Retrieval using Moment Invariants Imran Ahmad School of Computer Science University of Windsor – Canada.
Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing.
EE 7730 Image Segmentation.
Segmentation Divide the image into segments. Each segment:
1 Binary Image Analysis Binary image analysis consists of a set of image analysis operations that are used to produce or process binary images, usually.
Objective of Computer Vision
Highlights Lecture on the image part (10) Automatic Perception 16
Objective of Computer Vision
Computer Vision Basics Image Terminology Binary Operations Filtering Edge Operators.
E.G.M. PetrakisBinary Image Processing1 Binary Image Analysis Segmentation produces homogenous regions –each region has uniform gray-level –each region.
כמה מהתעשייה? מבנה הקורס השתנה Computer vision.
1. Binary Image B(r,c) 2 0 represents the background 1 represents the foreground
Machine Vision for Robots
Lecture 5. Morphological Image Processing. 10/6/20152 Introduction ► ► Morphology: a branch of biology that deals with the form and structure of animals.
Recap CSC508.
CSE554AlignmentSlide 1 CSE 554 Lecture 5: Alignment Fall 2011.
Chap 3 : Binary Image Analysis. Counting Foreground Objects.
CS 6825: Binary Image Processing – binary blob metrics
CS 376b Introduction to Computer Vision 02 / 22 / 2008 Instructor: Michael Eckmann.
September 23, 2014Computer Vision Lecture 5: Binary Image Processing 1 Binary Images Binary images are grayscale images with only two possible levels of.
Binary Thresholding Threshold detection Variations
Digital Image Processing Chapter 9: Morphological Image Processing 5 September 2007 Digital Image Processing Chapter 9: Morphological Image Processing.
Morphological Image Processing
1 Binary Image Analysis Binary image analysis consists of a set of image analysis operations that are used to produce or process binary images, usually.
CS 1699: Intro to Computer Vision Edges and Binary Images Prof. Adriana Kovashka University of Pittsburgh September 15, 2015.
Image Segmentation and Morphological Processing Digital Image Processing in Life- Science Aviad Baram
Video Segmentation Prepared By M. Alburbar Supervised By: Mr. Nael Abu Ras University of Palestine Interactive Multimedia Application Development.
Chapter 3 cont’d. Binary Image Analysis. Binary image morphology (nonlinear image processing)
Digital Camera and Computer Vision Laboratory Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan, R.O.C.
1 Regions and Binary Images Hao Jiang Computer Science Department Sept. 25, 2014.
CS654: Digital Image Analysis Lecture 25: Hough Transform Slide credits: Guillermo Sapiro, Mubarak Shah, Derek Hoiem.
CS654: Digital Image Analysis
1 Research Question  Can a vision-based mobile robot  with limited computation and memory,  and rapidly varying camera positions,  operate autonomously.
1 Regions and Binary Images Hao Jiang Computer Science Department Sept. 24, 2009.
Digital Image Processing CSC331 Morphological image processing 1.
Low level Computer Vision 1. Thresholding 2. Convolution 3. Morphological Operations 4. Connected Component Extraction 5. Feature Extraction 1.
CS654: Digital Image Analysis
Nottingham Image Analysis School, 23 – 25 June NITS Image Segmentation Guoping Qiu School of Computer Science, University of Nottingham
1 Mathematic Morphology used to extract image components that are useful in the representation and description of region shape, such as boundaries extraction.
Digital Camera and Computer Vision Laboratory Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan, R.O.C.
Course 3 Binary Image Binary Images have only two gray levels: “1” and “0”, i.e., black / white. —— save memory —— fast processing —— many features of.
Lecture(s) 3-4. Morphological Image Processing. 3/13/20162 Introduction ► ► Morphology: a branch of biology that deals with the form and structure of.
April 21, 2016Introduction to Artificial Intelligence Lecture 22: Computer Vision II 1 Canny Edge Detector The Canny edge detector is a good approximation.
COMP 9517 Computer Vision Binary Image Analysis 4/15/2018
Digital Image Processing Lecture 15: Morphological Algorithms April 27, 2005 Prof. Charlene Tsai.
Image Representation and Description – Representation Schemes
Interest Points EE/CSE 576 Linda Shapiro.
Binary Image Analysis Gokberk Cinbis
Introduction to Morphological Operators
Computer Vision Lecture 5: Binary Image Processing
Binary Image Analysis used in a variety of applications:
CS Digital Image Processing Lecture 5
Department of Computer Engineering
Digital Image Processing Lecture 15: Morphological Algorithms
Feature descriptors and matching
Computer and Robot Vision I
Computer and Robot Vision I
Binary Image Analysis used in a variety of applications:
Presentation transcript:

Computer Vision – Lecture 2 Binary Image Analysis 22.10.2009 Bastian Leibe RWTH Aachen http://www.umic.rwth-aachen.de/multimedia leibe@umic.rwth-aachen.de TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAA

Announcements Tuesday lecture slot (13:15 – 14:45) Possible solution Currently relatively small room (UMIC 024) Overlaps with several other lectures. Possible solution We can get a bigger room (and reduce overlaps) by shifting the lecture to start 45 minutes earlier. Quick poll Who would have conflicting lectures on… Tue 12:30 – 14:00 ? B. Leibe

Binary Images Just two pixel values Foreground and background Regions of interest Slide credit: Kristen Grauman B. Leibe

Uses: Industrial Inspection R. Nagarajan et al. “A real time marking inspection scheme for semiconductor industries“, 2006 B. Leibe

Uses: Document Analysis, Text Recognition Handwritten digits Source: Till Quack, Martin Renold Natural text (after detection) Scanned documents B. Leibe

Uses: Medical/Bio Data Source: D. Kim et al., Cytometry 35(1), 1999 B. Leibe

Uses: Blob Tracking & Motion Analysis   Frame Differencing Source: Kristen Grauman   Background Subtraction Source: Tobias Jäggli B. Leibe

Uses: Shape Analysis, Free-Viewpoint Video Visual Hull Reconstruction Silhouette Blue-c project, ETH Zurich Medial axis B. Leibe

Uses: Intensity Based Detection Looking for dark pixels… fg_pix = find(im < 65); Slide Credit: Kristen Grauman B. Leibe

Uses: Color Based Detection Looking for pixels within a certain color range… fg_pix = find(hue > t1 & hue < t2); Slide Credit: Kristen Grauman B. Leibe

Issues How to demarcate multiple regions of interest? Count objects Compute further features per object What to do with “noisy” binary outputs? Holes Extra small fragments Slide Credit: Kristen Grauman B. Leibe

Outline of Today’s Lecture Convert the image into binary form Thresholding Clean up the thresholded image Morphological operators Extract individual objects Connected Components Labeling Describe the objects Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

Thresholding Grayscale image  Binary mask Different variants One-sided Two-sided Set membership B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Selecting Thresholds Typical scenario Separate an object from a distinct background Try to separate the different grayvalue distributions Partition a bimodal histogram Fit a parametric distribution (e.g. Mixture of Gaussians) Dynamic or local thresholds In the following, I will present some simple methods. We will see some more general methods in Lecture 6… B. Leibe

A Nice Case: Bimodal Intensity Histograms Ideal histogram, light object on dark background Actual observed histogram with noise Source: Robyn Owens B. Leibe

Not so Nice Cases… How to separate those? Threshold selection is difficult in the general case Domain knowledge often helps E.g. Fraction of text on a document page ( histogram quantile) E.g. Size of objects/structure elements Multiple modes Two distinct modes Overlapping modes Source: Shapiro & Stockman B. Leibe

Global Binarization [Otsu’79] Search for the threshold T that minimizes the within-class variance within of the two classes separated by T where This is the same as maximizing the between-class variance between B. Leibe

Algorithm Precompute a cumulative grayvalue histogram h. For each potential threshold T 1.) Separate the pixels into two clusters according to T 2.) Look up n1, n2 in h and compute both cluster means 3.) Compute Choose B. Leibe

Local Binarization [Niblack’86] Estimate a local threshold within a small neighborhood window W where k [-1,0] is a user-defined parameter. W TW Effect: W B. Leibe

Local Binarization [Niblack’86] Estimate a local threshold within a small neighborhood window W where k [-1,0] is a user-defined parameter. Improved version to suppress background noise for document binarization [Sauvola’00] where R is the dynamic range of and k > 0. Typical values: R=128 for 8-bit images and k 0.5. TW Effect: Useful for text, but not for larger objects B. Leibe

Global threshold selection (Ohta) Local threshold selection (Niblack) Effects Global threshold selection (Ohta) Original image Local threshold selection (Niblack) B. Leibe

Additional Improvements Document images often contain a smooth gradient Try to fit that gradient with a polynomial function Original image Binarized result Shading compensation Fitted surface Source: S. Lu & C. Tan, ICDAR’07 B. Leibe

Solution with pseudo-inverse: Surface Fitting Polynomial surface of degree d Least-squares estimation, e.g. for d=3 (m=10) Solution with pseudo-inverse: Matlab (using SVD): B. Leibe

Surface Fitting Iterative Algorithm 1.) Fit parametric surface to all points in region. 2.) Subtract estimated surface. 3.) Apply global threshold (e.g. with Ohta method) 4.) Fit surface to all background pixels in original region. 5.) Subtract estimated surface. 5.) Apply global threshold (Ohta) 6.) Iterate further if needed… The first pass also takes foreground pixels into account. This is corrected in the following passes. Basic assumption here: most pixels belong to the background. Initial guess Refined guess B. Leibe

Result Comparison Original image Global (Ohta) Polynomial + Global Local (Niblack) Source: S. Lu & C. Tan, ICDAR’07 B. Leibe

Result Comparison Original image Global (Ohta) Polynomial + Global Local (Niblack) Source: S. Lu & C. Tan, ICDAR’07 B. Leibe

Outline of Today’s Lecture Convert the image into binary form Thresholding Clean up the thresholded image Morphological operators Extract individual objects Connected Components Labeling Describe the objects Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

Cleaning the Binarized Results Results of thresholding often still contain noise Necessary cleaning operations Remove isolated points and small structures Fill holes  Morphological Operators B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

Morphological Operators Basic idea Scan the image with a structuring element Perform set operations (intersection, union) of image content with structuring element Two basic operations Dilation (Matlab: imdilate) Erosion (Matlab: imerode) Several important combinations Opening (Matlab: imopen) Closing (Matlab: imclose) Boundary extraction Matlab: >> help strel B. Leibe Image Source: R.C. Gonzales & R.E. Woods

Dilation Definition Effects “The dilation of A by B is the set of all displacements z, such that and A overlap by at least one element”. ( is the mirrored version of B, shifted by z) Effects If current pixel z is foreground, set all pixels under (B)z to foreground.  Expand connected components  Grow features  Fill holes A B1 B2 A  B1 A  B2 B. Leibe Image Source: R.C. Gonzales & R.E. Woods

Erosion Definition Effects “The erosion of A by B is the set of all displacements z, such that is entirely contained in A”. Effects If not every pixel under (B)z is foreground, set the current pixel z to background.  Erode connected components  Shrink features  Remove bridges, branches, noise A 1 B1 B2 2 B. Leibe Image Source: R.C. Gonzales & R.E. Woods

Effects Dilation with circular structuring element Original image Erosion with circular structuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Effects Dilation with circular structuring element Original image Erosion with circular structuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Opening Definition Effect Sequence of Erosion and Dilation is defined by the points that are reached if B is rolled around inside A.  Remove small objects, keep original shape. B. Leibe Image Source: R.C. Gonzales & R.E. Woods

Effect of Opening Opening with small structuring element Feature selection through size of structuring element Original image Thresholded Opening with larger structuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Opening with circular structuring element Effect of Opening Feature selection through shape of structuring element Input Image Opening with circular structuring element B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Closing Definition Effect Sequence of Dilation and Erosion is defined by the points that are reached if B is rolled around on the outside of A.  Fill holes, keep original shape. B. Leibe Image Source: R.C. Gonzales & R.E. Woods

Closing with circular structuring element Effect of Closing Fill holes in thresholded image (e.g. due to specularities) Original image Thresholded Closing with circular structuring element Size of structuring element determines which structures are selectively filled. B. Leibe Image Source: http://homepages.inf.ed.ac.uk/rbf/HIPR2/

Example Application: Opening + Closing Original image Opening Closing Erosion Dilation Structuring element Dilation Erosion Eroded image Dilated image B. Leibe Source: R.C. Gonzales & R.E. Woods

Morphological Boundary Extraction Definition First erode A by B, then subtract the result from the original A. Effects If a 33 structuring element is used, this results in a boundary that is exactly 1 pixel thick. B. Leibe Source: R.C. Gonzales & R.E. Woods

Morphology Operators on Grayscale Images Dilation and erosion are typically performed on binary images. If image is grayscale: for dilation take the neighborhood max, for erosion take the min. Original Dilated Eroded Slide credit: Kristen Grauman B. Leibe

Outline of Today’s Lecture Convert the image into binary form Thresholding Clean up the thresholded image Morphological operators Extract individual objects Connected Components Labeling Describe the objects Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

Connected Components Labeling Goal: Identify distinct regions Binary image Connected components labeling Sources: Shapiro & Stockman, Chandra B. Leibe

Connected Components Examples Source: Pinar Duygulu B. Leibe

Connectedness Which pixels are considered neighbors? 4-connected Source: Chaitanya Chandra B. Leibe

Sequential Connected Components Slide credit: J. Neira B. Leibe

Sequential Connected Components (2) Process the image from left to right, top to bottom: 1.) If the next pixel to process is 1 i.) If only one of its neighbors (top or left) is 1, copy its label. ii.) If both are 1 and have the same label, copy it. iii.) If they have different labels  Copy the label from the left.  Update the equivalence table. iv.) Otherwise, assign a new label. Re-label with the smallest of equivalent labels Slide credit: J. Neira B. Leibe

Application: Blob Tracking Absolute differences from frame to frame Slide credit: K. Grauman B. Leibe

Thresholding Slide credit: K. Grauman B. Leibe

Eroding Slide credit: K. Grauman B. Leibe

Application: Segmentation of a Liver Slide credit: Li Shen B. Leibe

Outline of Today’s Lecture Convert the image into binary form Thresholding Clean up the thresholded image Morphological operators Extract individual objects Connected Components Labeling Describe the objects Region properties B. Leibe Image Source: D. Kim et al., Cytometry 35(1), 1999

Region Properties From the previous steps, we can obtain separated objects. Some useful features can be extracted once we have connected components, including Area Centroid Extremal points, bounding box Circularity Spatial moments B. Leibe

Area and Centroid We denote the set of pixels in a region by R Assuming square pixels, we obtain Area: Centroid: Source: Shapiro & Stockman B. Leibe

Circularity Measure the deviation from a perfect circle Circularity: where and are the mean and vari- ance of the distance from the centroid of the shape to the boundary pixels (xk,yk). Mean radial distance: Variance of radial distance: Source: Shapiro & Stockman B. Leibe

Invariant Descriptors Often, we want features independent of location, orientation, scale. Feature space distance Slide credit: Kristen Grauman B. Leibe

Central Moments S is a subset of pixels (region). Central (j,k)th moment defined as: Invariant to translation of S. Interpretation: 0th central moment: area 2nd central moment: variance 3rd central moment: skewness 4th central moment: kurtosis Slide credit: Kristen Grauman B. Leibe

Moment Invariants Normalized central moments From those, a set of invariant moments can be defined for object description. Robust to translation, rotation & scaling, but don’t expect wonders (still summary statistics). (Additional invariant moments 5, 6, 7 can be found in the literature). B. Leibe

Moment Invariants B. Leibe

Axis of Least Second Moment Invariance to orientation? Need a common alignment Compute Eigenvectors of 2nd moment matrix (Matlab: eig(A)) Axis for which the squared distance to 2D object points is minimized (maximized). B. Leibe

Summary: Binary Image Processing Pros Fast to compute, easy to store Simple processing techniques Can be very useful for constrained scenarios Cons Hard to get “clean” silhouettes Noise is common in realistic scenarios Can be too coarse a representation Cannot deal with 3D changes Slide credit: Kristen Grauman B. Leibe

References and Further Reading More on morphological operators can be found in R.C. Gonzales, R.E. Woods, Digital Image Processing. Prentice Hall, 2001 Online tutorial and Java demos available on http://homepages.inf.ed.ac.uk/rbf/HIPR2/ B. Leibe

Questions ? B. Leibe

Demo “Haribo Classification” B. Leibe

You Can Do It At Home… Accessing a webcam in Matlab: function out = webcam % uses "Image Acquisition Toolbox„ adaptorName = 'winvideo'; vidFormat = 'I420_320x240'; vidObj1= videoinput(adaptorName, 1, vidFormat); set(vidObj1, 'ReturnedColorSpace', 'rgb'); set(vidObj1, 'FramesPerTrigger', 1); out = vidObj1 ; cam = webcam(); img=getsnapshot(cam); B. Leibe

Matlab Intro: Everything is a matrix Tutorial adapted from W. Freeman, MIT

Matlab Intro: Matrix Index Tutorial adapted from W. Freeman, MIT

Matlab Intro: Manipulating Matrices Tutorial adapted from W. Freeman, MIT

Matlab Intro: Manipulating Matrices Tutorial adapted from W. Freeman, MIT B. Leibe

Matlab Intro: Scripts and Functions Scripts are m-files containing MATLAB statements Functions are like any other m-file, but they accept arguments Name the function file the same as the function name Tutorial adapted from W. Freeman, MIT B. Leibe

Matlab Intro: Try to Code in Matrix Ways B. Leibe

Matlab Intro: Important Commands whos  List variables in workspace help  Get help for any command lookfor  Search for keywords clear/clear x  Erase a variable/all variables save  Save the workspace load  Load a saved workspace keyboard  Enter debugging mode (until dbquit) B. Leibe

Morphology in Matlab N = hist(Y,M) IM2 = imerode(IM,SE); IM2 = imdilate(IM,SE); IM2 = imclose(IM, SE); IM2 = imopen(IM, SE); L = bwlabel(BW,N); STATS = regionprops(L,PROPERTIES) ; 'Area' 'Centroid' 'BoundingBox' 'Orientation‘, … Slide credit: Kristen Grauman

Questions ? B. Leibe