An Image Automatic Registration Approach Based on Watershed Algorithm

A new image registration method is proposed in this paper. Most microscopic images, such as concrete surface, have not obvious features which most image registration method can depend on. Firstly contours of different color area are extracted automatically with improved watershed algorithm. Then centroid of these contours is used to obtain transformation matrix between two adjacent images. Experiment shows, this method can solve the registration problem in image mosaics very well.


Introduction
The image mosaic is widely used in the fields of aerospace, remote sensing, medicine, industrial inspection, video processing technology, it can combine small images into a bigger one seamlessly.The first thing for image mosaics is to find the coincidence part of the two images, but images often be changed in the collection process such as machinery errors, cameras difference and other factors, all these will led to error coincidence region.Therefore, the image geometric correction is very important.
Geometric transformation can be achieved by the corresponding matrix linear transformation, the important thing is to search the exact match point set within the overlap of the adjacent two images, then the transformation between two images is calculated to get the transformation matrix.
Two image mosaics method are widely used now, the first one is based on template matching algorithm, which select a rectangular area in the images overlap region as a template to search for similar rectangle in the second image, the correlation would determine the best matching position.This algorithm will cost too much CPU time, many studies have proposed to improve this problem, Zhong proposed a two-pixel ratio template matching method [1], but these methods still cannot solve the problem of the image rotation and scaling.
Another kind of algorithm is based on the image feature matching, Zhang proposed a method based on feature points matching [2].This method take advantages of the SIFT algorithm to automatically select the image extreme points as the match point.The registration algorithm has the advantage of small computation cost, high accuracy, it cannot be used in the images without sharp edge.Zhang [3] select the feature points from contour edge, it can accelerate the algorithm, but is still not suitable for the image without obvious contour or the image with much noise.
The surface of concrete specimens appears a large number of blocks of different color in the image for the different colors of the different components of cement, meanwhile the edges of these color blocks are not clear and unable to extract the contour feature points.In this paper, we introduce a new algorithm to solve problems like this, it base on the image contour feature of the catchment basin to avoid the difficulties caused by fuzzy edge.

Main Idea of Image Registration based on Contour Centroid
The main idea of our algorithm is, the contour centroids of the color block in the concrete specimens will be selected as the registration sample point set, then we can obtain the adjacent two transform matrices.During the course of image shooting, mechanical gear will cause dislocation, pan, rotate, we cannot extract obvious contour to match the reference point.If we select two images with overlapping regions, the registration would be achieved by the following steps: I. Color segmentation First define a rule for select extreme points, for example, select the notable color point, then we can find a number of catchment basins in the images by means of watershed algorithm; II. Contour matching In this step, we select the appropriate size contour which do not include the boundary points as registration contour, and record the color values of these catchment basins.The contour features and color value are used for accurate matching in the image registration; III.Transformation matrix computing this centroid points set is used to obtain the transformation matrix, then we can complish image registration by means of the matrix.

Improved Image Watershed Segmentation Algorithm
The watershed segmentation algorithm is a kind of mathematical morphology segmentation method based on the topological theory, which take the gray value of each pixel in the image as the altitude of the point, each local minimum point and its influenced area is called catchment basins, the boundary of the basin is called watershed.The watershed method use local minimum value as the seed point.In this local area the watershed method have the same result as the fix-range water filling algorithm.
Define src(x, y) denoted the value of the pixel on coordinate x and y, Diff and Diff denoted the negative difference and positive difference.
According to the fix-range water filling algorithm, if the neighbor pixel meet the condition: src(seed.x, seed.y) − Diff ≤ src(x.y) ≤ src(seed.x, seed.y) + Diff This pixel is belongs to the area connected with the seed points.Mark this point in the mask matrix to avoid overlap between two filling areas.
If we set Diff ≥ src(seed.x, seed.y) and threshold = Diff + src(seed.x, seed.y), we will get a catchment basins whose altitude is threshold..The confluence of the two filling area, can be defined as watershed.
Thus we can use flood filling method to simplify the iterative mark process of watershed algorithm.Fg.1 shows the steps to extract contours.

Fg.1 Extracts the contours
The significant color pixels are chosen as extreme value point, then invert the image, process it with the flood fill algorithm.
The parameters of the flood fill algorithm would decide the scope of the connectivity area.The negative difference and positive difference can be set manually or by means of Otsu's method.

Advanced Engineering Forum Vols. 6-7
Recording the feature of the contours and the seed point's color, we can process the accurate matching of the contours in next step.

