Binary Thresholding Threshold detection Variations

Slides:



Advertisements
Similar presentations
Binary Image Analysis Selim Aksoy Department of Computer Engineering Bilkent University
Advertisements

電腦視覺 Computer and Robot Vision I Chapter2: Binary Machine Vision: Thresholding and Segmentation Instructor: Shih-Shinh Huang 1.
Chapter 9: Morphological Image Processing
Recognition Template Matching Statistical Pattern Recognition (SPR)
Each pixel is 0 or 1, background or foreground Image processing to
Morphological Image Processing Md. Rokanujjaman Assistant Professor Dept of Computer Science and Engineering Rajshahi University.
Tutorial # 10 Morphological Operations I8oZE.
Provides mathematical tools for shape analysis in both binary and grayscale images Chapter 13 – Mathematical Morphology Usages: (i)Image pre-processing.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 9 Morphological Image Processing Chapter 9 Morphological.
Morphology Structural processing of images Image Processing and Computer Vision: 33 Morphological Transformations Set theoretic methods of extracting.
Thresholding Otsu’s Thresholding Method Threshold Detection Methods Optimal Thresholding Multi-Spectral Thresholding 6.2. Edge-based.
Chapter 9 Morphological Image Processing. Preview Morphology: denotes a branch of biology that deals with the form and structure of animals and planets.
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 376b Introduction to Computer Vision 02 / 25 / 2008 Instructor: Michael Eckmann.
Highlights Lecture on the image part (10) Automatic Perception 16
Computer Vision Basics Image Terminology Binary Operations Filtering Edge Operators.
Binary Image Analysis. YOU HAVE TO READ THE BOOK! reminder.
[cvPONG] A 3-D Pong Game Controlled Using Computer Vision Techniques Quan Yu and Chris Wagner.
E.G.M. PetrakisBinary Image Processing1 Binary Image Analysis Segmentation produces homogenous regions –each region has uniform gray-level –each region.
CSE554Binary PicturesSlide 1 CSE 554 Lecture 1: Binary Pictures Fall 2014.
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.
MATHEMATICAL MORPHOLOGY I.INTRODUCTION II.BINARY MORPHOLOGY III.GREY-LEVEL MORPHOLOGY.
Chapter 9.  Mathematical morphology: ◦ A useful tool for extracting image components in the representation of region shape.  Boundaries, skeletons,
CS 376b Introduction to Computer Vision 02 / 22 / 2008 Instructor: Michael Eckmann.
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.
Gianni Ramponi University of Trieste Images © 2002 Gonzalez & Woods Digital Image Processing Chapter 9 Morphological Image.
Image Segmentation & Template Matching Multimedia Signal Processing lecture on Petri Hirvonen.
Image Segmentation and Morphological Processing Digital Image Processing in Life- Science Aviad Baram
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.
Mathematical Morphology Mathematical morphology (matematická morfologie) –A special image analysis discipline based on morphological transformations of.
1 Regions and Binary Images Hao Jiang Computer Science Department Sept. 24, 2009.
DIGITAL IMAGE PROCESSING Instructors: Dr J. Shanbehzadeh Mostafa Mahdijo Mostafa Mahdijo ( J.Shanbehzadeh.
CS654: Digital Image Analysis
Mathematical Morphology
CS654: Digital Image Analysis
Nottingham Image Analysis School, 23 – 25 June NITS Image Segmentation Guoping Qiu School of Computer Science, University of Nottingham
CDS 301 Fall, 2008 Image Visualization Chap. 9 November 11, 2008 Jie Zhang Copyright ©
1 Mathematic Morphology used to extract image components that are useful in the representation and description of region shape, such as boundaries extraction.
Morphological Image Processing Robotics. 2/22/2016Introduction to Machine Vision Remember from Lecture 12: GRAY LEVEL THRESHOLDING Objects Set threshold.
Image Segmentation Nitin Rane. Image Segmentation Introduction Thresholding Region Splitting Region Labeling Statistical Region Description Application.
TOPIC 12 IMAGE SEGMENTATION & MORPHOLOGY. Image segmentation is approached from three different perspectives :. Region detection: each pixel is assigned.
Digital Camera and Computer Vision Laboratory Department of Computer Science and Information Engineering National Taiwan University, Taipei, Taiwan, R.O.C.
Lecture(s) 3-4. Morphological Image Processing. 3/13/20162 Introduction ► ► Morphology: a branch of biology that deals with the form and structure of.
Morphological Image Processing (Chapter 9) CSC 446 Lecturer: Nada ALZaben.
Morphological Image Processing
Lecture z Chapter 10: Image Segmentation. Segmentation approaches 1) Gradient based: How different are pixels? 2) Thresholding: Converts grey-level images.
COMP 9517 Computer Vision Binary Image Analysis 4/15/2018
Digital Image Processing Lecture 15: Morphological Algorithms April 27, 2005 Prof. Charlene Tsai.
图像处理技术讲座(3) Digital Image Processing (3) Basic Image Operations
Digital Image Processing CP-7008 Lecture # 09 Morphological Image Processing Fall 2011.
CSE 554 Lecture 1: Binary Pictures
Game Theoretic Image Segmentation
Binary Image Analysis Gokberk Cinbis
Binary Image Analysis: Part 1 Readings: Chapter 3: 3.1, 3.4, 3.8
Binary Image Analysis used in a variety of applications:
Binary Image Analysis: Part 1 Readings: Chapter 3: 3.1, 3.4, 3.8
CS Digital Image Processing Lecture 5
Binary Image processing بهمن 92
Department of Computer Engineering
ECE 692 – Advanced Topics in Computer Vision
Morphological Operators
DIGITAL IMAGE PROCESSING Elective 3 (5th Sem.)
Binary Image Analysis used in a variety of applications:
Morphological Filters Applications and Extension Morphological Filters
Presentation transcript:

