Research on Fundus Image Mosaic Method Based on Genetic Algorithm

Retinal image mosaic is the key to detect common diseases, and the existing image mosaic methods are difficult to solve the problems of low contrast of fundus images and geometric distortion between images in different fields of view. To solve the problem of noise in retinal fundus images, an image mosaic algorithm based on the genetic algorithm was proposed. Firstly, a series of morphological pretreatment was performed on the fundus images. )en, the vascular network is extracted by obtaining the maximum entropy of the image to determine the threshold value.)e similarity of the image to be spliced is a feature, and the genetic algorithm is used to solve the optimal parameters to achieve the maximum similarity. By smoothing the image, a clear image with minimum noise is obtained. Experimental results show that the proposed algorithm can effectively realize the image mosaic of the fundus. )e method proposed in this paper can provide support for high-precision automatic stitching of multiple single-mode color fundus images.


Introduction
Retinal fundus images are often used as an important basis for judging fundus diseases and systemic diseases. is is because fundus diseases and systemic diseases can cause certain fundus changes and appear in different retinal blood vessels on the retina of the fundus [1,2]. However, due to limitations of fundus photography techniques, the fundus images obtained tend to have small angles and narrow fields of view. Clinical doctors often compare and analyze multiple fundus images. It is very necessary to multiple image mosaic to help doctors obtain more accurate and complete fundus image information [3][4][5][6].
e synthesized large image is more complete and has higher resolution than the small image. Since different small image acquisition devices are different and the scenes are different, there are problems in various aspects such as the division ratio, the color difference, and the angle. ese problems lead to significant differences in the human structure presented in the image. erefore, the image must be properly processed to achieve the purpose of image mosaic.
For image mosaic, domestic and foreign scholars have done a lot of research, and a variety of image registration methods based on various features are proposed. eoretical support for the efficient image mosaic is provided [7].
Representative methods proposed by scholars include the automatic splicing method based on vessel branching and crossover features [8,9]. An algorithm is proposed that utilizes features such as retinal branches and intersections and then performs automatic mosaic and target tracking [10]. Most of these traditional methods adopt the method based on feature correspondence. e image registration is completed by extracting feature points. However, the registration effect is closely related to the pretreatment effect, so there are still some problems in the practical application [11,12].
In this paper, a new method of automatic fundus image mosaic is proposed, which is based on a large number of studies at home and abroad. is method firstly carries on the morphological treatment to the image of the fundus and sets the threshold value to extract the retinal vessels. en, the genetic algorithm is used to obtain the registration parameters on the binary segmentation images of blood vessels. Finally, image registration and image mosaic are realized.

Fundus Image Feature Point Detection and Registration.
Feature point matching is a key step in image registration, and its matching accuracy determines the final registration result. At present, the classical feature detection methods are SIFT algorithm and SURF algorithm [13][14][15]. SIFT feature is an image local feature description operator based on scale space proposed by Lowe [16], which remains invariant to image scaling, rotation, and affine transformation. e basic idea is to detect feature points by establishing Gaussian difference scale space, determine the location and scale of feature points, then use the main direction of the neighborhood gradient of the feature point as the direction feature, and generate a 128-dimensional feature descriptor as the matching basis. e SIFT method is used to purify feature points; feature descriptors with scale invariance, rotation invariance, and affine invariance are generated for each feature point; the feature descriptor can match the feature points of adjacent images with high quality. e superior performance of the SIFT feature extraction algorithm determines that it will become the best choice. Like other methods, it will not be limited by the influence of different shooting equipment or viewing angle change. Image distortion, translation, and scaling can be well solved for it. e high dimension of the descriptor is a disadvantage of SIFT in the matching step. For real-time applications on ordinary PC, the three stages of detection, description, and matching are faster. e SURF algorithm is similar to the SIFT method, but its feature descriptor has only 64 dimensions and is much faster. e SURF algorithm is an accelerated and improved version of the SIFT algorithm. e Hessian matrix using the SURF algorithm can greatly improve the matching speed. At the same time, any matching algorithm can improve the speed by reducing the dimension of descriptors. e steps of the SURF algorithm are mainly divided into constructing Hessian matrix, constructing scale space, feature point location, feature point main direction allocation, and generating descriptor.
How to select the feature extraction algorithm has its own criteria. e first point is that the number of feature points should not be too large, the distribution should be uniform, and the distribution of feature points should not be too dense; otherwise, too many feature points will slow down the calculation speed. e second point is that you cannot select only one point as the feature point; otherwise, it will lead to large deviation. e third is that shooting an image will lead to the change of angle and the distance of image viewing angle.
e feature points we select should not change with these deformation or scaling; that is, stability is required.
Generally, the objects we get are small images obtained from different perspectives or shooting backgrounds, and they are all about the same object or scene [17,18]. e operation of transforming these images to the same coordinate system and then matching is called image registration. is operation needs to calculate the function data required for image transformation, and it can also be used to find similar parts in two images. In the process of image registration, first the part of the object to be registered is determined, the overlapping area is framed, a feature point extraction method is selected using the abovementioned method, the feature points are selected and calculated, and then they are used for registration. e accuracy and registration effect of image registration technology directly affect the information accuracy and visual effect of the final image. At present, the feature-based image registration method is widely used, but this method only uses a small part of image gray information. In case of errors in the process of feature extraction and feature matching, the final result will also be misguided. erefore, the results of this method largely depend on the extraction accuracy of feature points and the accuracy of feature point matching.

