Class PositionComparisonImpl<T,​V>

  • All Implemented Interfaces:
    ObjectComparison<T,​V>

    public class PositionComparisonImpl<T,​V>
    extends Object
    implements ObjectComparison<T,​V>
    Simple comparison class, which allows to compare objects by their current coordinate data. Ignores information regarding other image data.

    If the objects are not the same size, will never reach a similarity of 100%. Uses the size of the bigger object to calculate overlap percentage.

    IMPORTANT: When comparing multiple images, the "closest"-image parameter has to be set with a new object. If it stays null, then returning the closest found object is not possible.

    Since:
    1.0
    Author:
    Christoph Praschl, Andreas Pointner
    • Constructor Detail

      • PositionComparisonImpl

        public PositionComparisonImpl()
    • Method Detail

      • compare

        public double compare​(RecognizedObject<T,​V> object1,
                              RecognizedObject<T,​V> object2)
        Description copied from interface: ObjectComparison
        Compares form of the two objects. Returns how close said objects are using a percent value (e.g. 1.0 = objects are exactly the same).
        Specified by:
        compare in interface ObjectComparison<T,​V>
        Parameters:
        object1 - object to compare
        object2 - object to compare
        Returns:
        percent value how close the objects are to each other
      • findClosest

        public double findClosest​(RecognizedObject<T,​V> compareMe,
                                  List<RecognizedObject<T,​V>> recognizedObjects,
                                  RecognizedObject<T,​V> closest)
        Description copied from interface: ObjectComparison
        Compares one object with a list of other objects. Finds the object, which is closest to the first one and puts it into the "closest" variable. Additionally, returns the percent value of how close the closest found is with the given object.
        Specified by:
        findClosest in interface ObjectComparison<T,​V>
        Parameters:
        compareMe - object to compare with the other objects
        recognizedObjects - list of objects that will be compared to the first object
        closest - closest found object will be put into this variable
        Returns:
        percent value how close the closest object is with the given object