Binary Thresholding Threshold detection Variations Mathematical Morphology Connectivity Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Thresholding Binary thresholding Simple scenes? LUT for all pixels g(i,j) = 1 for f(i,j)  T = 0 for f(i,j) < T Simple scenes? LUT for all grey levels LUT(k) = 1 for k  T = 0 for k < T g(i,j) = LUT( f(i,j) ) Objects of interest vs. background threshold(gray_image,binary_image,threshold, 255,THRESH_BINARY); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Thresholding Distinct foreground & background needed How do we determine the best threshold? Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection Manual Setting Changing lighting Need to determine automatically For the techniques which follow: Image – f(i,j) Histogram – h(g) Probability Distribution – p(g) = h(g) / Σgh(g) Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection – Bimodal Histogram Analysis Anti-mode Smooth histogram? Correct segmentation? Alternatives Ignore high gradients Only consider high gradients Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection – Optimal Thresholding Model as two normal distributions What if they overlap? Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection – Optimal Thresholding Set T(0) = <some initial value>, t = 0 Compute µtB and µtO using T(t) Update the threshold: Set T(t+1) = (µtB + µtO) / 2 Increment t Go back to 2 until: T(t+1) = T(t) Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection – Otsu Thresholding What if its not two normal distributions? Minimize the spread of the pixels… Smallest within class variance Largest between class variance Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Threshold Detection – Otsu Thresholding threshold( gray_image, binary_image, threshold, 255, THRESH_BINARY | THRESH_OTSU ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Variations – Adaptive Thresholding The adaptive thresholding algorithm is Divide the image into sub-images, Compute thresholds for all sub-images, Interpolate thresholds for every point using bilinear interpolation. Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Variations – Adaptive Thresholding OpenCV version: if ((f(i,j) – (Σa=-m..m, b=-m..m f(i+a,j+b) / (2m+1)2)) > offset) g(i,j) = 255 else g(i,j) = 0 adaptiveThreshold( gray_image,binary_image,output_value, ADAPTIVE_THRESH_MEAN_C,THRESH_BINARY, block_size,offset ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Variations – Band Thresholding g(i,j) = 1 for f(i,j)  T1 and f(i,j)  T2 = 0 otherwise Border detector? threshold( image, binary1, low_threshold, 255, THRESH_BINARY ); threshold( image, binary2, high_threshold, 255, THRESH_BINARY_INV ); bitwise_and( binary_image1, binary_image2, band_thresholded_image ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Variations – Semi Thresholding g(i,j) = f(i,j) for f(i,j)  T = 0 otherwise threshold( gray_image, binary_image, threshold, 255, THRESH_BINARY ); bitwise_and( gray_image, binary_image, semi_thresholded_image ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Variations – Multi-Level Thresholding Threshold separately and combine? Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Introduction Based on algebra of non-linear operators operating on object shape Performs many tasks better and more quickly than standard approaches Separate part of image analysis Operates with points sets, their connectivity and shape Main uses: Pre-processing Object structure enhancement Segmentation Description of objects Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Sets Consider images as point sets... Images (Z2, Z3, Z3) Z2: Binary images X = { (1,1), (1,3), (1,4), (1,5), (2,1), (2,2), (3,1), (3,2), (4,1), (4,2) } Z3: Grey scale images Z3: Voxels. Morphological Transformation Ψ(X) Structuring Element Local origin Normally symmetric Applied at all locations in X Dual: Ψ(X) = [Ψ*(Xc)]c Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Dilation Minkowski set addition: X  B = { p  ε2; p = x+b, x  X and b  B } Fills small holes & gulfs ‘Normal’ dilation ? Add all bordering pixels Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Erosion Minkowski set subtraction: X Θ B = { p  ε2; p+b  X for every b  B } Removes noise ‘Normal’ erosion ? Remove all border pixels Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Opening: X  D = (X Θ D)  D Closing: X  D = (X  D) Θ D Isotropic structuring element: Eliminates small image details Properties X  D = (X  D)  D and X  D = (X  D)  D Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – OpenCV Code dilate( binary_image, dilated_image, Mat());; Mat structuring_element( 5, 5, CV_8U, Scalar(1) ); dilate( binary_image, dilated_image, structuring_element); erode( binary_image, eroded_image, Mat()); Mat structuring_element( 5, 5, CV_8U, Scalar(1) ); erode( binary_image, eroded_image, structuring_element); Mat five_by_five_element( 5, 5, CV_8U, Scalar(1) ); morphologyEx( binary_image, opened_image, MORPH_OPEN, five_by_five_element ); morphologyEx( binary_image, closed_image, MORPH_CLOSE, five_by_five_element ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Greyscale / Colour One set per grey level (g) All points >= g… Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Mathematical Morphology – Local maxima Can be used to locate local maxima and minima Mat dilated, thresholded_input, local_maxima, thresholded_8bit; dilate( input, dilated, Mat()); compare( input, dilated, local_maxima, CMP_EQ ); threshold( input, thresholded_input, threshold, 255, THRESH_BINARY ); thresholded_input.convertTo( thresholded_8bit, CV_8U ); bitwise_and( local_maxima, thresholded_8bit, local_maxima ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – Paradoxes Use pixel Adjacency to build contiguous regions Objects Background Holes Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – 4 adjacency & 8 adjacency Have to use either 4-adjacency or 8-adjacency Label each non-zero pixel… Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – What do we actually want? One possibility Treat background using 4-adjacency Treat object using 8-adjacency Treat holes using 4-adjacency Treat objects in holes using 8-adjacency … Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – Connected Components Analysis Search image row by row Label each non-zero pixel If previous pixels are all background Assign New Label Otherwise Pick any label from the previous pixels If any of the other previous pixels have a different label Note equivalence Relabel equivalent labels. Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – Extracting regions vector<vector<Point>> contours; vector<Vec4i> hierarchy; findContours( binary_image, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_NONE ); Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014

Connectivity – Labelling regions for (int contour=0; (contour < contours.size()); contour++) { Scalar colour( rand()&0xFF,rand()&0xFF,rand()&0xFF ); drawContours( contours_image, contours, contour, colour, CV_FILLED, 8, hierarchy ); } Binary Based on A Practical Introduction to Computer Vision with OpenCV by Kenneth Dawson-Howe © Wiley & Sons Inc. 2014