001// 002// This file is auto-generated. Please don't modify it! 003// 004package org.opencv.objdetect; 005 006import org.opencv.core.Mat; 007 008// C++: class Dictionary 009/** 010 * Dictionary/Set of markers, it contains the inner codification 011 * 012 * BytesList contains the marker codewords where: 013 * - bytesList.rows is the dictionary size 014 * - each marker is encoded using {@code nbytes = ceil(markerSize*markerSize/8.)} 015 * - each row contains all 4 rotations of the marker, so its length is {@code 4*nbytes} 016 * 017 * {@code bytesList.ptr(i)[k*nbytes + j]} is then the j-th byte of i-th marker, in its k-th rotation. 018 */ 019public class Dictionary { 020 021 protected final long nativeObj; 022 protected Dictionary(long addr) { nativeObj = addr; } 023 024 public long getNativeObjAddr() { return nativeObj; } 025 026 // internal usage only 027 public static Dictionary __fromPtr__(long addr) { return new Dictionary(addr); } 028 029 // 030 // C++: cv::aruco::Dictionary::Dictionary() 031 // 032 033 public Dictionary() { 034 nativeObj = Dictionary_0(); 035 } 036 037 038 // 039 // C++: cv::aruco::Dictionary::Dictionary(Mat bytesList, int _markerSize, int maxcorr = 0) 040 // 041 042 public Dictionary(Mat bytesList, int _markerSize, int maxcorr) { 043 nativeObj = Dictionary_1(bytesList.nativeObj, _markerSize, maxcorr); 044 } 045 046 public Dictionary(Mat bytesList, int _markerSize) { 047 nativeObj = Dictionary_2(bytesList.nativeObj, _markerSize); 048 } 049 050 051 // 052 // C++: bool cv::aruco::Dictionary::readDictionary(FileNode fn) 053 // 054 055 // Unknown type 'FileNode' (I), skipping the function 056 057 058 // 059 // C++: void cv::aruco::Dictionary::writeDictionary(FileStorage fs, String name = String()) 060 // 061 062 // Unknown type 'FileStorage' (I), skipping the function 063 064 065 // 066 // C++: bool cv::aruco::Dictionary::identify(Mat onlyBits, int& idx, int& rotation, double maxCorrectionRate) 067 // 068 069 /** 070 * Given a matrix of bits. Returns whether if marker is identified or not. 071 * 072 * It returns by reference the correct id (if any) and the correct rotation 073 * @param onlyBits automatically generated 074 * @param idx automatically generated 075 * @param rotation automatically generated 076 * @param maxCorrectionRate automatically generated 077 * @return automatically generated 078 */ 079 public boolean identify(Mat onlyBits, int[] idx, int[] rotation, double maxCorrectionRate) { 080 double[] idx_out = new double[1]; 081 double[] rotation_out = new double[1]; 082 boolean retVal = identify_0(nativeObj, onlyBits.nativeObj, idx_out, rotation_out, maxCorrectionRate); 083 if(idx!=null) idx[0] = (int)idx_out[0]; 084 if(rotation!=null) rotation[0] = (int)rotation_out[0]; 085 return retVal; 086 } 087 088 089 // 090 // C++: int cv::aruco::Dictionary::getDistanceToId(Mat bits, int id, bool allRotations = true) 091 // 092 093 /** 094 * Returns the distance of the input bits to the specific id. 095 * 096 * If allRotations is true, the four posible bits rotation are considered 097 * @param bits automatically generated 098 * @param id automatically generated 099 * @param allRotations automatically generated 100 * @return automatically generated 101 */ 102 public int getDistanceToId(Mat bits, int id, boolean allRotations) { 103 return getDistanceToId_0(nativeObj, bits.nativeObj, id, allRotations); 104 } 105 106 /** 107 * Returns the distance of the input bits to the specific id. 108 * 109 * If allRotations is true, the four posible bits rotation are considered 110 * @param bits automatically generated 111 * @param id automatically generated 112 * @return automatically generated 113 */ 114 public int getDistanceToId(Mat bits, int id) { 115 return getDistanceToId_1(nativeObj, bits.nativeObj, id); 116 } 117 118 119 // 120 // C++: void cv::aruco::Dictionary::generateImageMarker(int id, int sidePixels, Mat& _img, int borderBits = 1) 121 // 122 123 /** 124 * Generate a canonical marker image 125 * @param id automatically generated 126 * @param sidePixels automatically generated 127 * @param _img automatically generated 128 * @param borderBits automatically generated 129 */ 130 public void generateImageMarker(int id, int sidePixels, Mat _img, int borderBits) { 131 generateImageMarker_0(nativeObj, id, sidePixels, _img.nativeObj, borderBits); 132 } 133 134 /** 135 * Generate a canonical marker image 136 * @param id automatically generated 137 * @param sidePixels automatically generated 138 * @param _img automatically generated 139 */ 140 public void generateImageMarker(int id, int sidePixels, Mat _img) { 141 generateImageMarker_1(nativeObj, id, sidePixels, _img.nativeObj); 142 } 143 144 145 // 146 // C++: static Mat cv::aruco::Dictionary::getByteListFromBits(Mat bits) 147 // 148 149 /** 150 * Transform matrix of bits to list of bytes in the 4 rotations 151 * @param bits automatically generated 152 * @return automatically generated 153 */ 154 public static Mat getByteListFromBits(Mat bits) { 155 return new Mat(getByteListFromBits_0(bits.nativeObj)); 156 } 157 158 159 // 160 // C++: static Mat cv::aruco::Dictionary::getBitsFromByteList(Mat byteList, int markerSize) 161 // 162 163 /** 164 * Transform list of bytes to matrix of bits 165 * @param byteList automatically generated 166 * @param markerSize automatically generated 167 * @return automatically generated 168 */ 169 public static Mat getBitsFromByteList(Mat byteList, int markerSize) { 170 return new Mat(getBitsFromByteList_0(byteList.nativeObj, markerSize)); 171 } 172 173 174 // 175 // C++: Mat Dictionary::bytesList 176 // 177 178 public Mat get_bytesList() { 179 return new Mat(get_bytesList_0(nativeObj)); 180 } 181 182 183 // 184 // C++: void Dictionary::bytesList 185 // 186 187 public void set_bytesList(Mat bytesList) { 188 set_bytesList_0(nativeObj, bytesList.nativeObj); 189 } 190 191 192 // 193 // C++: int Dictionary::markerSize 194 // 195 196 public int get_markerSize() { 197 return get_markerSize_0(nativeObj); 198 } 199 200 201 // 202 // C++: void Dictionary::markerSize 203 // 204 205 public void set_markerSize(int markerSize) { 206 set_markerSize_0(nativeObj, markerSize); 207 } 208 209 210 // 211 // C++: int Dictionary::maxCorrectionBits 212 // 213 214 public int get_maxCorrectionBits() { 215 return get_maxCorrectionBits_0(nativeObj); 216 } 217 218 219 // 220 // C++: void Dictionary::maxCorrectionBits 221 // 222 223 public void set_maxCorrectionBits(int maxCorrectionBits) { 224 set_maxCorrectionBits_0(nativeObj, maxCorrectionBits); 225 } 226 227 228 @Override 229 protected void finalize() throws Throwable { 230 delete(nativeObj); 231 } 232 233 234 235 // C++: cv::aruco::Dictionary::Dictionary() 236 private static native long Dictionary_0(); 237 238 // C++: cv::aruco::Dictionary::Dictionary(Mat bytesList, int _markerSize, int maxcorr = 0) 239 private static native long Dictionary_1(long bytesList_nativeObj, int _markerSize, int maxcorr); 240 private static native long Dictionary_2(long bytesList_nativeObj, int _markerSize); 241 242 // C++: bool cv::aruco::Dictionary::identify(Mat onlyBits, int& idx, int& rotation, double maxCorrectionRate) 243 private static native boolean identify_0(long nativeObj, long onlyBits_nativeObj, double[] idx_out, double[] rotation_out, double maxCorrectionRate); 244 245 // C++: int cv::aruco::Dictionary::getDistanceToId(Mat bits, int id, bool allRotations = true) 246 private static native int getDistanceToId_0(long nativeObj, long bits_nativeObj, int id, boolean allRotations); 247 private static native int getDistanceToId_1(long nativeObj, long bits_nativeObj, int id); 248 249 // C++: void cv::aruco::Dictionary::generateImageMarker(int id, int sidePixels, Mat& _img, int borderBits = 1) 250 private static native void generateImageMarker_0(long nativeObj, int id, int sidePixels, long _img_nativeObj, int borderBits); 251 private static native void generateImageMarker_1(long nativeObj, int id, int sidePixels, long _img_nativeObj); 252 253 // C++: static Mat cv::aruco::Dictionary::getByteListFromBits(Mat bits) 254 private static native long getByteListFromBits_0(long bits_nativeObj); 255 256 // C++: static Mat cv::aruco::Dictionary::getBitsFromByteList(Mat byteList, int markerSize) 257 private static native long getBitsFromByteList_0(long byteList_nativeObj, int markerSize); 258 259 // C++: Mat Dictionary::bytesList 260 private static native long get_bytesList_0(long nativeObj); 261 262 // C++: void Dictionary::bytesList 263 private static native void set_bytesList_0(long nativeObj, long bytesList_nativeObj); 264 265 // C++: int Dictionary::markerSize 266 private static native int get_markerSize_0(long nativeObj); 267 268 // C++: void Dictionary::markerSize 269 private static native void set_markerSize_0(long nativeObj, int markerSize); 270 271 // C++: int Dictionary::maxCorrectionBits 272 private static native int get_maxCorrectionBits_0(long nativeObj); 273 274 // C++: void Dictionary::maxCorrectionBits 275 private static native void set_maxCorrectionBits_0(long nativeObj, int maxCorrectionBits); 276 277 // native support for java finalize() 278 private static native void delete(long nativeObj); 279 280}