This project is designed to perform rigid alignment of images using various interpolation and similarity methods. The main goal is to align a floating image to a reference image by finding the optimal transformation parameters that minimize the difference between the two images.
The project is organized into the following directories:
- include/: Contains header files for various classes and methods used in the project.
- src/: Contains the implementation of the classes and methods defined in the header files.
- floating.pgm: The floating image that needs to be aligned.
- reference.pgm: The reference image to which the floating image will be aligned.
Interpolation is used to estimate the pixel values at non-integer coordinates during the transformation process. The project includes two interpolation methods:
- InterpolationDefault: Performs bilinear interpolation.
- InterpolationPpv: Performs nearest-neighbor interpolation.
Similarity measures the difference between the reference image and the transformed floating image. The project includes two similarity methods:
- SimilariteDefault: Computes the mean squared error between the reference and transformed images.
- SimilariteMutualInformation: Computes the mutual information between the reference and transformed images.
The transformation class is responsible for applying the rigid transformation to the floating image. The transformation parameters include translation in x and y directions and rotation.
The deformation class applies the transformation to the floating image and uses the specified interpolation method to compute the pixel values of the transformed image.
The optimization process uses the Amoeba method to find the transformation parameters that minimize the similarity measure. The Cout
class computes the cost (similarity) for a given set of transformation parameters.
The main entry point of the project is the main.cpp
file, which performs the following steps:
- Reads the floating and reference images.
- Initializes the interpolation and similarity methods.
- Uses the
Recalage
class to find the optimal transformation parameters. - Applies the transformation to the floating image.
- Writes the transformed image to a file.
To run the project, compile and execute the main.cpp
file. The output will include the optimal transformation parameters and the transformed image saved to a file.
int main() {
Recalage r;
string f = "floating.pgm", fRef = "reference.pgm", fppv = "imageDefPpv.pgm", fDef = "imageDef.pgm";
InterpolationPpv interpppv;
InterpolationDefault interpDef;
SimilariteDefault sim;
cout << "---------------------Interp PPV---------------------" << endl;
VecDoub u = r.getThetaMax(f, fRef, fppv, &sim, &interpppv);
cout << "---------------------Interp Default---------------------" << endl;
u = r.getThetaMax(f, fRef, fDef, &sim, &interpDef);
return 0;
}
- C++ Standard Library
- NR3 library for numerical recipes
Use a C++ compiler to compile the project. Ensure that all source and header files are included in the compilation.
This project is licensed under the MIT License. See the LICENSE file for details.
Hugo PAGÈS, Emma De Faria, Clémence Deviller, Lucile Petronin - 2023 ```