Fundus Image Mosaic Method.
After multiple images are changed to the same base map by the fixed method, the similar parts are combined, the size and deformation are adjusted, and the image is merged into one image according to the relative position. e image contains all the above information, and this operation is called image fusion [19,20]. Image fusion is used to process the transition region in image mosaic, which mainly solves the following two problems: firstly, the brightness or color of several images to be processed is different, which will produce uneven phenomenon of the fused image and greatly affect the final result. Secondly, due to the geometric aberration caused by the change of viewing angle and shooting with different equipment, ghosting will occur during fusion. e commonly used image fusion methods are direct average method, weighted average method, median filter method, multiresolution analysis method, and so on. e improved weighted average method is adopted in this paper. After converting multiple images to the same coordinate system, the registration between images is completed, and their transformation matrix is obtained [21,22]. e improved weighted average algorithm is used to fuse different retinal images, and then the median filtering method is used to eliminate the discontinuity of light intensity so that the stitching pattern looks more natural. In this way, the part with abnormal brightness on the edge of the overlapping area is solved. e basic process of image mosaic is shown in Figure 1.

Smooth Filer.
e edge and other high frequency components of the image can be filtered by smooth filter without changing the low frequency components so that the gray changes of the image become smooth. Due to the linear characteristics of blood vessels [23,24], the image is smoothed by using linear structural elements whose length is close to the maximum diameter of the blood vessels.
According to the size of vascular width in the image to be spliced, structural elements of size 1 × c are selected. e image is divided into 12 directions at an angle of 15°. e original image is separately processed in each direction by structural elements, and the maximum value of the results in twelve directions is solved. e maximum value is denoted by the new image grayscale, and the obtained smooth image is S op . e formula is as follows: where L is a structural element, S 0 is the original image, S is the computed image, S op is the smoothed image, C is the neighborhood radius, and d is the number of operations, and its value can be determined experimentally.

Image Enhancement.
e smoothed filtered image has a smoother grayscale. e contrast between the vascular features and the background is low, which is not conducive to subsequent registration and splicing. erefore, the processed image needs to be further enhanced. e vascular image conforms to the morphological features, and the Top-Hat operation in morphology is an effective high-pass filter [25]. By filtering out areas of the image where the grayscale changes relatively smoothly, selecting the vascular elements in the retinal image allows the blood vessels to be extracted from the entire image. e Gaussian filter operator smoothes the extracted vascular elements, and the Laplacian enhances the edge of the blood vessels.
ese two filter operators are classically effective operators in image enhancement. erefore, these three operators are used for image enhancement in the image enhancement process of this paper.
In order to make the contrast between the blood vessel and the background in the image larger, this paper accumulates the corresponding results in 12 directions after performing Top-Hat operation on the image. After the enhancement of the method, the retinal vascular network is substantially separated from the background, and the vascular network can be obtained by directly dividing the image S 1 by threshold.

reshold Segmentation.
In this paper, the concept of entropy in information theory is applied to image segmentation. e fundamental purpose is to select an appropriate threshold to ensure the successful separation of blood vessels from the background and to ensure that the information volume of both the blood vessel image and the background image is maximum.
If the gray level of the image to be spliced is M, the posterior probability is expressed as follows: where N 2 is the total number of pixels in the image and n i is the number of pixels whose gray level is i. Let the threshold be s, and set the gray level of the image as two groups, respectively, as A and B.
e entropy of the whole image is expressed as follows: where Z s � s i�1 p i and s is the threshold, which makes H(s) reach the maximum value. is threshold is used to segment the image.

Feature Value Selection.
For the registration of the fundus image, an alignment method based on feature correspondence is adopted. And the blood vessel information of the retina is extracted as a feature for registration. In this paper, the vascular network characteristics in the image will be used as the registration feature. e essence of image registration is to find a spatial transformation so that the similarity of the two images is maximized after the transformation. According to the form of transformation, general registration transformation models include affine transformation, nonlinear transformation, and projection transformation. In the registration process, different transformation models are selected, and the mapping relationship obtained is also different. In order to overcome the problem of image scale deformation caused by image rotation or movement, the bilinear transformation is used in this paper. e definition is shown as follows:

