2. Explain Binary Image processing
Answer:
Binary Image Processing
Binary image processing focuses on manipulating images with only two possible pixel values: typically 0 (black) and 1 (white). These images usually result from a thresholding operation applied to grayscale or color images:

This step is common in applications like optical character recognition (OCR), where scanned grayscale documents are binarized for further analysis.
1. Morphological Operations
Morphological operations alter the structure or shape of binary objects using a structuring element. These operations can dilate, erode, or otherwise transform shapes in the image.
Let:


- Dilation expands white regions (foreground)
- Erosion shrinks them
- Opening removes small objects
- Closing fills small holes
2. Distance Transforms
The distance transform computes the distance from each pixel to the nearest background pixel (0). It is useful for shape analysis, alignment, skeletonization, etc.
Let:


- Forward pass: Uses distances from north and west neighbors
- Backward pass: Combines with south and east neighbors
- Result: Efficient city-block distance calculation
The Euclidean distance transform is more complex and stores vector distances for accuracy. This transform is also called:
- Grassfire Transform: Like a fire spreading from 1’s
- Chamfer Transform: Used in template matching
- Medial Axis Transform (MAT): Extracts skeleton
3. Signed Distance Transform
This computes distances to boundaries for all pixels, including both foreground and background.
Construction:
- Compute distance transform for original and its complement
- Negate one, then combine
Signed distance transforms can be compressed using splines on quadtrees/octrees and are essential for:
- 2D/3D surface alignment
- Level-set evolution
- Efficient merging of shapes
4. Connected Components
A connected component is a group of adjacent pixels with the same label (usually 1).
Adjacency Types:
- N4 (4-neighbor): Horizontal & vertical
- N8 (8-neighbor): Also includes diagonals
Used in:
- Object counting
- Text segmentation
- Cell analysis in bioimaging
Region Properties After Labeling:
- Area: Number of pixels
- Perimeter: Boundary pixels
- Centroid: Average (x, y)
- Second Moments (for shape analysis):

Eigenvalue decomposition of MMM gives orientation and major/minor axis lengths.