Package org.opencv.objdetect
Class Objdetect
- java.lang.Object
-
- org.opencv.objdetect.Objdetect
-
public class Objdetect extends java.lang.Object
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Objdetect()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
drawDetectedCornersCharuco(Mat image, Mat charucoCorners)
Draws a set of Charuco cornersstatic void
drawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds)
Draws a set of Charuco cornersstatic void
drawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds, Scalar cornerColor)
Draws a set of Charuco cornersstatic void
drawDetectedDiamonds(Mat image, java.util.List<Mat> diamondCorners)
Draw a set of detected ChArUco Diamond markersstatic void
drawDetectedDiamonds(Mat image, java.util.List<Mat> diamondCorners, Mat diamondIds)
Draw a set of detected ChArUco Diamond markersstatic void
drawDetectedDiamonds(Mat image, java.util.List<Mat> diamondCorners, Mat diamondIds, Scalar borderColor)
Draw a set of detected ChArUco Diamond markersstatic void
drawDetectedMarkers(Mat image, java.util.List<Mat> corners)
Draw detected markers in imagestatic void
drawDetectedMarkers(Mat image, java.util.List<Mat> corners, Mat ids)
Draw detected markers in imagestatic void
drawDetectedMarkers(Mat image, java.util.List<Mat> corners, Mat ids, Scalar borderColor)
Draw detected markers in imagestatic Dictionary
extendDictionary(int nMarkers, int markerSize)
Extend base dictionary by new nMarkersstatic Dictionary
extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary)
Extend base dictionary by new nMarkersstatic Dictionary
extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary, int randomSeed)
Extend base dictionary by new nMarkersstatic void
generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img)
Generate a canonical marker imagestatic void
generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img, int borderBits)
Generate a canonical marker imagestatic Dictionary
getPredefinedDictionary(int dict)
Returns one of the predefined dictionaries referenced by DICT_*.static void
groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold)
static void
groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps)
-
-
-
Field Detail
-
CASCADE_DO_CANNY_PRUNING
public static final int CASCADE_DO_CANNY_PRUNING
- See Also:
- Constant Field Values
-
CASCADE_SCALE_IMAGE
public static final int CASCADE_SCALE_IMAGE
- See Also:
- Constant Field Values
-
CASCADE_FIND_BIGGEST_OBJECT
public static final int CASCADE_FIND_BIGGEST_OBJECT
- See Also:
- Constant Field Values
-
CASCADE_DO_ROUGH_SEARCH
public static final int CASCADE_DO_ROUGH_SEARCH
- See Also:
- Constant Field Values
-
DetectionBasedTracker_DETECTED_NOT_SHOWN_YET
public static final int DetectionBasedTracker_DETECTED_NOT_SHOWN_YET
- See Also:
- Constant Field Values
-
DetectionBasedTracker_DETECTED
public static final int DetectionBasedTracker_DETECTED
- See Also:
- Constant Field Values
-
DetectionBasedTracker_DETECTED_TEMPORARY_LOST
public static final int DetectionBasedTracker_DETECTED_TEMPORARY_LOST
- See Also:
- Constant Field Values
-
DetectionBasedTracker_WRONG_OBJECT
public static final int DetectionBasedTracker_WRONG_OBJECT
- See Also:
- Constant Field Values
-
CORNER_REFINE_NONE
public static final int CORNER_REFINE_NONE
- See Also:
- Constant Field Values
-
CORNER_REFINE_SUBPIX
public static final int CORNER_REFINE_SUBPIX
- See Also:
- Constant Field Values
-
CORNER_REFINE_CONTOUR
public static final int CORNER_REFINE_CONTOUR
- See Also:
- Constant Field Values
-
CORNER_REFINE_APRILTAG
public static final int CORNER_REFINE_APRILTAG
- See Also:
- Constant Field Values
-
DICT_4X4_50
public static final int DICT_4X4_50
- See Also:
- Constant Field Values
-
DICT_4X4_100
public static final int DICT_4X4_100
- See Also:
- Constant Field Values
-
DICT_4X4_250
public static final int DICT_4X4_250
- See Also:
- Constant Field Values
-
DICT_4X4_1000
public static final int DICT_4X4_1000
- See Also:
- Constant Field Values
-
DICT_5X5_50
public static final int DICT_5X5_50
- See Also:
- Constant Field Values
-
DICT_5X5_100
public static final int DICT_5X5_100
- See Also:
- Constant Field Values
-
DICT_5X5_250
public static final int DICT_5X5_250
- See Also:
- Constant Field Values
-
DICT_5X5_1000
public static final int DICT_5X5_1000
- See Also:
- Constant Field Values
-
DICT_6X6_50
public static final int DICT_6X6_50
- See Also:
- Constant Field Values
-
DICT_6X6_100
public static final int DICT_6X6_100
- See Also:
- Constant Field Values
-
DICT_6X6_250
public static final int DICT_6X6_250
- See Also:
- Constant Field Values
-
DICT_6X6_1000
public static final int DICT_6X6_1000
- See Also:
- Constant Field Values
-
DICT_7X7_50
public static final int DICT_7X7_50
- See Also:
- Constant Field Values
-
DICT_7X7_100
public static final int DICT_7X7_100
- See Also:
- Constant Field Values
-
DICT_7X7_250
public static final int DICT_7X7_250
- See Also:
- Constant Field Values
-
DICT_7X7_1000
public static final int DICT_7X7_1000
- See Also:
- Constant Field Values
-
DICT_ARUCO_ORIGINAL
public static final int DICT_ARUCO_ORIGINAL
- See Also:
- Constant Field Values
-
DICT_APRILTAG_16h5
public static final int DICT_APRILTAG_16h5
- See Also:
- Constant Field Values
-
DICT_APRILTAG_25h9
public static final int DICT_APRILTAG_25h9
- See Also:
- Constant Field Values
-
DICT_APRILTAG_36h10
public static final int DICT_APRILTAG_36h10
- See Also:
- Constant Field Values
-
DICT_APRILTAG_36h11
public static final int DICT_APRILTAG_36h11
- See Also:
- Constant Field Values
-
DICT_ARUCO_MIP_36h12
public static final int DICT_ARUCO_MIP_36h12
- See Also:
- Constant Field Values
-
-
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 markersid
- 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 pixelsimg
- output image with the markerborderBits
- 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 markersid
- 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 pixelsimg
- output image with the marker This function returns a marker image in its canonical form (i.e. ready to be printed)
-
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 dictionarymarkerSize
- number of bits per dimension of each markersbaseDictionary
- 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 dictionarymarkerSize
- number of bits per dimension of each markersbaseDictionary
- 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 dictionarymarkerSize
- 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
-
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 cornerscharucoIds
- list of identifiers for each corner in charucoCornerscornerColor
- 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 cornerscharucoIds
- 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.
-
-