Contours Matching
It is important to choose correct characteristic for the matching of the two images.Contour has many features, such as area, perimeter, the maximum and minimum between edge and center of mass, color and so on.
Do contour matching to the images that respectively extracted from the reference images and matching images, it need to choose the suitable contour features.Under the same condition of camera and light, the matching contour color will be changed slightly.It can be calculated by the vector distance between Color (r, g, b) and Color " (r, g, b),as Eq.1 WhenDistance Among Eq.2 area : means contour area, arc : means contour length, width : and height : on behalf of width and height of the contour's minimum enclosing rectangle.α + β + γ + δ = 1 .They represented the contour feature weighting coefficients respectively.In order to limit the scope of the changes and eliminate the influence caused by contour size, each feature was normalized.
The matching process is followed: (1)First, extract contour features respectively from the two images, then record the feature and color value for each contour (2)Choose a contour from the record of benchmark image contours to match the color value with all of the matching images contour that recorded before.Then calculate the difference of the contours which meet the requirement of initial color matching according to the second formula.Select the contour with smallest differences record the difference , write it to the matching sequence.
(3)Check the benchmark contours if there still have some contours that not matched.The unmatched contours will switch to (2), until all of the reference image contour are processed.
(4)Choose at least three pairs matched contours according to the difference value from the matching sequence.Take the coordinate of centroid of matched contours as sample to calculate the transformation matrix .
(5)Match images with the transformation matrix.
It improved the matching accuracy by adding the color to the match algorithm as the primary features.It greatly reduced the times of calculation between contours, improved the efficiency of the algorithm.Also, by keeping the different value of contour matching, it can eliminate mismatch and thereby increase robust of the algorithm.

Transformation Matrix
Geometric transformation of the image can be obtained by The homogeneous coordinates matrix multiply the corresponding transformation matrix.Refer with: Eq. 3 Parameters m 8 in the parameters matrix is used to realize the proportional transformation of the image.Its value is set to be 1 in many literature, then the rest of the eight parameters were used to describe transformation relationship of the image.This is known as 8 parameter model.In the model Information Technology for Manufacturing Systems III O m E m m F m G P can realize scale and rotation Angle of transformations of the image, and m 2 and m 5 are used to realize horizontal and vertical direction of movement, m 6 and m 7 can cause image horizontal and vertical direction of the deformation.In most time, the differences in shooting position and angle always cause translation, rotation and affine transformation.If ignore the parameters m 6 and m 7 , we get the Eq.4: If substitute the coordinates of the match point into the Eg.4,we can get the transformation parameters.

The experimental results and analysis
In this paper, we use two concrete surface color images to test the method, which resolution is 550*440 pixels.An image as the reference image, take another as the image to be matched.After the processing of the improved watershed algorithm, formed two of color connected area image.The result is shown in Fig. 2 Fig. 2 The reference image and the image to be matched, contour image after watershed algorithm We can see the corresponding color piece translated and rotated from the two images.We only calculated the contours which area is large enough.The contour feature, color and difference value are listed in the table 1.
Advanced Engineering Forum Vols.6-7 Set α = 0.3，β = 0.3，γ = 0.2，δ = 0.2 .We simply evaluate the integer values of the coordinates, other data take a decimal point.So the calculation results have a slight errors.
By comparing the color and the minimal difference values of the corresponding contours, we get the best corresponding contours, shown in the Fig. 5: Fig. 5 The result image after the contours matching We selected three pair of data which have the minimum difference values and put into the Eg.4, and then got the Eg.5: Q 0.954719x + 0.176480y − 82.6518 = x @ −0.024x + 0.984y − 13.6 = y @ (5) Use the Eg.5 to make the geometric transformation of the image, the result of image registration is acceptable.

Conclusion
In the engineering of microscopic image, each image is related to a small area of the sample, image registration is very important for the image mosaics.In this paper, we introduce a new registration method, with the sample of the concrete microscopic images, the main innovation of this paper are: I.For the fuzzy boundary of the color block in the images, choose the watershed algorithm to achieve color segmentation; II.Since color contour have not feature points, choose color center of color block as the calibration parameters, choose multiple color centroid to computing transform matrix; III.This method has strong flexibility.Based on statistical method, it will not be impacted by translation, rotation, scaling and other geometric distortion, can achieve a higher registration accuracy.
Experiment results show that the proposed automatic registration method has higher accuracy and efficiency and robustness.How to automatically set the threshold requires further study.

Table . 1
Corresponding contours feature and difference value