# optimization of Image Reconstruction Algorithm using Genetic Algorithm in Matlab

I'm trying to optimize an image reconstruction algorithm using genetic algorithm.I took initial population size as 10.I have an input image an 10 reconstructed image.fitness function is the difference between these two.That is

fitness_1 = inputimage - reconstructedimage_1;
fitness_2 = inputimage - reconstructedimage_2;
:
:
fitness_10 = inputimage - reconstructedimage_10;


I want to chose the best fitness population among them.But my fitness result is an image(matrix with intensity values).So how can I get a single fitness value for each population for doing crossover in the next stage. Please help.Thanks in advance

• Well, what's a good reconstructed image ? Do you have any measurable way to tell that one image is better reconstructed than an other ? Mar 31 '15 at 9:24

fitness_1 = mean((inputimage(:) - reconstructedimage_1(:)).^2)

though, as your image size won't change, you can ommit the mean and use sum instead.
fitness_1 = sum((inputimage(:) - reconstructedimage_1(:)).^2)