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 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 109 Mat objects_mat = objects; 110 detectMultiScale_0(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height); 111 } 112 113 /** 114 * Detects objects of different sizes in the input image. The detected objects are returned as a list 115 * of rectangles. 116 * 117 * @param image Matrix of the type CV_8U containing an image where objects are detected. 118 * @param objects Vector of rectangles where each rectangle contains the detected object, the 119 * rectangles may be partially outside the original image. 120 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 121 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 122 * to retain it. 123 * @param flags Parameter with the same meaning for an old cascade as in the function 124 * cvHaarDetectObjects. It is not used for a new cascade. 125 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 126 */ 127 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags, Size minSize) { 128 Mat objects_mat = objects; 129 detectMultiScale_1(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 130 } 131 132 /** 133 * Detects objects of different sizes in the input image. The detected objects are returned as a list 134 * of rectangles. 135 * 136 * @param image Matrix of the type CV_8U containing an image where objects are detected. 137 * @param objects Vector of rectangles where each rectangle contains the detected object, the 138 * rectangles may be partially outside the original image. 139 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 140 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 141 * to retain it. 142 * @param flags Parameter with the same meaning for an old cascade as in the function 143 * cvHaarDetectObjects. It is not used for a new cascade. 144 */ 145 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors, int flags) { 146 Mat objects_mat = objects; 147 detectMultiScale_2(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors, flags); 148 } 149 150 /** 151 * Detects objects of different sizes in the input image. The detected objects are returned as a list 152 * of rectangles. 153 * 154 * @param image Matrix of the type CV_8U containing an image where objects are detected. 155 * @param objects Vector of rectangles where each rectangle contains the detected object, the 156 * rectangles may be partially outside the original image. 157 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 158 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 159 * to retain it. 160 * cvHaarDetectObjects. It is not used for a new cascade. 161 */ 162 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor, int minNeighbors) { 163 Mat objects_mat = objects; 164 detectMultiScale_3(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor, minNeighbors); 165 } 166 167 /** 168 * Detects objects of different sizes in the input image. The detected objects are returned as a list 169 * of rectangles. 170 * 171 * @param image Matrix of the type CV_8U containing an image where objects are detected. 172 * @param objects Vector of rectangles where each rectangle contains the detected object, the 173 * rectangles may be partially outside the original image. 174 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 175 * to retain it. 176 * cvHaarDetectObjects. It is not used for a new cascade. 177 */ 178 public void detectMultiScale(Mat image, MatOfRect objects, double scaleFactor) { 179 Mat objects_mat = objects; 180 detectMultiScale_4(nativeObj, image.nativeObj, objects_mat.nativeObj, scaleFactor); 181 } 182 183 /** 184 * Detects objects of different sizes in the input image. The detected objects are returned as a list 185 * of rectangles. 186 * 187 * @param image Matrix of the type CV_8U containing an image where objects are detected. 188 * @param objects Vector of rectangles where each rectangle contains the detected object, the 189 * rectangles may be partially outside the original image. 190 * to retain it. 191 * cvHaarDetectObjects. It is not used for a new cascade. 192 */ 193 public void detectMultiScale(Mat image, MatOfRect objects) { 194 Mat objects_mat = objects; 195 detectMultiScale_5(nativeObj, image.nativeObj, objects_mat.nativeObj); 196 } 197 198 199 // 200 // 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()) 201 // 202 203 /** 204 * 205 * @param image Matrix of the type CV_8U containing an image where objects are detected. 206 * @param objects Vector of rectangles where each rectangle contains the detected object, the 207 * rectangles may be partially outside the original image. 208 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 209 * of detections is the number of neighboring positively classified rectangles that were joined 210 * together to form the object. 211 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 212 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 213 * to retain it. 214 * @param flags Parameter with the same meaning for an old cascade as in the function 215 * cvHaarDetectObjects. It is not used for a new cascade. 216 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 217 * @param maxSize Maximum possible object size. Objects larger than that are ignored. If {@code maxSize == minSize} model is evaluated on single scale. 218 */ 219 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 220 Mat objects_mat = objects; 221 Mat numDetections_mat = numDetections; 222 detectMultiScale2_0(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height, maxSize.width, maxSize.height); 223 } 224 225 /** 226 * 227 * @param image Matrix of the type CV_8U containing an image where objects are detected. 228 * @param objects Vector of rectangles where each rectangle contains the detected object, the 229 * rectangles may be partially outside the original image. 230 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 231 * of detections is the number of neighboring positively classified rectangles that were joined 232 * together to form the object. 233 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 234 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 235 * to retain it. 236 * @param flags Parameter with the same meaning for an old cascade as in the function 237 * cvHaarDetectObjects. It is not used for a new cascade. 238 * @param minSize Minimum possible object size. Objects smaller than that are ignored. 239 */ 240 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags, Size minSize) { 241 Mat objects_mat = objects; 242 Mat numDetections_mat = numDetections; 243 detectMultiScale2_1(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 244 } 245 246 /** 247 * 248 * @param image Matrix of the type CV_8U containing an image where objects are detected. 249 * @param objects Vector of rectangles where each rectangle contains the detected object, the 250 * rectangles may be partially outside the original image. 251 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 252 * of detections is the number of neighboring positively classified rectangles that were joined 253 * together to form the object. 254 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 255 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 256 * to retain it. 257 * @param flags Parameter with the same meaning for an old cascade as in the function 258 * cvHaarDetectObjects. It is not used for a new cascade. 259 */ 260 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors, int flags) { 261 Mat objects_mat = objects; 262 Mat numDetections_mat = numDetections; 263 detectMultiScale2_2(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors, flags); 264 } 265 266 /** 267 * 268 * @param image Matrix of the type CV_8U containing an image where objects are detected. 269 * @param objects Vector of rectangles where each rectangle contains the detected object, the 270 * rectangles may be partially outside the original image. 271 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 272 * of detections is the number of neighboring positively classified rectangles that were joined 273 * together to form the object. 274 * @param scaleFactor Parameter specifying how much the image size is reduced at each image scale. 275 * @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have 276 * to retain it. 277 * cvHaarDetectObjects. It is not used for a new cascade. 278 */ 279 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor, int minNeighbors) { 280 Mat objects_mat = objects; 281 Mat numDetections_mat = numDetections; 282 detectMultiScale2_3(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor, minNeighbors); 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 * to retain it. 295 * cvHaarDetectObjects. It is not used for a new cascade. 296 */ 297 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections, double scaleFactor) { 298 Mat objects_mat = objects; 299 Mat numDetections_mat = numDetections; 300 detectMultiScale2_4(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj, scaleFactor); 301 } 302 303 /** 304 * 305 * @param image Matrix of the type CV_8U containing an image where objects are detected. 306 * @param objects Vector of rectangles where each rectangle contains the detected object, the 307 * rectangles may be partially outside the original image. 308 * @param numDetections Vector of detection numbers for the corresponding objects. An object's number 309 * of detections is the number of neighboring positively classified rectangles that were joined 310 * together to form the object. 311 * to retain it. 312 * cvHaarDetectObjects. It is not used for a new cascade. 313 */ 314 public void detectMultiScale2(Mat image, MatOfRect objects, MatOfInt numDetections) { 315 Mat objects_mat = objects; 316 Mat numDetections_mat = numDetections; 317 detectMultiScale2_5(nativeObj, image.nativeObj, objects_mat.nativeObj, numDetections_mat.nativeObj); 318 } 319 320 321 // 322 // 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) 323 // 324 325 /** 326 * 327 * This function allows you to retrieve the final stage decision certainty of classification. 328 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 329 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 330 * This value can then be used to separate strong from weaker classifications. 331 * 332 * A code sample on how to use it efficiently can be found below: 333 * <code> 334 * Mat img; 335 * vector<double> weights; 336 * vector<int> levels; 337 * vector<Rect> detections; 338 * CascadeClassifier model("/path/to/your/model.xml"); 339 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 340 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 341 * </code> 342 * @param image automatically generated 343 * @param objects automatically generated 344 * @param rejectLevels automatically generated 345 * @param levelWeights automatically generated 346 * @param scaleFactor automatically generated 347 * @param minNeighbors automatically generated 348 * @param flags automatically generated 349 * @param minSize automatically generated 350 * @param maxSize automatically generated 351 * @param outputRejectLevels automatically generated 352 */ 353 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize, boolean outputRejectLevels) { 354 Mat objects_mat = objects; 355 Mat rejectLevels_mat = rejectLevels; 356 Mat levelWeights_mat = levelWeights; 357 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); 358 } 359 360 /** 361 * 362 * This function allows you to retrieve the final stage decision certainty of classification. 363 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 364 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 365 * This value can then be used to separate strong from weaker classifications. 366 * 367 * A code sample on how to use it efficiently can be found below: 368 * <code> 369 * Mat img; 370 * vector<double> weights; 371 * vector<int> levels; 372 * vector<Rect> detections; 373 * CascadeClassifier model("/path/to/your/model.xml"); 374 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 375 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 376 * </code> 377 * @param image automatically generated 378 * @param objects automatically generated 379 * @param rejectLevels automatically generated 380 * @param levelWeights automatically generated 381 * @param scaleFactor automatically generated 382 * @param minNeighbors automatically generated 383 * @param flags automatically generated 384 * @param minSize automatically generated 385 * @param maxSize automatically generated 386 */ 387 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize, Size maxSize) { 388 Mat objects_mat = objects; 389 Mat rejectLevels_mat = rejectLevels; 390 Mat levelWeights_mat = levelWeights; 391 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); 392 } 393 394 /** 395 * 396 * This function allows you to retrieve the final stage decision certainty of classification. 397 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 398 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 399 * This value can then be used to separate strong from weaker classifications. 400 * 401 * A code sample on how to use it efficiently can be found below: 402 * <code> 403 * Mat img; 404 * vector<double> weights; 405 * vector<int> levels; 406 * vector<Rect> detections; 407 * CascadeClassifier model("/path/to/your/model.xml"); 408 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 409 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 410 * </code> 411 * @param image automatically generated 412 * @param objects automatically generated 413 * @param rejectLevels automatically generated 414 * @param levelWeights automatically generated 415 * @param scaleFactor automatically generated 416 * @param minNeighbors automatically generated 417 * @param flags automatically generated 418 * @param minSize automatically generated 419 */ 420 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags, Size minSize) { 421 Mat objects_mat = objects; 422 Mat rejectLevels_mat = rejectLevels; 423 Mat levelWeights_mat = levelWeights; 424 detectMultiScale3_2(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags, minSize.width, minSize.height); 425 } 426 427 /** 428 * 429 * This function allows you to retrieve the final stage decision certainty of classification. 430 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 431 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 432 * This value can then be used to separate strong from weaker classifications. 433 * 434 * A code sample on how to use it efficiently can be found below: 435 * <code> 436 * Mat img; 437 * vector<double> weights; 438 * vector<int> levels; 439 * vector<Rect> detections; 440 * CascadeClassifier model("/path/to/your/model.xml"); 441 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 442 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 443 * </code> 444 * @param image automatically generated 445 * @param objects automatically generated 446 * @param rejectLevels automatically generated 447 * @param levelWeights automatically generated 448 * @param scaleFactor automatically generated 449 * @param minNeighbors automatically generated 450 * @param flags automatically generated 451 */ 452 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors, int flags) { 453 Mat objects_mat = objects; 454 Mat rejectLevels_mat = rejectLevels; 455 Mat levelWeights_mat = levelWeights; 456 detectMultiScale3_3(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors, flags); 457 } 458 459 /** 460 * 461 * This function allows you to retrieve the final stage decision certainty of classification. 462 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 463 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 464 * This value can then be used to separate strong from weaker classifications. 465 * 466 * A code sample on how to use it efficiently can be found below: 467 * <code> 468 * Mat img; 469 * vector<double> weights; 470 * vector<int> levels; 471 * vector<Rect> detections; 472 * CascadeClassifier model("/path/to/your/model.xml"); 473 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 474 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 475 * </code> 476 * @param image automatically generated 477 * @param objects automatically generated 478 * @param rejectLevels automatically generated 479 * @param levelWeights automatically generated 480 * @param scaleFactor automatically generated 481 * @param minNeighbors automatically generated 482 */ 483 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor, int minNeighbors) { 484 Mat objects_mat = objects; 485 Mat rejectLevels_mat = rejectLevels; 486 Mat levelWeights_mat = levelWeights; 487 detectMultiScale3_4(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor, minNeighbors); 488 } 489 490 /** 491 * 492 * This function allows you to retrieve the final stage decision certainty of classification. 493 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 494 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 495 * This value can then be used to separate strong from weaker classifications. 496 * 497 * A code sample on how to use it efficiently can be found below: 498 * <code> 499 * Mat img; 500 * vector<double> weights; 501 * vector<int> levels; 502 * vector<Rect> detections; 503 * CascadeClassifier model("/path/to/your/model.xml"); 504 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 505 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 506 * </code> 507 * @param image automatically generated 508 * @param objects automatically generated 509 * @param rejectLevels automatically generated 510 * @param levelWeights automatically generated 511 * @param scaleFactor automatically generated 512 */ 513 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights, double scaleFactor) { 514 Mat objects_mat = objects; 515 Mat rejectLevels_mat = rejectLevels; 516 Mat levelWeights_mat = levelWeights; 517 detectMultiScale3_5(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj, scaleFactor); 518 } 519 520 /** 521 * 522 * This function allows you to retrieve the final stage decision certainty of classification. 523 * For this, one needs to set {@code outputRejectLevels} on true and provide the {@code rejectLevels} and {@code levelWeights} parameter. 524 * For each resulting detection, {@code levelWeights} will then contain the certainty of classification at the final stage. 525 * This value can then be used to separate strong from weaker classifications. 526 * 527 * A code sample on how to use it efficiently can be found below: 528 * <code> 529 * Mat img; 530 * vector<double> weights; 531 * vector<int> levels; 532 * vector<Rect> detections; 533 * CascadeClassifier model("/path/to/your/model.xml"); 534 * model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true); 535 * cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl; 536 * </code> 537 * @param image automatically generated 538 * @param objects automatically generated 539 * @param rejectLevels automatically generated 540 * @param levelWeights automatically generated 541 */ 542 public void detectMultiScale3(Mat image, MatOfRect objects, MatOfInt rejectLevels, MatOfDouble levelWeights) { 543 Mat objects_mat = objects; 544 Mat rejectLevels_mat = rejectLevels; 545 Mat levelWeights_mat = levelWeights; 546 detectMultiScale3_6(nativeObj, image.nativeObj, objects_mat.nativeObj, rejectLevels_mat.nativeObj, levelWeights_mat.nativeObj); 547 } 548 549 550 // 551 // C++: bool cv::CascadeClassifier::isOldFormatCascade() 552 // 553 554 public boolean isOldFormatCascade() { 555 return isOldFormatCascade_0(nativeObj); 556 } 557 558 559 // 560 // C++: Size cv::CascadeClassifier::getOriginalWindowSize() 561 // 562 563 public Size getOriginalWindowSize() { 564 return new Size(getOriginalWindowSize_0(nativeObj)); 565 } 566 567 568 // 569 // C++: int cv::CascadeClassifier::getFeatureType() 570 // 571 572 public int getFeatureType() { 573 return getFeatureType_0(nativeObj); 574 } 575 576 577 // 578 // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade) 579 // 580 581 public static boolean convert(String oldcascade, String newcascade) { 582 return convert_0(oldcascade, newcascade); 583 } 584 585 586 @Override 587 protected void finalize() throws Throwable { 588 delete(nativeObj); 589 } 590 591 592 593 // C++: cv::CascadeClassifier::CascadeClassifier() 594 private static native long CascadeClassifier_0(); 595 596 // C++: cv::CascadeClassifier::CascadeClassifier(String filename) 597 private static native long CascadeClassifier_1(String filename); 598 599 // C++: bool cv::CascadeClassifier::empty() 600 private static native boolean empty_0(long nativeObj); 601 602 // C++: bool cv::CascadeClassifier::load(String filename) 603 private static native boolean load_0(long nativeObj, String filename); 604 605 // 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()) 606 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); 607 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); 608 private static native void detectMultiScale_2(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors, int flags); 609 private static native void detectMultiScale_3(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor, int minNeighbors); 610 private static native void detectMultiScale_4(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, double scaleFactor); 611 private static native void detectMultiScale_5(long nativeObj, long image_nativeObj, long objects_mat_nativeObj); 612 613 // 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()) 614 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); 615 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); 616 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); 617 private static native void detectMultiScale2_3(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor, int minNeighbors); 618 private static native void detectMultiScale2_4(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj, double scaleFactor); 619 private static native void detectMultiScale2_5(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long numDetections_mat_nativeObj); 620 621 // 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) 622 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); 623 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); 624 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); 625 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); 626 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); 627 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); 628 private static native void detectMultiScale3_6(long nativeObj, long image_nativeObj, long objects_mat_nativeObj, long rejectLevels_mat_nativeObj, long levelWeights_mat_nativeObj); 629 630 // C++: bool cv::CascadeClassifier::isOldFormatCascade() 631 private static native boolean isOldFormatCascade_0(long nativeObj); 632 633 // C++: Size cv::CascadeClassifier::getOriginalWindowSize() 634 private static native double[] getOriginalWindowSize_0(long nativeObj); 635 636 // C++: int cv::CascadeClassifier::getFeatureType() 637 private static native int getFeatureType_0(long nativeObj); 638 639 // C++: static bool cv::CascadeClassifier::convert(String oldcascade, String newcascade) 640 private static native boolean convert_0(String oldcascade, String newcascade); 641 642 // native support for java finalize() 643 private static native void delete(long nativeObj); 644 645}