Class OpenCVFitnessFunction

  • All Implemented Interfaces:
    FitnessFunction<org.opencv.core.KeyPoint,​org.opencv.core.Mat>

    public class OpenCVFitnessFunction
    extends Object
    implements FitnessFunction<org.opencv.core.KeyPoint,​org.opencv.core.Mat>

    Implementation of the Fitnessfunction interface which provides metrics for example `SumOfSquareDifferences` to compute the similarity of two images.

    Since:
    1.0
    Author:
    Christoph Praschl
    • Constructor Detail

      • OpenCVFitnessFunction

        public OpenCVFitnessFunction()
    • Method Detail

      • getFitness

        public double getFitness​(ImageWrapper<org.opencv.core.Mat> a,
                                 ImageWrapper<org.opencv.core.Mat> b,
                                 RGBColor dataToIgnore)
        This function is used to calculate similarity of two images.
        Specified by:
        getFitness in interface FitnessFunction<org.opencv.core.KeyPoint,​org.opencv.core.Mat>
        Parameters:
        a - The feature which should be compared with b.
        b - The feature which is used for comparison.
        dataToIgnore - Data which should be ignored fo fitness calculation (e.g. Background color of an image). Can be null. Then no data will be ignored.
        Returns:
        Returns a metrics representing the difference of a and b. (0 = no differences)
      • getFitness

        public double getFitness​(ImageWrapper<org.opencv.core.Mat> a,
                                 ImageWrapper<org.opencv.core.Mat> b)
        This function is used to calculate similarity of two images
        Specified by:
        getFitness in interface FitnessFunction<org.opencv.core.KeyPoint,​org.opencv.core.Mat>
        Parameters:
        a - The image which should be compared with b.
        b - The image which is used for comparison.
        Returns:
        Returns a metrics representing the difference of a and b. (0 = no differences)
      • getFitness

        public double getFitness​(FeatureWrapper<org.opencv.core.KeyPoint> a,
                                 FeatureWrapper<org.opencv.core.KeyPoint> b)
        This function is used to calculate similarity of two features.
        Specified by:
        getFitness in interface FitnessFunction<org.opencv.core.KeyPoint,​org.opencv.core.Mat>
        Parameters:
        a - The feature which should be compared with b.
        b - The feature which is used for comparison.
        Returns:
        Returns a metrics representing the difference of a and b. (0 = no differences)