Class OpenCVSizebasedPositionEvaluator

  • All Implemented Interfaces:
    PositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>, SizebasedPositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>

    public class OpenCVSizebasedPositionEvaluator
    extends Object
    implements SizebasedPositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>

    PositionEvaluator Implementation (based on a AbstractColorbasedObjectDetector<Mat, Point>) which provides functionality to evaluate e.g. the position of an object in the image

    Since:
    1.0
    Author:
    Christoph Praschl
    • Constructor Detail

      • OpenCVSizebasedPositionEvaluator

        public OpenCVSizebasedPositionEvaluator()
    • Method Detail

      • calibrate

        public void calibrate​(ImageWrapper<org.opencv.core.Mat> imageForCalibration)
        Method for calibrating the PositionEvaluator. Needs an image containing the object and a white background.
        Specified by:
        calibrate in interface PositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>
        Parameters:
        imageForCalibration - Image for calibration containing the object on a white background.
      • getPosition

        public Point2Wrapper<org.opencv.core.Point> getPosition​(ImageWrapper<org.opencv.core.Mat> image)
        Method for evaluating e.g. the position of an object in the image (Note: Before using method calibrate())
        Specified by:
        getPosition in interface PositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>
        Parameters:
        image - Image where Object should be found.
        Returns:
        Position of the Object in the image (Position -1/-1 -> no position found)
      • getOffset

        public TranslationOffsetInMM getOffset​(ImageWrapper<org.opencv.core.Mat> ref,
                                               ImageWrapper<org.opencv.core.Mat> current)
        Method for evaluating the offset of an object between two images (Note: Before using method calibrate() and setObjectDimensionInMM() !)
        Specified by:
        getOffset in interface PositionEvaluator<org.opencv.core.Mat,​org.opencv.core.Point>
        Parameters:
        ref - The reference image containing the object
        current - The current image containing the object
        Returns:
        The offset between the object´s position in ref and the object´s position in current