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.MatOfDouble; 010import org.opencv.core.MatOfInt; 011import org.opencv.core.MatOfRect; 012import org.opencv.core.Size; 013import org.opencv.utils.Converters; 014 015// C++: class CascadeClassifier 016/** 017 * Cascade classifier class for object detection. 018 */ 019public class CascadeClassifier { 020 021 protected final long nativeObj; 022 protected CascadeClassifier(long addr) { nativeObj = addr; } 023 024 public long getNativeObjAddr() { return nativeObj; } 025 026 // internal usage only 027 public static CascadeClassifier __fromPtr__(long addr) { return new CascadeClassifier(addr); } 028 029 // 030 // C++: cv::CascadeClassifier::CascadeClassifier() 031 // 032 033 public CascadeClassifier() { 034 nativeObj = CascadeClassifier_0(); 035 } 036 037 038 // 039 // C++: cv::CascadeClassifier::CascadeClassifier(String filename) 040 // 041 042 /** 043 * Loads a classifier from a file. 044 * 045 * @param filename Name of the file from which the classifier is loaded. 046 */ 047 public CascadeClassifier(String filename) { 048 nativeObj = CascadeClassifier_1(filename); 049 } 050 051 052 // 053 // C++: bool cv::CascadeClassifier::empty() 054 // 055 056 /** 057 * Checks whether the classifier has been loaded. 058 * @return automatically generated 059 */ 060 public boolean empty() { 061 return empty_0(nativeObj); 062 } 063 064 065 // 066 // C++: bool cv::CascadeClassifier::load(String filename) 067 // 068 069 /** 070 * Loads a classifier from a file. 071 * 072 * @param filename Name of the file from which the classifier is loaded. The file may contain an old 073 * HAAR classifier trained by the haartraining application or a new cascade classifier trained by the 074 * traincascade application. 075 * @return automatically generated 076 */ 077 public boolean load(String filename) { 078 return load_0(nativeObj, filename); 079 } 080 081 082 // 083 // C++: bool cv::CascadeClassifier::read(FileNode node) 084 // 085 086 // Unknown type 'FileNode' (I), skipping the function 087 088 089 // 090 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size()) 091 // 092 093 /** 094 * Detects objects of different sizes in the input image. The detected objects are returned as a list 095 * of rectangles. 096 * 097 * @param image Matrix of the type CV_8U containing an image where objects are detected. 098 * @param objects Vector of rectangles where each rectangle contains the detected object, the 099 * rectangles may be partially outside the original image. 100 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 101 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 102 * to retain it. 103 * @param flags Parameter with the same meaning for an old cascade as in the function 104 * cvHaarDetectObjects. It is not used for a new cascade. 105 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 106 * @param maxSize Maximum possible object size. Objects larger than that are ignored. If {@code maxSize == minSize} model is evaluated on single scale. 107 * 108 * The function is parallelized with the TBB library. 109 * 110 * <b>Note:</b> 111 * <ul> 112 * <li> 113 * (Python) A face detection example using cascade classifiers can be found at 114 * opencv_source_code/samples/python/facedetect.py 115 * </li> 116 * </ul> 117 */ 118 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 119 Mat objects_mat = objects; 120 detectMultiScale_0(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height); 121 } 122 123 /** 124 * Detects objects of different sizes in the input image. The detected objects are returned as a list 125 * of rectangles. 126 * 127 * @param image Matrix of the type CV_8U containing an image where objects are detected. 128 * @param objects Vector of rectangles where each rectangle contains the detected object, the 129 * rectangles may be partially outside the original image. 130 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 131 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 132 * to retain it. 133 * @param flags Parameter with the same meaning for an old cascade as in the function 134 * cvHaarDetectObjects. It is not used for a new cascade. 135 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 136 * 137 * The function is parallelized with the TBB library. 138 * 139 * <b>Note:</b> 140 * <ul> 141 * <li> 142 * (Python) A face detection example using cascade classifiers can be found at 143 * opencv_source_code/samples/python/facedetect.py 144 * </li> 145 * </ul> 146 */ 147 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize) { 148 Mat objects_mat = objects; 149 detectMultiScale_1(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 150 } 151 152 /** 153 * Detects objects of different sizes in the input image. The detected objects are returned as a list 154 * of rectangles. 155 * 156 * @param image Matrix of the type CV_8U containing an image where objects are detected. 157 * @param objects Vector of rectangles where each rectangle contains the detected object, the 158 * rectangles may be partially outside the original image. 159 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 160 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 161 * to retain it. 162 * @param flags Parameter with the same meaning for an old cascade as in the function 163 * cvHaarDetectObjects. It is not used for a new cascade. 164 * 165 * The function is parallelized with the TBB library. 166 * 167 * <b>Note:</b> 168 * <ul> 169 * <li> 170 * (Python) A face detection example using cascade classifiers can be found at 171 * opencv_source_code/samples/python/facedetect.py 172 * </li> 173 * </ul> 174 */ 175 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags) { 176 Mat objects_mat = objects; 177 detectMultiScale_2(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags); 178 } 179 180 /** 181 * Detects objects of different sizes in the input image. The detected objects are returned as a list 182 * of rectangles. 183 * 184 * @param image Matrix of the type CV_8U containing an image where objects are detected. 185 * @param objects Vector of rectangles where each rectangle contains the detected object, the 186 * rectangles may be partially outside the original image. 187 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 188 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 189 * to retain it. 190 * cvHaarDetectObjects. It is not used for a new cascade. 191 * 192 * The function is parallelized with the TBB library. 193 * 194 * <b>Note:</b> 195 * <ul> 196 * <li> 197 * (Python) A face detection example using cascade classifiers can be found at 198 * opencv_source_code/samples/python/facedetect.py 199 * </li> 200 * </ul> 201 */ 202 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors) { 203 Mat objects_mat = objects; 204 detectMultiScale_3(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors); 205 } 206 207 /** 208 * Detects objects of different sizes in the input image. The detected objects are returned as a list 209 * of rectangles. 210 * 211 * @param image Matrix of the type CV_8U containing an image where objects are detected. 212 * @param objects Vector of rectangles where each rectangle contains the detected object, the 213 * rectangles may be partially outside the original image. 214 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 215 * to retain it. 216 * cvHaarDetectObjects. It is not used for a new cascade. 217 * 218 * The function is parallelized with the TBB library. 219 * 220 * <b>Note:</b> 221 * <ul> 222 * <li> 223 * (Python) A face detection example using cascade classifiers can be found at 224 * opencv_source_code/samples/python/facedetect.py 225 * </li> 226 * </ul> 227 */ 228 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor) { 229 Mat objects_mat = objects; 230 detectMultiScale_4(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor); 231 } 232 233 /** 234 * Detects objects of different sizes in the input image. The detected objects are returned as a list 235 * of rectangles. 236 * 237 * @param image Matrix of the type CV_8U containing an image where objects are detected. 238 * @param objects Vector of rectangles where each rectangle contains the detected object, the 239 * rectangles may be partially outside the original image. 240 * to retain it. 241 * cvHaarDetectObjects. It is not used for a new cascade. 242 * 243 * The function is parallelized with the TBB library. 244 * 245 * <b>Note:</b> 246 * <ul> 247 * <li> 248 * (Python) A face detection example using cascade classifiers can be found at 249 * opencv_source_code/samples/python/facedetect.py 250 * </li> 251 * </ul> 252 */ 253 public void detectMultiScale(Mat image, MatOfRect objects) { 254 Mat objects_mat = objects; 255 detectMultiScale_5(nativeObj, image.nativeObj, objects_mat.nativeObj); 256 } 257 258 259 // 260 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size()) 261 // 262 263 /** 264 * 265 * @param image Matrix of the type CV_8U containing an image where objects are detected. 266 * @param objects Vector of rectangles where each rectangle contains the detected object, the 267 * rectangles may be partially outside the original image. 268 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 269 * of detections is the number of neighboring positively classified rectangles that were joined 270 * together to form the object. 271 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 272 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 273 * to retain it. 274 * @param flags Parameter with the same meaning for an old cascade as in the function 275 * cvHaarDetectObjects. It is not used for a new cascade. 276 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 277 * @param maxSize Maximum possible object size. Objects larger than that are ignored. If {@code maxSize == minSize} model is evaluated on single scale. 278 */ 279 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 280 Mat objects_mat = objects; 281 Mat numDetections_mat = numDetections; 282 detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height); 283 } 284 285 /** 286 * 287 * @param image Matrix of the type CV_8U containing an image where objects are detected. 288 * @param objects Vector of rectangles where each rectangle contains the detected object, the 289 * rectangles may be partially outside the original image. 290 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 291 * of detections is the number of neighboring positively classified rectangles that were joined 292 * together to form the object. 293 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 294 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 295 * to retain it. 296 * @param flags Parameter with the same meaning for an old cascade as in the function 297 * cvHaarDetectObjects. It is not used for a new cascade. 298 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 299 */ 300 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize) { 301 Mat objects_mat = objects; 302 Mat numDetections_mat = numDetections; 303 detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 304 } 305 306 /** 307 * 308 * @param image Matrix of the type CV_8U containing an image where objects are detected. 309 * @param objects Vector of rectangles where each rectangle contains the detected object, the 310 * rectangles may be partially outside the original image. 311 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 312 * of detections is the number of neighboring positively classified rectangles that were joined 313 * together to form the object. 314 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 315 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 316 * to retain it. 317 * @param flags Parameter with the same meaning for an old cascade as in the function 318 * cvHaarDetectObjects. It is not used for a new cascade. 319 */ 320 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags) { 321 Mat objects_mat = objects; 322 Mat numDetections_mat = numDetections; 323 detectMultiScale2_2(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags); 324 } 325 326 /** 327 * 328 * @param image Matrix of the type CV_8U containing an image where objects are detected. 329 * @param objects Vector of rectangles where each rectangle contains the detected object, the 330 * rectangles may be partially outside the original image. 331 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 332 * of detections is the number of neighboring positively classified rectangles that were joined 333 * together to form the object. 334 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 335 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 336 * to retain it. 337 * cvHaarDetectObjects. It is not used for a new cascade. 338 */ 339 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors) { 340 Mat objects_mat = objects; 341 Mat numDetections_mat = numDetections; 342 detectMultiScale2_3(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors); 343 } 344 345 /** 346 * 347 * @param image Matrix of the type CV_8U containing an image where objects are detected. 348 * @param objects Vector of rectangles where each rectangle contains the detected object, the 349 * rectangles may be partially outside the original image. 350 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 351 * of detections is the number of neighboring positively classified rectangles that were joined 352 * together to form the object. 353 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 354 * to retain it. 355 * cvHaarDetectObjects. It is not used for a new cascade. 356 */ 357 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor) { 358 Mat objects_mat = objects; 359 Mat numDetections_mat = numDetections; 360 detectMultiScale2_4(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor); 361 } 362 363 /** 364 * 365 * @param image Matrix of the type CV_8U containing an image where objects are detected. 366 * @param objects Vector of rectangles where each rectangle contains the detected object, the 367 * rectangles may be partially outside the original image. 368 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 369 * of detections is the number of neighboring positively classified rectangles that were joined 370 * together to form the object. 371 * to retain it. 372 * cvHaarDetectObjects. It is not used for a new cascade. 373 */ 374 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections) { 375 Mat objects_mat = objects; 376 Mat numDetections_mat = numDetections; 377 detectMultiScale2_5(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj); 378 } 379 380 381 // 382 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false) 383 // 384 385 /** 386 * 387 * This function allows you to retrieve the final stage decision certainty of classification. 388 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 389 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 390 * This value can then be used to separate strong from weaker classifications. 391 * 392 * A code sample on how to use it efficiently can be found below: 393 * <code> 394 * Mat img; 395 * vector<double> weights; 396 * vector<int> levels; 397 * vector<Rect> detections; 398 * CascadeClassifier model("/path/to/your/model.xml"); 399 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 400 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 401 * </code> 402 * @param image automatically generated 403 * @param objects automatically generated 404 * @param rejectLevels automatically generated 405 * @param levelWeights automatically generated 406 * @param scaleFactor automatically generated 407 * @param minNeighbors automatically generated 408 * @param flags automatically generated 409 * @param minSize automatically generated 410 * @param maxSize automatically generated 411 * @param outputRejectLevels automatically generated 412 */ 413 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels) { 414 Mat objects_mat = objects; 415 Mat rejectLevels_mat = rejectLevels; 416 Mat levelWeights_mat = levelWeights; 417 detectMultiScale3_0(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height, outputRejectLevels); 418 } 419 420 /** 421 * 422 * This function allows you to retrieve the final stage decision certainty of classification. 423 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 424 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 425 * This value can then be used to separate strong from weaker classifications. 426 * 427 * A code sample on how to use it efficiently can be found below: 428 * <code> 429 * Mat img; 430 * vector<double> weights; 431 * vector<int> levels; 432 * vector<Rect> detections; 433 * CascadeClassifier model("/path/to/your/model.xml"); 434 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 435 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 436 * </code> 437 * @param image automatically generated 438 * @param objects automatically generated 439 * @param rejectLevels automatically generated 440 * @param levelWeights automatically generated 441 * @param scaleFactor automatically generated 442 * @param minNeighbors automatically generated 443 * @param flags automatically generated 444 * @param minSize automatically generated 445 * @param maxSize automatically generated 446 */ 447 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 448 Mat objects_mat = objects; 449 Mat rejectLevels_mat = rejectLevels; 450 Mat levelWeights_mat = levelWeights; 451 detectMultiScale3_1(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height); 452 } 453 454 /** 455 * 456 * This function allows you to retrieve the final stage decision certainty of classification. 457 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 458 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 459 * This value can then be used to separate strong from weaker classifications. 460 * 461 * A code sample on how to use it efficiently can be found below: 462 * <code> 463 * Mat img; 464 * vector<double> weights; 465 * vector<int> levels; 466 * vector<Rect> detections; 467 * CascadeClassifier model("/path/to/your/model.xml"); 468 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 469 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 470 * </code> 471 * @param image automatically generated 472 * @param objects automatically generated 473 * @param rejectLevels automatically generated 474 * @param levelWeights automatically generated 475 * @param scaleFactor automatically generated 476 * @param minNeighbors automatically generated 477 * @param flags automatically generated 478 * @param minSize automatically generated 479 */ 480 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize) { 481 Mat objects_mat = objects; 482 Mat rejectLevels_mat = rejectLevels; 483 Mat levelWeights_mat = levelWeights; 484 detectMultiScale3_2(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 485 } 486 487 /** 488 * 489 * This function allows you to retrieve the final stage decision certainty of classification. 490 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 491 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 492 * This value can then be used to separate strong from weaker classifications. 493 * 494 * A code sample on how to use it efficiently can be found below: 495 * <code> 496 * Mat img; 497 * vector<double> weights; 498 * vector<int> levels; 499 * vector<Rect> detections; 500 * CascadeClassifier model("/path/to/your/model.xml"); 501 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 502 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 503 * </code> 504 * @param image automatically generated 505 * @param objects automatically generated 506 * @param rejectLevels automatically generated 507 * @param levelWeights automatically generated 508 * @param scaleFactor automatically generated 509 * @param minNeighbors automatically generated 510 * @param flags automatically generated 511 */ 512 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags) { 513 Mat objects_mat = objects; 514 Mat rejectLevels_mat = rejectLevels; 515 Mat levelWeights_mat = levelWeights; 516 detectMultiScale3_3(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags); 517 } 518 519 /** 520 * 521 * This function allows you to retrieve the final stage decision certainty of classification. 522 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 523 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 524 * This value can then be used to separate strong from weaker classifications. 525 * 526 * A code sample on how to use it efficiently can be found below: 527 * <code> 528 * Mat img; 529 * vector<double> weights; 530 * vector<int> levels; 531 * vector<Rect> detections; 532 * CascadeClassifier model("/path/to/your/model.xml"); 533 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 534 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 535 * </code> 536 * @param image automatically generated 537 * @param objects automatically generated 538 * @param rejectLevels automatically generated 539 * @param levelWeights automatically generated 540 * @param scaleFactor automatically generated 541 * @param minNeighbors automatically generated 542 */ 543 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors) { 544 Mat objects_mat = objects; 545 Mat rejectLevels_mat = rejectLevels; 546 Mat levelWeights_mat = levelWeights; 547 detectMultiScale3_4(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors); 548 } 549 550 /** 551 * 552 * This function allows you to retrieve the final stage decision certainty of classification. 553 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 554 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 555 * This value can then be used to separate strong from weaker classifications. 556 * 557 * A code sample on how to use it efficiently can be found below: 558 * <code> 559 * Mat img; 560 * vector<double> weights; 561 * vector<int> levels; 562 * vector<Rect> detections; 563 * CascadeClassifier model("/path/to/your/model.xml"); 564 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 565 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 566 * </code> 567 * @param image automatically generated 568 * @param objects automatically generated 569 * @param rejectLevels automatically generated 570 * @param levelWeights automatically generated 571 * @param scaleFactor automatically generated 572 */ 573 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor) { 574 Mat objects_mat = objects; 575 Mat rejectLevels_mat = rejectLevels; 576 Mat levelWeights_mat = levelWeights; 577 detectMultiScale3_5(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor); 578 } 579 580 /** 581 * 582 * This function allows you to retrieve the final stage decision certainty of classification. 583 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 584 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 585 * This value can then be used to separate strong from weaker classifications. 586 * 587 * A code sample on how to use it efficiently can be found below: 588 * <code> 589 * Mat img; 590 * vector<double> weights; 591 * vector<int> levels; 592 * vector<Rect> detections; 593 * CascadeClassifier model("/path/to/your/model.xml"); 594 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 595 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 596 * </code> 597 * @param image automatically generated 598 * @param objects automatically generated 599 * @param rejectLevels automatically generated 600 * @param levelWeights automatically generated 601 */ 602 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights) { 603 Mat objects_mat = objects; 604 Mat rejectLevels_mat = rejectLevels; 605 Mat levelWeights_mat = levelWeights; 606 detectMultiScale3_6(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj); 607 } 608 609 610 // 611 // C++: bool cv::CascadeClassifier::isOldFormatCascade() 612 // 613 614 public boolean isOldFormatCascade() { 615 return isOldFormatCascade_0(nativeObj); 616 } 617 618 619 // 620 // C++: Size cv::CascadeClassifier::getOriginalWindowSize() 621 // 622 623 public Size getOriginalWindowSize() { 624 return new Size(getOriginalWindowSize_0(nativeObj)); 625 } 626 627 628 // 629 // C++: int cv::CascadeClassifier::getFeatureType() 630 // 631 632 public int getFeatureType() { 633 return getFeatureType_0(nativeObj); 634 } 635 636 637 // 638 // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade) 639 // 640 641 public static boolean convert(String oldcascade, String newcascade) { 642 return convert_0(oldcascade, newcascade); 643 } 644 645 646 @Override 647 protected void finalize() throws Throwable { 648 delete(nativeObj); 649 } 650 651 652 653 // C++: cv::CascadeClassifier::CascadeClassifier() 654 private static native long CascadeClassifier_0(); 655 656 // C++: cv::CascadeClassifier::CascadeClassifier(String filename) 657 private static native long CascadeClassifier_1(String filename); 658 659 // C++: bool cv::CascadeClassifier::empty() 660 private static native boolean empty_0(long nativeObj); 661 662 // C++: bool cv::CascadeClassifier::load(String filename) 663 private static native boolean load_0(long nativeObj, String filename); 664 665 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size()) 666 private static native void detectMultiScale_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height); 667 private static native void detectMultiScale_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height); 668 private static native void detectMultiScale_2(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags); 669 private static native void detectMultiScale_3(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors); 670 private static native void detectMultiScale_4(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor); 671 private static native void detectMultiScale_5(long nativeObj, long image_nativeObj, long objects_mat_nativeObj); 672 673 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& numDetections, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size()) 674 private static native void detectMultiScale2_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height); 675 private static native void detectMultiScale2_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height); 676 private static native void detectMultiScale2_2(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors, int flags); 677 private static native void detectMultiScale2_3(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors); 678 private static native void detectMultiScale2_4(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor); 679 private static native void detectMultiScale2_5(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj); 680 681 // C++: void cv::CascadeClassifier::detectMultiScale(Mat image, vector_Rect& objects, vector_int& rejectLevels, vector_double& levelWeights, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size(), bool outputRejectLevels = false) 682 private static native void detectMultiScale3_0(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height, boolean outputRejectLevels); 683 private static native void detectMultiScale3_1(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height, double maxSize_width, double maxSize_height); 684 private static native void detectMultiScale3_2(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags, double minSize_width, double minSize_height); 685 private static native void detectMultiScale3_3(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors, int flags); 686 private static native void detectMultiScale3_4(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor, int minNeighbors); 687 private static native void detectMultiScale3_5(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj, double scaleFactor); 688 private static native void detectMultiScale3_6(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj); 689 690 // C++: bool cv::CascadeClassifier::isOldFormatCascade() 691 private static native boolean isOldFormatCascade_0(long nativeObj); 692 693 // C++: Size cv::CascadeClassifier::getOriginalWindowSize() 694 private static native double[] getOriginalWindowSize_0(long nativeObj); 695 696 // C++: int cv::CascadeClassifier::getFeatureType() 697 private static native int getFeatureType_0(long nativeObj); 698 699 // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade) 700 private static native boolean convert_0(String oldcascade, String newcascade); 701 702 // native support for java finalize() 703 private static native void delete(long nativeObj); 704 705}