Skip to main content
. 2025 Jun 8;25(12):3608. doi: 10.3390/s25123608
Algorithm 1: Improved Genetic Algorithm
Input:
population_size = 100; max_generations = 50; mutation_rate = 0.1; crossover_rate = 0.8; trans_x_offset = 30; trans_y_offset = 10; angle = 0; angle_offset = 5.
Output:
The best transformation parameters.
1. If The area of the current image>0.4,
2. Template = select the most recent image with area greater than 0.8;
3. Else Template = the next frame;
4. End.
5. Based on Equation (2), calculate the relative displacement of the centroids of the current image and the template to obtain the relative displacement values: trans_x, trans_y.
6. Set initialization parameters and initialize the population based on the initial parameters:
7. trans_x_range = [trans_x − trans_x_offset, trans_x + trans_x_offset];
8. trans_y_range = [trans_y − trans_y_offset, trans_y + trans_y_offset];
9. angle_range = [angle − angle_offset, angle + angle_offset];
10. While (the number of iterations max_generations)
11. Initialize the population.
10. For each individual, calculate the fitness according to Equation (3).
11. In each generation:
12. Tournament selection involves selecting the individual with high fitness as the parent.
13. Generate new offspring through two-point crossover and site mutation [24,39].
14. Perform elitism to ensure the best individuals are preserved.
15. end while
16. output the fitness of these solutions.