Segmentation. Divide the image into segments. Each segment: Looks uniform Belongs to a single object. Have some uniform attributes. All the pixel related to it are connected. …. Main approaches. Histogram-based segmentation Region-based segmentation Edge detection Region growing
Divide the image into segments.
Belongs to a single object.
Have some uniform attributes.
All the pixel related to it are connected.
Region splitting and merging.
Problem: we are given an image of a paper, and we would like to extract the text from the image.
Thresholding: define a threshold T such that each pixel x,y where I(x,y)<T is “text”.
How do we determine the threshold ?
Just choose 128 as a threshold (problematic for dark images)
Use the median/mean (both are not good, as most of the paper is white)
Compute the gray level histogram of the image.
Find two “clusters”: black and white.
Minimizing the L2 error:
Select initial estimate T
Segment the image using T.
Compute the average gray level of each segment mb,mw
Compute a new threshold value: T = ½ (mb+mw)
Continue until convergence.
We are already familiar with this algorithm !
Many holes and discontinuities in the segmentation.
Changes in the illumination
we do not use spatial information.
Some of the problems can be solved using image processing techniques. For example, we can enhance the result using morphological operations.
Yet – How can we overcome the changes in the illumination ?
Divide the image into sub-images.
Assume that the illumination in each sub-images is constant.
Use a different threshold for each sub-image.
Alternatively – use a running window (and use the threshold of the window only for the central pixel )
Rapid illumination changes.
Regions without text: we can try to recognize that these regions is unimodal.
We would like to use spatial information.
We assume that neighboring pixels tend to belong to the same segment (not always true)
Edge detection: looking for the boundaries of the segments.
Problem: edges usually do not determine close contours. We can try to do it with edge linking (as in Canny’s edge detector)
Let R represent the entire image region.
Segmentation: Partitioning R into n subgroups Ri s.t:
b) is a connected region
P is the partition predicate
Choose a group of points as initial regions.
Expand the regions to neighboring pixels using a heuristic:
Color distance from the neighbors.
The total error in the region (till a certain threshold):
Sum of the differences between neighbors.
Maximal difference from a central pixel.
In some cases, we can also use structural information: the region size and shape.
In this way we can handle regions with a smoothly varying gray level or color.
Question: How do we choose the starting points ? It is less important if we also can merge regions.
In region merging we start with small regions (it can be pixels), and iteratively merge regions which are similar.
In region splitting, we start with the whole image, and split regions which are not uniform.
These methods can be combined. Formally:
Choose a predicate P.
Split into disjoint regions any region Ri for which
Merge any adjacent regions Ri and Rj for which
Stop when no further merging and splitting is possible.
Here, we merge each time the closest neighbors.
– fix cluster centers; allocate points to closest cluster
– fix allocation; compute best cluster centers
Error function =