Advances in Multimedia
x ′ � a 0 + a 1 x + a 2 y + a 3 xy, where a i and b i (i � 0, 1, 2, 3) are the transformation parameters. Preprocessed by the images mentioned above, binary images I 0 ′ and I 1 ′ can be obtained. e registration of the target images I 0 and I 1 is translated into registration of the images I 0 ′ and I 1 ′ . e introduction of the parameter ϕ represents the similarity measure of the two images. erefore, the registration of the image is expressed as follows: where T is a spatial transformation. After determining the spatial transformation type and similarity measure, the registration process is to seek an optimal T value to maximize the image similarity measure. e optimal T value can be expressed as follows:

Genetic Algorithm for Obtaining Registration Parameters.
In order to ensure the maximum image overlap area, the genetic algorithm is chosen to solve the problem. e genetic algorithm is a global optimization algorithm, which can effectively avoid the problem of falling into local optimal solution. It is an efficient and parallel search method for solving problems. To find image registration parameters, it usually requires solving the problems of establishment of fitness function. Under the premise of binary value, the corresponding correlation value is valid only when the corresponding pixel is a natural number. erefore, for the image registration of the retina, the objective function defined by equation (6) is the fitness function of this paper.
Choosing the appropriate operator can accumulate good performance in the population and obtain more perfect individuals. It can be ensured that the excellent individuals have a greater chance to pass on the good performance to their offspring. In this paper, the method of single-point crossing is adopted. e steps can be expressed as selected intersection⟶cross oper-ation⟶interchange operation⟶effect proofreading. e mutation operator is used to generate new individuals whose operation is to randomly determine the experimental individual. According to the above principles, determine the orientation of the mutation and then carry out correlation coding and value processing.

Image Mosaicing.
e image registration method was determined in the previous section and achieved good results. Image registration solves the problem of positional differences between different images, but it does not change the difference in brightness or chromaticity between images. Because the brightness of different images is different or the edge distortion is caused by the collection environment, the image is not suitable for direct splicing. In order to avoid the obvious mosaic marks caused by the image's own shooting factors, the overlapping areas of the image need to be smoothed. In this paper, the following formula is used to smooth the image: where d is the width of the overlap region when the leftmost end of the image overlap region is the coordinate zero point.

Experiments and Results
In this paper, a gene population with the chromosome number of 50 is selected. e code length of a single individual is 54. e probability of crossover and mutation is 1.0 and 0.01, respectively, and the number of iterations is N � 100. When realizing multiple image registration, first take the fundus image in front of each group of images as the reference image, register with any other image according to the above steps, take the result image as the reference image, and then register with the third image until the final result is obtained. In the registration process, there are no specific requirements for the splicing sequence of other images except that the front image is taken as the reference image during the first splicing.
In order to quantitatively analyze the registration accuracy of fundus images, this paper uses the root mean square error (RMSE) and mean absolute error (MAE) between all feature point pairs that are accurately matched and transformed as the evaluation indexes [26,27], which are defined as follows: where (x k , y k ) is the matching point of the reference image, (x k ′ , y k ′ ) is the corresponding matching point of the target image after coordinate transformation, and n is the logarithm of matching points. In order to illustrate the effectiveness of this method, ten groups of color fundus images are tested by the methods of literatures [14] and [17,21], respectively. e RMSE and MAE between matched feature point pairs are calculated and compared with this method. e comparison results are shown in Table 1. In order to further illustrate the effectiveness of this method as a whole, this method is compared with the methods in literatures [14] and [17,21], and the correct registration logarithm RMSE of any two images in the same group is used as the evaluation criteria.
It can be seen from Table 2 that the method in this paper has the best registration result and strong registration ability and can be applied to multiple image stitching.

Conclusion
Aiming at the problems of time-consuming and large amount of calculation in the existing retinal image mosaic technology, a fundus image mosaic method based on the   Advances in Multimedia 5 genetic algorithm is proposed in this paper. e fundus image mosaic algorithm proposed in this paper performs a series of preprocessing on the image, and it combines the maximum entropy theory to extract the retinal network to obtain a binary image. In the image registration stage, the common vascular bifurcation points and intersections are discarded. e similarity of vascular network is used as the registration feature, and the optimal parameters of registration are obtained by the genetic algorithm. e experimental results showed that the proposed algorithm can effectively achieve the splicing of fundus images and eliminate the seams generated in the splicing to some extent. Aiming at the problem of low contrast of fundus image, the algorithm adjusts the threshold of the algorithm and improves the purification process after feature point matching. It not only overcomes the shortcomings of other methods but also realizes the fast and high-precision automatic stitching of fundus images. In the fundus image fusion algorithm, we need to further find and explore a suitable improvement method to improve the fusion effect, reduce the calculation fusion time, and improve the fusion efficiency [28,29].
Data Availability e labeled dataset used to support the findings of this study is available from the corresponding author upon request.

Conflicts of Interest
e author declares that there are no conflicts of interest.