001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.objdetect; 005 006import java.util.ArrayList; 007import java.util.List; 008import org.opencv.core.Mat; 009import org.opencv.core.MatOfPoint3f; 010import org.opencv.core.Size; 011import org.opencv.objdetect.Board; 012import org.opencv.objdetect.Dictionary; 013import org.opencv.utils.Converters; 014 015// C++: class CharucoBoard 016/** 017 * ChArUco board is a planar chessboard where the markers are placed inside the white squares of a chessboard. 018 * 019 * The benefits of ChArUco boards is that they provide both, ArUco markers versatility and chessboard corner precision, 020 * which is important for calibration and pose estimation. The board image can be drawn using generateImage() method. 021 */ 022public class CharucoBoard extends Board { 023 024 protected CharucoBoard(long addr) { super(addr); } 025 026 // internal usage only 027 public static CharucoBoard __fromPtr__(long addr) { return new CharucoBoard(addr); } 028 029 // 030 // C++: cv::aruco::CharucoBoard::CharucoBoard(Size size, float squareLength, float markerLength, Dictionary dictionary, Mat ids = Mat()) 031 // 032 033 /** 034 * CharucoBoard constructor 035 * 036 * @param size number of chessboard squares in x and y directions 037 * @param squareLength squareLength chessboard square side length (normally in meters) 038 * @param markerLength marker side length (same unit than squareLength) 039 * @param dictionary dictionary of markers indicating the type of markers 040 * @param ids array of id used markers 041 * The first markers in the dictionary are used to fill the white chessboard squares. 042 */ 043 public CharucoBoard(Size size, float squareLength, float markerLength, Dictionary dictionary, Mat ids) { 044 super(CharucoBoard_0(size.width, size.height, squareLength, markerLength, dictionary.nativeObj, ids.nativeObj)); 045 } 046 047 /** 048 * CharucoBoard constructor 049 * 050 * @param size number of chessboard squares in x and y directions 051 * @param squareLength squareLength chessboard square side length (normally in meters) 052 * @param markerLength marker side length (same unit than squareLength) 053 * @param dictionary dictionary of markers indicating the type of markers 054 * The first markers in the dictionary are used to fill the white chessboard squares. 055 */ 056 public CharucoBoard(Size size, float squareLength, float markerLength, Dictionary dictionary) { 057 super(CharucoBoard_1(size.width, size.height, squareLength, markerLength, dictionary.nativeObj)); 058 } 059 060 061 // 062 // C++: void cv::aruco::CharucoBoard::setLegacyPattern(bool legacyPattern) 063 // 064 065 /** 066 * set legacy chessboard pattern. 067 * 068 * Legacy setting creates chessboard patterns starting with a white box in the upper left corner 069 * if there is an even row count of chessboard boxes, otherwise it starts with a black box. 070 * This setting ensures compatibility to patterns created with OpenCV versions prior OpenCV 4.6.0. 071 * See https://github.com/opencv/opencv/issues/23152. 072 * 073 * Default value: false. 074 * @param legacyPattern automatically generated 075 */ 076 public void setLegacyPattern(boolean legacyPattern) { 077 setLegacyPattern_0(nativeObj, legacyPattern); 078 } 079 080 081 // 082 // C++: bool cv::aruco::CharucoBoard::getLegacyPattern() 083 // 084 085 public boolean getLegacyPattern() { 086 return getLegacyPattern_0(nativeObj); 087 } 088 089 090 // 091 // C++: Size cv::aruco::CharucoBoard::getChessboardSize() 092 // 093 094 public Size getChessboardSize() { 095 return new Size(getChessboardSize_0(nativeObj)); 096 } 097 098 099 // 100 // C++: float cv::aruco::CharucoBoard::getSquareLength() 101 // 102 103 public float getSquareLength() { 104 return getSquareLength_0(nativeObj); 105 } 106 107 108 // 109 // C++: float cv::aruco::CharucoBoard::getMarkerLength() 110 // 111 112 public float getMarkerLength() { 113 return getMarkerLength_0(nativeObj); 114 } 115 116 117 // 118 // C++: vector_Point3f cv::aruco::CharucoBoard::getChessboardCorners() 119 // 120 121 /** 122 * get CharucoBoard::chessboardCorners 123 * @return automatically generated 124 */ 125 public MatOfPoint3f getChessboardCorners() { 126 return MatOfPoint3f.fromNativeAddr(getChessboardCorners_0(nativeObj)); 127 } 128 129 130 // 131 // C++: bool cv::aruco::CharucoBoard::checkCharucoCornersCollinear(Mat charucoIds) 132 // 133 134 /** 135 * check whether the ChArUco markers are collinear 136 * 137 * @param charucoIds list of identifiers for each corner in charucoCorners per frame. 138 * @return bool value, 1 (true) if detected corners form a line, 0 (false) if they do not. 139 * solvePnP, calibration functions will fail if the corners are collinear (true). 140 * 141 * The number of ids in charucoIDs should be <= the number of chessboard corners in the board. 142 * This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). 143 * Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: 144 * for number of charucoIDs <= 2,the function returns true. 145 */ 146 public boolean checkCharucoCornersCollinear(Mat charucoIds) { 147 return checkCharucoCornersCollinear_0(nativeObj, charucoIds.nativeObj); 148 } 149 150 151 @Override 152 protected void finalize() throws Throwable { 153 delete(nativeObj); 154 } 155 156 157 158 // C++: cv::aruco::CharucoBoard::CharucoBoard(Size size, float squareLength, float markerLength, Dictionary dictionary, Mat ids = Mat()) 159 private static native long CharucoBoard_0(double size_width, double size_height, float squareLength, float markerLength, long dictionary_nativeObj, long ids_nativeObj); 160 private static native long CharucoBoard_1(double size_width, double size_height, float squareLength, float markerLength, long dictionary_nativeObj); 161 162 // C++: void cv::aruco::CharucoBoard::setLegacyPattern(bool legacyPattern) 163 private static native void setLegacyPattern_0(long nativeObj, boolean legacyPattern); 164 165 // C++: bool cv::aruco::CharucoBoard::getLegacyPattern() 166 private static native boolean getLegacyPattern_0(long nativeObj); 167 168 // C++: Size cv::aruco::CharucoBoard::getChessboardSize() 169 private static native double[] getChessboardSize_0(long nativeObj); 170 171 // C++: float cv::aruco::CharucoBoard::getSquareLength() 172 private static native float getSquareLength_0(long nativeObj); 173 174 // C++: float cv::aruco::CharucoBoard::getMarkerLength() 175 private static native float getMarkerLength_0(long nativeObj); 176 177 // C++: vector_Point3f cv::aruco::CharucoBoard::getChessboardCorners() 178 private static native long getChessboardCorners_0(long nativeObj); 179 180 // C++: bool cv::aruco::CharucoBoard::checkCharucoCornersCollinear(Mat charucoIds) 181 private static native boolean checkCharucoCornersCollinear_0(long nativeObj, long charucoIds_nativeObj); 182 183 // native support for java finalize() 184 private static native void delete(long nativeObj); 185 186}