Binary Image
Binary Image
Roadmap
Binary Image Processing Thresholding Geometric Properties Run-Length Encoding Binary Algorithms Morphological Operators Applications
Binary Image
Segmentation
Segmentation: The partitioning of an image into regions is called segmentation
Thresholding
Thresholding: Is a method to convert a Gray Scale Image into a Binary Image, so that objects of interest are separated from the background.
Example of Thresholding
Original
Geometric properties
Size Position Orientation Projection
Size
Size: summation of all
pixel values or the number of pixels of the object.
0 0 0 0
0 1 1 0
0 1 1 0
0 0 0 0
Size = 4
Projection:
1. 2. 3.
Using start position and length of 1s for each row. Using length of runs, starting with the length of the 1 run for each row.
2.
4,5,5,3 0,4,6,5,2
Binary Algorithms
Before discussing Binary Algorithms, we first need to define some related terms. Neighbors Path Foreground Background Connectivity Connected Components Boundary Interior Surrounds
Neighborhood
A pixel has a common boundary with four pixels and shares a corner with four additional pixels. 4-neighbors: Two pixels are 4-neighbors if they share a common boundary. 8-neighbors: Two pixels are 8-neighbors if they share at least one corner.
Path
A path from the pixel at [i ] is a sequence of pixel indices [i0,j0],[i1,j1],[in,jn] such that the pixel at [ik,jk] is neighbor of the pixel at [ik+1,jk+1] for all k with 0 < k < n-1 . According to the above definition we will have to different paths: 1. 4-path : using 4-connection 2. 8-path : using 8-connection
0,j0
(a) 4-path
(b) 8-path
1 1 1
If we consider 4-connectedness for both foreground and background, there are four Objects that are 1 pixel in size and there is no hole. But, if we use 8-connectedness, then there is one object and no hole. So to avoid this awkward situations, if we use 8-connectedness for foreground, then 4-connecteness should be used for background.
Connectivity
A pixel p S is said to be connected to q S if there is a path from p to q consisting entirely of pixels of S. For any three pixels p,q and r in S, we have: 1. Pixel p is connected to p (reflexivity). 2. If p is connected to q, then q is connected to p (commutativity). 3. If p is connected to q and q is connected to r, then p is connected to r (transitivity).
Example of connectivity
Original image
Components Labeling
To find connected components in an image. The points in a connected components form a region that represent an object. Require the characteristics of the components (size, position, orientation and )
Original image
Recursive algorithm
Scan the image to find an unlabeled 1 pixel and assign it a new label L. 2. Recursively assign a label L to all its 1 neighbors. 3. Stop if there are no more unlabeled 1 pixel. 4. Go to step 1.
1.
Sequential algorithm
1- Scan the image left to right, top to bottom 2- If this pixel is one
(a) if only one of its upper and left neighbors has a label, then copy the label (b) If both have the same label, then copy the label. (c) If both have different labels, then copy the uppers label and enter the labels in the equivalence table as equivalent labels (d) Otherwise assign a new label to this pixel and enter this label in the equivalence table.
3- If there are more pixels to consider, then go to step 2. 4- Find the lowest label for each equivalent set in the equivalence table. 5- Scan the picture. Replace each label by the lowest label in its equivalent table.
Size filtering
If we know that objects of interest are of size greater than T0 , then we can use size filter to remove noise after component labeling. In this case all components below T0 in size are removed by changing the corresponding pixels to 0.
Euler number
E (Euler No.) used as a feature of an object. E= C H Where C = number of connected components (objects) and H = number of Holes. E is invariant to translation, rotation and scaling. (fixed feature of an object)
Distance measure
Euclidean 2. City-block 3. Chessboard The city-block and chessboard measure are preferred over Euclidean due to their simplicity of calculation. Euclidean distance is closest to the continue case, but it is computationally the most expensive.
1.
Distance transform
Representing an image in terms of distance. It is useful in character recognition. It can calculated by using a parallel iterative algorithm
Measure the path between the pixels based on a 4-connected neighborhood. Pixels whose edges touch are 1 unit apart. Pixels diagnally touching are 2 units apart.
Measure the path between the pixels based on an 8-connected neighborhood. Pixels whose edges or corners touch are 1 unit apart.
Example
Skeletonization
Thinning
Thinning is an image processing operation in which binary-valued image regions are reduced to lines that approximate their center lines. Also called as skeleton or core Reduce image components to their essential information
Thinning requirements
1. 2. 3. 4. 5.
Connected image regions must thin to connected line structures. The thinned result should be minimally 8connected. Approximate endline location should be maintained. The thinning results should approximate the medial lines. Short branches caused by thinning should be minimized.
Example of Thinning
Threshold = 60
An example of expanding and shrinking operations on the letter s Left: the original image Middle: Expanded image Right: Shrunken
References (books)
Machine Vision (Ramesh Jain, Rangachar Kasturi, Brian G.
Schunck)
References (Web)
http://bruce.cs.cf.ac.uk/bruce/Machine_vision_tutorial/Bin ary_image_processing.html University of North Dakota, Department of Computer Science, computer vision website http://www.machinevisiononline.org/public/articles/archiv edetails.cfm?id=1396 Computer Engineering Department, Ko University (course website)