Extraction of Centre of Mass of a Binary Pattern using MATLAB
Extraction of centre of mass of a binary pattern is an important task in pattern recognition area in digital image processing domain. The pattern’s shape and size can be estimated using the radii profile that is computed around the centre of mass. The centre of mass of a binary pattern is computed using the first order moments of the pattern pixel’s Cartesian Coordinates. For all, very firstly the pattern is converted to a binary class i.e. pattern as in black on a white color background or vice versa. Black and white colors are attributed as 0 and 1 respectively (binary form) in digital image processing. In matlab IDE, the image dimensions are taken as row x column. The pixel at (0,0) location is at top left corner of the image.
The binary image pattern (figure-3) is scanned from left to right and top to bottom i.e. in row x column manner. This is also called as raster scan. This task is performed by using the imread() function in matlab. The imread() function enables to have the binary image pattern in row x column matrix of ‘0’ and ‘1’ as black and white pixels. The matrix size is (row x column) i.e. 15x15 as in figure-3.
The centre of mass of the pattern under test is computed using the first order moments of the Cartesian coordinates of the pattern’s pixels i.e. the pixels with black in color or the matrix elements with zero value. The first order moments are computed by using the following equations:
R_CoM= 1/N ∑R_i and C_CoM= 1/N ∑C_i
Where (RCoM, CCoM) are the row and column coordinate of the centre of mass of the pattern under test.
(Ri, Ci) are the ith pixel coordinate of the pattern i.e. matrix elements with zero value, and,
‘N’ is the total no. of pixels on pattern body i.e. no. of matrix elements with zero value.
This article can be viewd in detail in edition of EFY at: 130 July 2017 | Electronics For You