Class Objdetect


  • public class Objdetect
    extends java.lang.Object
    • Constructor Detail

      • Objdetect

        public Objdetect()
    • Method Detail

      • groupRectangles

        public static void groupRectangles​(MatOfRect rectList,
                                           MatOfInt weights,
                                           int groupThreshold,
                                           double eps)
      • groupRectangles

        public static void groupRectangles​(MatOfRect rectList,
                                           MatOfInt weights,
                                           int groupThreshold)
      • drawDetectedMarkers

        public static void drawDetectedMarkers​(Mat image,
                                               java.util.List<Mat> corners,
                                               Mat ids,
                                               Scalar borderColor)
        Draw detected markers in image
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        corners - positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
        ids - vector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted.
        borderColor - color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • drawDetectedMarkers

        public static void drawDetectedMarkers​(Mat image,
                                               java.util.List<Mat> corners,
                                               Mat ids)
        Draw detected markers in image
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        corners - positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
        ids - vector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • drawDetectedMarkers

        public static void drawDetectedMarkers​(Mat image,
                                               java.util.List<Mat> corners)
        Draw detected markers in image
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        corners - positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • generateImageMarker

        public static void generateImageMarker​(Dictionary dictionary,
                                               int id,
                                               int sidePixels,
                                               Mat img,
                                               int borderBits)
        Generate a canonical marker image
        Parameters:
        dictionary - dictionary of markers indicating the type of markers
        id - identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
        sidePixels - size of the image in pixels
        img - output image with the marker
        borderBits - width of the marker border. This function returns a marker image in its canonical form (i.e. ready to be printed)
      • generateImageMarker

        public static void generateImageMarker​(Dictionary dictionary,
                                               int id,
                                               int sidePixels,
                                               Mat img)
        Generate a canonical marker image
        Parameters:
        dictionary - dictionary of markers indicating the type of markers
        id - identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.
        sidePixels - size of the image in pixels
        img - output image with the marker This function returns a marker image in its canonical form (i.e. ready to be printed)
      • drawDetectedCornersCharuco

        public static void drawDetectedCornersCharuco​(Mat image,
                                                      Mat charucoCorners,
                                                      Mat charucoIds,
                                                      Scalar cornerColor)
        Draws a set of Charuco corners
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        charucoCorners - vector of detected charuco corners
        charucoIds - list of identifiers for each corner in charucoCorners
        cornerColor - color of the square surrounding each corner This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
      • drawDetectedCornersCharuco

        public static void drawDetectedCornersCharuco​(Mat image,
                                                      Mat charucoCorners,
                                                      Mat charucoIds)
        Draws a set of Charuco corners
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        charucoCorners - vector of detected charuco corners
        charucoIds - list of identifiers for each corner in charucoCorners This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
      • drawDetectedCornersCharuco

        public static void drawDetectedCornersCharuco​(Mat image,
                                                      Mat charucoCorners)
        Draws a set of Charuco corners
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        charucoCorners - vector of detected charuco corners This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
      • drawDetectedDiamonds

        public static void drawDetectedDiamonds​(Mat image,
                                                java.util.List<Mat> diamondCorners,
                                                Mat diamondIds,
                                                Scalar borderColor)
        Draw a set of detected ChArUco Diamond markers
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        diamondCorners - positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
        diamondIds - vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted.
        borderColor - color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • drawDetectedDiamonds

        public static void drawDetectedDiamonds​(Mat image,
                                                java.util.List<Mat> diamondCorners,
                                                Mat diamondIds)
        Draw a set of detected ChArUco Diamond markers
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        diamondCorners - positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.
        diamondIds - vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • drawDetectedDiamonds

        public static void drawDetectedDiamonds​(Mat image,
                                                java.util.List<Mat> diamondCorners)
        Draw a set of detected ChArUco Diamond markers
        Parameters:
        image - input/output image. It must have 1 or 3 channels. The number of channels is not altered.
        diamondCorners - positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
      • getPredefinedDictionary

        public static Dictionary getPredefinedDictionary​(int dict)
        Returns one of the predefined dictionaries referenced by DICT_*.
        Parameters:
        dict - automatically generated
        Returns:
        automatically generated
      • extendDictionary

        public static Dictionary extendDictionary​(int nMarkers,
                                                  int markerSize,
                                                  Dictionary baseDictionary,
                                                  int randomSeed)
        Extend base dictionary by new nMarkers
        Parameters:
        nMarkers - number of markers in the dictionary
        markerSize - number of bits per dimension of each markers
        baseDictionary - Include the markers in this dictionary at the beginning (optional)
        randomSeed - a user supplied seed for theRNG() This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
        Returns:
        automatically generated
      • extendDictionary

        public static Dictionary extendDictionary​(int nMarkers,
                                                  int markerSize,
                                                  Dictionary baseDictionary)
        Extend base dictionary by new nMarkers
        Parameters:
        nMarkers - number of markers in the dictionary
        markerSize - number of bits per dimension of each markers
        baseDictionary - Include the markers in this dictionary at the beginning (optional) This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
        Returns:
        automatically generated
      • extendDictionary

        public static Dictionary extendDictionary​(int nMarkers,
                                                  int markerSize)
        Extend base dictionary by new nMarkers
        Parameters:
        nMarkers - number of markers in the dictionary
        markerSize - number of bits per dimension of each markers This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.
        Returns:
        automatically generated