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.utils.Converters; 010 011// C++: class QRCodeDetector 012/** 013 * Groups the object candidate rectangles. 014 * rectList Input/output vector of rectangles. Output vector includes retained and grouped rectangles. (The Python list is not modified in place.) 015 * weights Input/output vector of weights of rectangles. Output vector includes weights of retained and grouped rectangles. (The Python list is not modified in place.) 016 * groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a group of rectangles to retain it. 017 * eps Relative difference between sides of the rectangles to merge them into a group. 018 */ 019public class QRCodeDetector { 020 021 protected final long nativeObj; 022 protected QRCodeDetector(long addr) { nativeObj = addr; } 023 024 public long getNativeObjAddr() { return nativeObj; } 025 026 // internal usage only 027 public static QRCodeDetector __fromPtr__(long addr) { return new QRCodeDetector(addr); } 028 029 // 030 // C++: cv::QRCodeDetector::QRCodeDetector() 031 // 032 033 public QRCodeDetector() { 034 nativeObj = QRCodeDetector_0(); 035 } 036 037 038 // 039 // C++: void cv::QRCodeDetector::setEpsX(double epsX) 040 // 041 042 /** 043 * sets the epsilon used during the horizontal scan of QR code stop marker detection. 044 * @param epsX Epsilon neighborhood, which allows you to determine the horizontal pattern 045 * of the scheme 1:1:3:1:1 according to QR code standard. 046 */ 047 public void setEpsX(double epsX) { 048 setEpsX_0(nativeObj, epsX); 049 } 050 051 052 // 053 // C++: void cv::QRCodeDetector::setEpsY(double epsY) 054 // 055 056 /** 057 * sets the epsilon used during the vertical scan of QR code stop marker detection. 058 * @param epsY Epsilon neighborhood, which allows you to determine the vertical pattern 059 * of the scheme 1:1:3:1:1 according to QR code standard. 060 */ 061 public void setEpsY(double epsY) { 062 setEpsY_0(nativeObj, epsY); 063 } 064 065 066 // 067 // C++: bool cv::QRCodeDetector::detect(Mat img, Mat& points) 068 // 069 070 /** 071 * Detects QR code in image and returns the quadrangle containing the code. 072 * @param img grayscale or color (BGR) image containing (or not) QR code. 073 * @param points Output vector of vertices of the minimum-area quadrangle containing the code. 074 * @return automatically generated 075 */ 076 public boolean detect(Mat img, Mat points) { 077 return detect_0(nativeObj, img.nativeObj, points.nativeObj); 078 } 079 080 081 // 082 // C++: string cv::QRCodeDetector::decode(Mat img, Mat points, Mat& straight_qrcode = Mat()) 083 // 084 085 /** 086 * Decodes QR code in image once it's found by the detect() method. 087 * 088 * Returns UTF8-encoded output string or empty string if the code cannot be decoded. 089 * @param img grayscale or color (BGR) image containing QR code. 090 * @param points Quadrangle vertices found by detect() method (or some other algorithm). 091 * @param straight_qrcode The optional output image containing rectified and binarized QR code 092 * @return automatically generated 093 */ 094 public String decode(Mat img, Mat points, Mat straight_qrcode) { 095 return decode_0(nativeObj, img.nativeObj, points.nativeObj, straight_qrcode.nativeObj); 096 } 097 098 /** 099 * Decodes QR code in image once it's found by the detect() method. 100 * 101 * Returns UTF8-encoded output string or empty string if the code cannot be decoded. 102 * @param img grayscale or color (BGR) image containing QR code. 103 * @param points Quadrangle vertices found by detect() method (or some other algorithm). 104 * @return automatically generated 105 */ 106 public String decode(Mat img, Mat points) { 107 return decode_1(nativeObj, img.nativeObj, points.nativeObj); 108 } 109 110 111 // 112 // C++: String cv::QRCodeDetector::decodeCurved(Mat img, Mat points, Mat& straight_qrcode = Mat()) 113 // 114 115 /** 116 * Decodes QR code on a curved surface in image once it's found by the detect() method. 117 * 118 * Returns UTF8-encoded output string or empty string if the code cannot be decoded. 119 * @param img grayscale or color (BGR) image containing QR code. 120 * @param points Quadrangle vertices found by detect() method (or some other algorithm). 121 * @param straight_qrcode The optional output image containing rectified and binarized QR code 122 * @return automatically generated 123 */ 124 public String decodeCurved(Mat img, Mat points, Mat straight_qrcode) { 125 return decodeCurved_0(nativeObj, img.nativeObj, points.nativeObj, straight_qrcode.nativeObj); 126 } 127 128 /** 129 * Decodes QR code on a curved surface in image once it's found by the detect() method. 130 * 131 * Returns UTF8-encoded output string or empty string if the code cannot be decoded. 132 * @param img grayscale or color (BGR) image containing QR code. 133 * @param points Quadrangle vertices found by detect() method (or some other algorithm). 134 * @return automatically generated 135 */ 136 public String decodeCurved(Mat img, Mat points) { 137 return decodeCurved_1(nativeObj, img.nativeObj, points.nativeObj); 138 } 139 140 141 // 142 // C++: string cv::QRCodeDetector::detectAndDecode(Mat img, Mat& points = Mat(), Mat& straight_qrcode = Mat()) 143 // 144 145 /** 146 * Both detects and decodes QR code 147 * 148 * @param img grayscale or color (BGR) image containing QR code. 149 * @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found. 150 * @param straight_qrcode The optional output image containing rectified and binarized QR code 151 * @return automatically generated 152 */ 153 public String detectAndDecode(Mat img, Mat points, Mat straight_qrcode) { 154 return detectAndDecode_0(nativeObj, img.nativeObj, points.nativeObj, straight_qrcode.nativeObj); 155 } 156 157 /** 158 * Both detects and decodes QR code 159 * 160 * @param img grayscale or color (BGR) image containing QR code. 161 * @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found. 162 * @return automatically generated 163 */ 164 public String detectAndDecode(Mat img, Mat points) { 165 return detectAndDecode_1(nativeObj, img.nativeObj, points.nativeObj); 166 } 167 168 /** 169 * Both detects and decodes QR code 170 * 171 * @param img grayscale or color (BGR) image containing QR code. 172 * @return automatically generated 173 */ 174 public String detectAndDecode(Mat img) { 175 return detectAndDecode_2(nativeObj, img.nativeObj); 176 } 177 178 179 // 180 // C++: string cv::QRCodeDetector::detectAndDecodeCurved(Mat img, Mat& points = Mat(), Mat& straight_qrcode = Mat()) 181 // 182 183 /** 184 * Both detects and decodes QR code on a curved surface 185 * 186 * @param img grayscale or color (BGR) image containing QR code. 187 * @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found. 188 * @param straight_qrcode The optional output image containing rectified and binarized QR code 189 * @return automatically generated 190 */ 191 public String detectAndDecodeCurved(Mat img, Mat points, Mat straight_qrcode) { 192 return detectAndDecodeCurved_0(nativeObj, img.nativeObj, points.nativeObj, straight_qrcode.nativeObj); 193 } 194 195 /** 196 * Both detects and decodes QR code on a curved surface 197 * 198 * @param img grayscale or color (BGR) image containing QR code. 199 * @param points optional output array of vertices of the found QR code quadrangle. Will be empty if not found. 200 * @return automatically generated 201 */ 202 public String detectAndDecodeCurved(Mat img, Mat points) { 203 return detectAndDecodeCurved_1(nativeObj, img.nativeObj, points.nativeObj); 204 } 205 206 /** 207 * Both detects and decodes QR code on a curved surface 208 * 209 * @param img grayscale or color (BGR) image containing QR code. 210 * @return automatically generated 211 */ 212 public String detectAndDecodeCurved(Mat img) { 213 return detectAndDecodeCurved_2(nativeObj, img.nativeObj); 214 } 215 216 217 // 218 // C++: bool cv::QRCodeDetector::detectMulti(Mat img, Mat& points) 219 // 220 221 /** 222 * Detects QR codes in image and returns the vector of the quadrangles containing the codes. 223 * @param img grayscale or color (BGR) image containing (or not) QR codes. 224 * @param points Output vector of vector of vertices of the minimum-area quadrangle containing the codes. 225 * @return automatically generated 226 */ 227 public boolean detectMulti(Mat img, Mat points) { 228 return detectMulti_0(nativeObj, img.nativeObj, points.nativeObj); 229 } 230 231 232 // 233 // C++: bool cv::QRCodeDetector::decodeMulti(Mat img, Mat points, vector_string& decoded_info, vector_Mat& straight_qrcode = vector_Mat()) 234 // 235 236 /** 237 * Decodes QR codes in image once it's found by the detect() method. 238 * @param img grayscale or color (BGR) image containing QR codes. 239 * @param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. 240 * @param points vector of Quadrangle vertices found by detect() method (or some other algorithm). 241 * @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes 242 * @return automatically generated 243 */ 244 public boolean decodeMulti(Mat img, Mat points, List<String> decoded_info, List<Mat> straight_qrcode) { 245 Mat straight_qrcode_mat = new Mat(); 246 boolean retVal = decodeMulti_0(nativeObj, img.nativeObj, points.nativeObj, decoded_info, straight_qrcode_mat.nativeObj); 247 Converters.Mat_to_vector_Mat(straight_qrcode_mat, straight_qrcode); 248 straight_qrcode_mat.release(); 249 return retVal; 250 } 251 252 /** 253 * Decodes QR codes in image once it's found by the detect() method. 254 * @param img grayscale or color (BGR) image containing QR codes. 255 * @param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. 256 * @param points vector of Quadrangle vertices found by detect() method (or some other algorithm). 257 * @return automatically generated 258 */ 259 public boolean decodeMulti(Mat img, Mat points, List<String> decoded_info) { 260 return decodeMulti_1(nativeObj, img.nativeObj, points.nativeObj, decoded_info); 261 } 262 263 264 // 265 // C++: bool cv::QRCodeDetector::detectAndDecodeMulti(Mat img, vector_string& decoded_info, Mat& points = Mat(), vector_Mat& straight_qrcode = vector_Mat()) 266 // 267 268 /** 269 * Both detects and decodes QR codes 270 * @param img grayscale or color (BGR) image containing QR codes. 271 * @param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. 272 * @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found. 273 * @param straight_qrcode The optional output vector of images containing rectified and binarized QR codes 274 * @return automatically generated 275 */ 276 public boolean detectAndDecodeMulti(Mat img, List<String> decoded_info, Mat points, List<Mat> straight_qrcode) { 277 Mat straight_qrcode_mat = new Mat(); 278 boolean retVal = detectAndDecodeMulti_0(nativeObj, img.nativeObj, decoded_info, points.nativeObj, straight_qrcode_mat.nativeObj); 279 Converters.Mat_to_vector_Mat(straight_qrcode_mat, straight_qrcode); 280 straight_qrcode_mat.release(); 281 return retVal; 282 } 283 284 /** 285 * Both detects and decodes QR codes 286 * @param img grayscale or color (BGR) image containing QR codes. 287 * @param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. 288 * @param points optional output vector of vertices of the found QR code quadrangles. Will be empty if not found. 289 * @return automatically generated 290 */ 291 public boolean detectAndDecodeMulti(Mat img, List<String> decoded_info, Mat points) { 292 return detectAndDecodeMulti_1(nativeObj, img.nativeObj, decoded_info, points.nativeObj); 293 } 294 295 /** 296 * Both detects and decodes QR codes 297 * @param img grayscale or color (BGR) image containing QR codes. 298 * @param decoded_info UTF8-encoded output vector of string or empty vector of string if the codes cannot be decoded. 299 * @return automatically generated 300 */ 301 public boolean detectAndDecodeMulti(Mat img, List<String> decoded_info) { 302 return detectAndDecodeMulti_2(nativeObj, img.nativeObj, decoded_info); 303 } 304 305 306 @Override 307 protected void finalize() throws Throwable { 308 delete(nativeObj); 309 } 310 311 312 313 // C++: cv::QRCodeDetector::QRCodeDetector() 314 private static native long QRCodeDetector_0(); 315 316 // C++: void cv::QRCodeDetector::setEpsX(double epsX) 317 private static native void setEpsX_0(long nativeObj, double epsX); 318 319 // C++: void cv::QRCodeDetector::setEpsY(double epsY) 320 private static native void setEpsY_0(long nativeObj, double epsY); 321 322 // C++: bool cv::QRCodeDetector::detect(Mat img, Mat& points) 323 private static native boolean detect_0(long nativeObj, long img_nativeObj, long points_nativeObj); 324 325 // C++: string cv::QRCodeDetector::decode(Mat img, Mat points, Mat& straight_qrcode = Mat()) 326 private static native String decode_0(long nativeObj, long img_nativeObj, long points_nativeObj, long straight_qrcode_nativeObj); 327 private static native String decode_1(long nativeObj, long img_nativeObj, long points_nativeObj); 328 329 // C++: String cv::QRCodeDetector::decodeCurved(Mat img, Mat points, Mat& straight_qrcode = Mat()) 330 private static native String decodeCurved_0(long nativeObj, long img_nativeObj, long points_nativeObj, long straight_qrcode_nativeObj); 331 private static native String decodeCurved_1(long nativeObj, long img_nativeObj, long points_nativeObj); 332 333 // C++: string cv::QRCodeDetector::detectAndDecode(Mat img, Mat& points = Mat(), Mat& straight_qrcode = Mat()) 334 private static native String detectAndDecode_0(long nativeObj, long img_nativeObj, long points_nativeObj, long straight_qrcode_nativeObj); 335 private static native String detectAndDecode_1(long nativeObj, long img_nativeObj, long points_nativeObj); 336 private static native String detectAndDecode_2(long nativeObj, long img_nativeObj); 337 338 // C++: string cv::QRCodeDetector::detectAndDecodeCurved(Mat img, Mat& points = Mat(), Mat& straight_qrcode = Mat()) 339 private static native String detectAndDecodeCurved_0(long nativeObj, long img_nativeObj, long points_nativeObj, long straight_qrcode_nativeObj); 340 private static native String detectAndDecodeCurved_1(long nativeObj, long img_nativeObj, long points_nativeObj); 341 private static native String detectAndDecodeCurved_2(long nativeObj, long img_nativeObj); 342 343 // C++: bool cv::QRCodeDetector::detectMulti(Mat img, Mat& points) 344 private static native boolean detectMulti_0(long nativeObj, long img_nativeObj, long points_nativeObj); 345 346 // C++: bool cv::QRCodeDetector::decodeMulti(Mat img, Mat points, vector_string& decoded_info, vector_Mat& straight_qrcode = vector_Mat()) 347 private static native boolean decodeMulti_0(long nativeObj, long img_nativeObj, long points_nativeObj, List<String> decoded_info, long straight_qrcode_mat_nativeObj); 348 private static native boolean decodeMulti_1(long nativeObj, long img_nativeObj, long points_nativeObj, List<String> decoded_info); 349 350 // C++: bool cv::QRCodeDetector::detectAndDecodeMulti(Mat img, vector_string& decoded_info, Mat& points = Mat(), vector_Mat& straight_qrcode = vector_Mat()) 351 private static native boolean detectAndDecodeMulti_0(long nativeObj, long img_nativeObj, List<String> decoded_info, long points_nativeObj, long straight_qrcode_mat_nativeObj); 352 private static native boolean detectAndDecodeMulti_1(long nativeObj, long img_nativeObj, List<String> decoded_info, long points_nativeObj); 353 private static native boolean detectAndDecodeMulti_2(long nativeObj, long img_nativeObj, List<String> decoded_info); 354 355 // native support for java finalize() 356 private static native void delete(long nativeObj); 357 358}