430 likes | 763 Views
Binary Image Processing. The Computer Vision Lab Prof. Hyung-Il Choi. in the array (computer). Binary image. A binary image Only two gray levels (0 and 1). Note: The number of quantization levels most commonly used: 256 Binary vision system
E N D
Binary Image Processing The Computer Vision Lab Prof. Hyung-Il Choi
in the array (computer) Binary image • A binary image • Only two gray levels (0 and 1). Note: The number of quantization levels most commonly used: 256 • Binary vision system • Uses a threshold to separate objects from the background. - compute geometric & topological properties (features) of objects for a given task. • Faster execution times : most operations can be implemented by logical operations (AND, OR, XOR) instead of integer arithmetic operations. • Small memory requirement. • Practically employed in many industrial situations. (Illumination can be controlled!) object pixels : 1 background : 0
Thresholding (1) • One of the most important problems in a vision system is to identify subimages that represent objects. • Segmentation : partitioning of an image into region (P1,P2,P3,……,.Pk) according to homogeneity. • Each region Pi satisfies a predicate: all points in Pi have some common property • A binary image is obtained using an appropriate segmentation of a gray scale image. (by thresholding gray scale image - either hardwired in cameras or implemented in S/W)
Thresholding (2) • F[i, j] : original gray image, B[i, j] : a resulting binary image (1) For a darker object on lighter background: (2) If known that the object intensity vales are in [T1, T2] • To be effective: - Object & background should have sufficient contrast. - Should know approximate gray levels of either objects or the background. This is known in industrial (controlled) situations.
Geometric properties • Suppose that a thresholding scheme has given us objects in an image. • Recognize & locate objects. • Many applications in industry have utilized simple features of regions for determining the locations of objects and for recognizing them. e.g. size, position, orientation. • Size • will count # pixels of 1.
Position • In industrial applications: Objects usually appear on a known surface, such as a table. The position of the camera is known with respect to the table. • An object’s position in the image determines its spatial location. • center of area (a centroid, center of mass) : first order moment Consider the intensity at a point as the mass at that point. Geometric properties: position (1) : average (mean) of j coordinates of object (1) pixels : average of icoordinates of object (1) pixels
Geometric properties: orientation (1) • Orientation • Define the orientation of an object as the orientation of the axis of elongation. ≡ axis of least second order moment variance(分散) = spread of data ≡ axis of least inertia • The axis of least second moment for an object is the line which gives where rij the perpendicular distance from an object point [i, j] to the line (axis)
Geometric properties: orientation (2) Polar representation of a straight line • Why polar representation instead of y = ax + b ?
The elongation E of the object Geometric properties: orientation (3) Solution: and • The orientation of the axis is given by:
. Compute the coord. mean • Similary for 3D points . Computation of orientation using PCA • PCA (principal component analysis) • Let the coordinate of an object pixel be ① Construct a centered matrix from X. ② Compute the eigenvalue and eigenvector pairs of the covariance matrix. eigenvalue and eigenvector pairs assuming . - : the direction along which the data’s sample variance is the largest. : variance along the direction . - : can be used to define a coordinate system of a particular region.
Projections • Projection of a binary image onto a line: finding the number of 1 pixel that are in lines perpendicular to each bin
1) Start position & lengths of runs of 1’s for each row (1,3) (7,2) (12,4) (17,2) (20,3) (5,13) (19,4) (1,3) (17,6) 2) Only lengths of runs, starting with the length of the 1 run bits at the maximum are needed to represent/store the length of a run With encoding: 3,3,2,3,4,1,2,1,3 : x 9 = 45bits 0,4,13,1,4 : 5 x 5 = 25bits 3,13,6 : 5 x 3 = 15 bits Note: need 22 bits (22 pixels) for each row without encoding. Run-length encoding • Use the lengths of the runs of 1 pixels to represent an image. • run : a set of adjacent pixels that lie on the same row of an image
Binary algorithm: Definition (1) • Definition • Two pixels are 4 neighbors if they share a common boundary. 8 neighbors if they share at least one corner. • A pixel is said to be 4-connected to its 4-neighbors & 8-connected to its 8- neighbors. • path: a sequence of neighboring pixels.
foreground: the set of all 1 pixels in an image, denoted by S. • connectivity: and are connected if there is a path from p and q consisting entirely of pixels of S. • connected component: a set of connected pixels . • background: The set of all connected components of (the complement of S) that have points on the border of an image. all other components of : holes Definition (2)
Connectedness • Projection of a binary image onto a line: finding the number of 1 pixel that are in lines perpendicular to each bin