1 2 // 3 // This file is auto-generated, please don't edit! 4 // 5 6 #define LOG_TAG "org.opencv.objdetect" 7 8 #include "common.h" 9 10 #include "opencv2/opencv_modules.hpp" 11 #ifdef HAVE_OPENCV_OBJDETECT 12 13 #include <string> 14 15 #include "opencv2/objdetect.hpp" 16 17 #include "../../objdetect/include/opencv2/objdetect.hpp" 18 #include "../../objdetect/include/opencv2/objdetect/detection_based_tracker.hpp" 19 20 using namespace cv; 21 22 /// throw java exception 23 static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) { 24 std::string what = "unknown exception"; 25 jclass je = 0; 26 27 if(e) { 28 std::string exception_type = "std::exception"; 29 30 if(dynamic_cast<const cv::Exception*>(e)) { 31 exception_type = "cv::Exception"; 32 je = env->FindClass("org/opencv/core/CvException"); 33 } 34 35 what = exception_type + ": " + e->what(); 36 } 37 38 if(!je) je = env->FindClass("java/lang/Exception"); 39 env->ThrowNew(je, what.c_str()); 40 41 LOGE("%s caught %s", method, what.c_str()); 42 (void)method; // avoid "unused" warning 43 } 44 45 46 extern "C" { 47 48 49 // 50 // CascadeClassifier() 51 // 52 53 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_10 (JNIEnv*, jclass); 54 55 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_10 56 (JNIEnv* env, jclass ) 57 { 58 static const char method_name[] = "objdetect::CascadeClassifier_10()"; 59 try { 60 LOGD("%s", method_name); 61 62 cv::CascadeClassifier* _retval_ = new cv::CascadeClassifier( ); 63 return (jlong) _retval_; 64 } catch(const std::exception &e) { 65 throwJavaException(env, &e, method_name); 66 } catch (...) { 67 throwJavaException(env, 0, method_name); 68 } 69 return 0; 70 } 71 72 73 74 // 75 // CascadeClassifier(String filename) 76 // 77 78 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11 (JNIEnv*, jclass, jstring); 79 80 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_CascadeClassifier_CascadeClassifier_11 81 (JNIEnv* env, jclass , jstring filename) 82 { 83 static const char method_name[] = "objdetect::CascadeClassifier_11()"; 84 try { 85 LOGD("%s", method_name); 86 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 87 cv::CascadeClassifier* _retval_ = new cv::CascadeClassifier( n_filename ); 88 return (jlong) _retval_; 89 } catch(const std::exception &e) { 90 throwJavaException(env, &e, method_name); 91 } catch (...) { 92 throwJavaException(env, 0, method_name); 93 } 94 return 0; 95 } 96 97 98 99 // 100 // bool empty() 101 // 102 103 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_empty_10 (JNIEnv*, jclass, jlong); 104 105 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_empty_10 106 (JNIEnv* env, jclass , jlong self) 107 { 108 static const char method_name[] = "objdetect::empty_10()"; 109 try { 110 LOGD("%s", method_name); 111 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 112 bool _retval_ = me->empty( ); 113 return _retval_; 114 } catch(const std::exception &e) { 115 throwJavaException(env, &e, method_name); 116 } catch (...) { 117 throwJavaException(env, 0, method_name); 118 } 119 return 0; 120 } 121 122 123 124 // 125 // bool load(String filename) 126 // 127 128 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_load_10 (JNIEnv*, jclass, jlong, jstring); 129 130 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_load_10 131 (JNIEnv* env, jclass , jlong self, jstring filename) 132 { 133 static const char method_name[] = "objdetect::load_10()"; 134 try { 135 LOGD("%s", method_name); 136 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 137 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 138 bool _retval_ = me->load( n_filename ); 139 return _retval_; 140 } catch(const std::exception &e) { 141 throwJavaException(env, &e, method_name); 142 } catch (...) { 143 throwJavaException(env, 0, method_name); 144 } 145 return 0; 146 } 147 148 149 150 // 151 // void detectMultiScale(Mat image, vector_Rect& objects, double scaleFactor = 1.1, int minNeighbors = 3, int flags = 0, Size minSize = Size(), Size maxSize = Size()) 152 // 153 154 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale_10 (JNIEnv*, jclass, jlong, jlong, jlong, jdouble, jint, jint, jdouble, jdouble, jdouble, jdouble); 155 156 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale_10 157 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj, jdouble scaleFactor, jint minNeighbors, jint flags, jdouble minSize_width, jdouble minSize_height, jdouble maxSize_width, jdouble maxSize_height) 158 { 159 static const char method_name[] = "objdetect::detectMultiScale_10()"; 160 try { 161 LOGD("%s", method_name); 162 std::vector<Rect> objects; 163 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 164 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 165 Mat& image = *((Mat*)image_nativeObj); 166 Size minSize((int)minSize_width, (int)minSize_height); 167 Size maxSize((int)maxSize_width, (int)maxSize_height); 168 me->detectMultiScale( image, objects, (double)scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize ); 169 vector_Rect_to_Mat( objects, objects_mat ); 170 return; 171 } catch(const std::exception &e) { 172 throwJavaException(env, &e, method_name); 173 } catch (...) { 174 throwJavaException(env, 0, method_name); 175 } 176 return; 177 } 178 179 180 181 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale_11 (JNIEnv*, jclass, jlong, jlong, jlong); 182 183 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale_11 184 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj) 185 { 186 static const char method_name[] = "objdetect::detectMultiScale_11()"; 187 try { 188 LOGD("%s", method_name); 189 std::vector<Rect> objects; 190 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 191 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 192 Mat& image = *((Mat*)image_nativeObj); 193 me->detectMultiScale( image, objects ); 194 vector_Rect_to_Mat( objects, objects_mat ); 195 return; 196 } catch(const std::exception &e) { 197 throwJavaException(env, &e, method_name); 198 } catch (...) { 199 throwJavaException(env, 0, method_name); 200 } 201 return; 202 } 203 204 205 206 // 207 // void 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()) 208 // 209 210 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale2_10 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jdouble, jint, jint, jdouble, jdouble, jdouble, jdouble); 211 212 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale2_10 213 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj, jlong numDetections_mat_nativeObj, jdouble scaleFactor, jint minNeighbors, jint flags, jdouble minSize_width, jdouble minSize_height, jdouble maxSize_width, jdouble maxSize_height) 214 { 215 static const char method_name[] = "objdetect::detectMultiScale2_10()"; 216 try { 217 LOGD("%s", method_name); 218 std::vector<Rect> objects; 219 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 220 std::vector<int> numDetections; 221 Mat& numDetections_mat = *((Mat*)numDetections_mat_nativeObj); 222 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 223 Mat& image = *((Mat*)image_nativeObj); 224 Size minSize((int)minSize_width, (int)minSize_height); 225 Size maxSize((int)maxSize_width, (int)maxSize_height); 226 me->detectMultiScale( image, objects, numDetections, (double)scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize ); 227 vector_Rect_to_Mat( objects, objects_mat ); vector_int_to_Mat( numDetections, numDetections_mat ); 228 return; 229 } catch(const std::exception &e) { 230 throwJavaException(env, &e, method_name); 231 } catch (...) { 232 throwJavaException(env, 0, method_name); 233 } 234 return; 235 } 236 237 238 239 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale2_11 (JNIEnv*, jclass, jlong, jlong, jlong, jlong); 240 241 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale2_11 242 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj, jlong numDetections_mat_nativeObj) 243 { 244 static const char method_name[] = "objdetect::detectMultiScale2_11()"; 245 try { 246 LOGD("%s", method_name); 247 std::vector<Rect> objects; 248 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 249 std::vector<int> numDetections; 250 Mat& numDetections_mat = *((Mat*)numDetections_mat_nativeObj); 251 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 252 Mat& image = *((Mat*)image_nativeObj); 253 me->detectMultiScale( image, objects, numDetections ); 254 vector_Rect_to_Mat( objects, objects_mat ); vector_int_to_Mat( numDetections, numDetections_mat ); 255 return; 256 } catch(const std::exception &e) { 257 throwJavaException(env, &e, method_name); 258 } catch (...) { 259 throwJavaException(env, 0, method_name); 260 } 261 return; 262 } 263 264 265 266 // 267 // void 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) 268 // 269 270 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale3_10 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdouble, jint, jint, jdouble, jdouble, jdouble, jdouble, jboolean); 271 272 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale3_10 273 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj, jlong rejectLevels_mat_nativeObj, jlong levelWeights_mat_nativeObj, jdouble scaleFactor, jint minNeighbors, jint flags, jdouble minSize_width, jdouble minSize_height, jdouble maxSize_width, jdouble maxSize_height, jboolean outputRejectLevels) 274 { 275 static const char method_name[] = "objdetect::detectMultiScale3_10()"; 276 try { 277 LOGD("%s", method_name); 278 std::vector<Rect> objects; 279 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 280 std::vector<int> rejectLevels; 281 Mat& rejectLevels_mat = *((Mat*)rejectLevels_mat_nativeObj); 282 std::vector<double> levelWeights; 283 Mat& levelWeights_mat = *((Mat*)levelWeights_mat_nativeObj); 284 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 285 Mat& image = *((Mat*)image_nativeObj); 286 Size minSize((int)minSize_width, (int)minSize_height); 287 Size maxSize((int)maxSize_width, (int)maxSize_height); 288 me->detectMultiScale( image, objects, rejectLevels, levelWeights, (double)scaleFactor, (int)minNeighbors, (int)flags, minSize, maxSize, (bool)outputRejectLevels ); 289 vector_Rect_to_Mat( objects, objects_mat ); vector_int_to_Mat( rejectLevels, rejectLevels_mat ); vector_double_to_Mat( levelWeights, levelWeights_mat ); 290 return; 291 } catch(const std::exception &e) { 292 throwJavaException(env, &e, method_name); 293 } catch (...) { 294 throwJavaException(env, 0, method_name); 295 } 296 return; 297 } 298 299 300 301 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale3_11 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong); 302 303 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_detectMultiScale3_11 304 (JNIEnv* env, jclass , jlong self, jlong image_nativeObj, jlong objects_mat_nativeObj, jlong rejectLevels_mat_nativeObj, jlong levelWeights_mat_nativeObj) 305 { 306 static const char method_name[] = "objdetect::detectMultiScale3_11()"; 307 try { 308 LOGD("%s", method_name); 309 std::vector<Rect> objects; 310 Mat& objects_mat = *((Mat*)objects_mat_nativeObj); 311 std::vector<int> rejectLevels; 312 Mat& rejectLevels_mat = *((Mat*)rejectLevels_mat_nativeObj); 313 std::vector<double> levelWeights; 314 Mat& levelWeights_mat = *((Mat*)levelWeights_mat_nativeObj); 315 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 316 Mat& image = *((Mat*)image_nativeObj); 317 me->detectMultiScale( image, objects, rejectLevels, levelWeights ); 318 vector_Rect_to_Mat( objects, objects_mat ); vector_int_to_Mat( rejectLevels, rejectLevels_mat ); vector_double_to_Mat( levelWeights, levelWeights_mat ); 319 return; 320 } catch(const std::exception &e) { 321 throwJavaException(env, &e, method_name); 322 } catch (...) { 323 throwJavaException(env, 0, method_name); 324 } 325 return; 326 } 327 328 329 330 // 331 // bool isOldFormatCascade() 332 // 333 334 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_isOldFormatCascade_10 (JNIEnv*, jclass, jlong); 335 336 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_isOldFormatCascade_10 337 (JNIEnv* env, jclass , jlong self) 338 { 339 static const char method_name[] = "objdetect::isOldFormatCascade_10()"; 340 try { 341 LOGD("%s", method_name); 342 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 343 bool _retval_ = me->isOldFormatCascade( ); 344 return _retval_; 345 } catch(const std::exception &e) { 346 throwJavaException(env, &e, method_name); 347 } catch (...) { 348 throwJavaException(env, 0, method_name); 349 } 350 return 0; 351 } 352 353 354 355 // 356 // Size getOriginalWindowSize() 357 // 358 359 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_CascadeClassifier_getOriginalWindowSize_10 (JNIEnv*, jclass, jlong); 360 361 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_CascadeClassifier_getOriginalWindowSize_10 362 (JNIEnv* env, jclass , jlong self) 363 { 364 static const char method_name[] = "objdetect::getOriginalWindowSize_10()"; 365 try { 366 LOGD("%s", method_name); 367 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 368 Size _retval_ = me->getOriginalWindowSize( ); 369 jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); 370 return _da_retval_; 371 } catch(const std::exception &e) { 372 throwJavaException(env, &e, method_name); 373 } catch (...) { 374 throwJavaException(env, 0, method_name); 375 } 376 return 0; 377 } 378 379 380 381 // 382 // int getFeatureType() 383 // 384 385 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_CascadeClassifier_getFeatureType_10 (JNIEnv*, jclass, jlong); 386 387 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_CascadeClassifier_getFeatureType_10 388 (JNIEnv* env, jclass , jlong self) 389 { 390 static const char method_name[] = "objdetect::getFeatureType_10()"; 391 try { 392 LOGD("%s", method_name); 393 cv::CascadeClassifier* me = (cv::CascadeClassifier*) self; //TODO: check for NULL 394 int _retval_ = me->getFeatureType( ); 395 return _retval_; 396 } catch(const std::exception &e) { 397 throwJavaException(env, &e, method_name); 398 } catch (...) { 399 throwJavaException(env, 0, method_name); 400 } 401 return 0; 402 } 403 404 405 406 // 407 // static bool convert(String oldcascade, String newcascade) 408 // 409 410 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_convert_10 (JNIEnv*, jclass, jstring, jstring); 411 412 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_CascadeClassifier_convert_10 413 (JNIEnv* env, jclass , jstring oldcascade, jstring newcascade) 414 { 415 static const char method_name[] = "objdetect::convert_10()"; 416 try { 417 LOGD("%s", method_name); 418 const char* utf_oldcascade = env->GetStringUTFChars(oldcascade, 0); String n_oldcascade( utf_oldcascade ? utf_oldcascade : "" ); env->ReleaseStringUTFChars(oldcascade, utf_oldcascade); 419 const char* utf_newcascade = env->GetStringUTFChars(newcascade, 0); String n_newcascade( utf_newcascade ? utf_newcascade : "" ); env->ReleaseStringUTFChars(newcascade, utf_newcascade); 420 bool _retval_ = cv::CascadeClassifier::convert( n_oldcascade, n_newcascade ); 421 return _retval_; 422 } catch(const std::exception &e) { 423 throwJavaException(env, &e, method_name); 424 } catch (...) { 425 throwJavaException(env, 0, method_name); 426 } 427 return 0; 428 } 429 430 431 432 // 433 // native support for java finalize() 434 // static void cv::CascadeClassifier::delete( __int64 self ) 435 // 436 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_delete(JNIEnv*, jclass, jlong); 437 438 JNIEXPORT void JNICALL Java_org_opencv_objdetect_CascadeClassifier_delete 439 (JNIEnv*, jclass, jlong self) 440 { 441 delete (cv::CascadeClassifier*) self; 442 } 443 444 445 // 446 // native support for java finalize() 447 // static void Ptr<cv::BaseCascadeClassifier>::delete( __int64 self ) 448 // 449 JNIEXPORT void JNICALL Java_org_opencv_objdetect_BaseCascadeClassifier_delete(JNIEnv*, jclass, jlong); 450 451 JNIEXPORT void JNICALL Java_org_opencv_objdetect_BaseCascadeClassifier_delete 452 (JNIEnv*, jclass, jlong self) 453 { 454 delete (Ptr<cv::BaseCascadeClassifier>*) self; 455 } 456 457 458 // 459 // HOGDescriptor() 460 // 461 462 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_10 (JNIEnv*, jclass); 463 464 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_10 465 (JNIEnv* env, jclass ) 466 { 467 static const char method_name[] = "objdetect::HOGDescriptor_10()"; 468 try { 469 LOGD("%s", method_name); 470 471 cv::HOGDescriptor* _retval_ = new cv::HOGDescriptor( ); 472 return (jlong) _retval_; 473 } catch(const std::exception &e) { 474 throwJavaException(env, &e, method_name); 475 } catch (...) { 476 throwJavaException(env, 0, method_name); 477 } 478 return 0; 479 } 480 481 482 483 // 484 // HOGDescriptor(Size _winSize, Size _blockSize, Size _blockStride, Size _cellSize, int _nbins, int _derivAperture = 1, double _winSigma = -1, int _histogramNormType = HOGDescriptor::L2Hys, double _L2HysThreshold = 0.2, bool _gammaCorrection = false, int _nlevels = HOGDescriptor::DEFAULT_NLEVELS, bool _signedGradient = false) 485 // 486 487 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_11 (JNIEnv*, jclass, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jint, jint, jdouble, jint, jdouble, jboolean, jint, jboolean); 488 489 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_11 490 (JNIEnv* env, jclass , jdouble _winSize_width, jdouble _winSize_height, jdouble _blockSize_width, jdouble _blockSize_height, jdouble _blockStride_width, jdouble _blockStride_height, jdouble _cellSize_width, jdouble _cellSize_height, jint _nbins, jint _derivAperture, jdouble _winSigma, jint _histogramNormType, jdouble _L2HysThreshold, jboolean _gammaCorrection, jint _nlevels, jboolean _signedGradient) 491 { 492 static const char method_name[] = "objdetect::HOGDescriptor_11()"; 493 try { 494 LOGD("%s", method_name); 495 Size _winSize((int)_winSize_width, (int)_winSize_height); 496 Size _blockSize((int)_blockSize_width, (int)_blockSize_height); 497 Size _blockStride((int)_blockStride_width, (int)_blockStride_height); 498 Size _cellSize((int)_cellSize_width, (int)_cellSize_height); 499 cv::HOGDescriptor* _retval_ = new cv::HOGDescriptor( _winSize, _blockSize, _blockStride, _cellSize, (int)_nbins, (int)_derivAperture, (double)_winSigma, (int)_histogramNormType, (double)_L2HysThreshold, (bool)_gammaCorrection, (int)_nlevels, (bool)_signedGradient ); 500 return (jlong) _retval_; 501 } catch(const std::exception &e) { 502 throwJavaException(env, &e, method_name); 503 } catch (...) { 504 throwJavaException(env, 0, method_name); 505 } 506 return 0; 507 } 508 509 510 511 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_12 (JNIEnv*, jclass, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jint); 512 513 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_12 514 (JNIEnv* env, jclass , jdouble _winSize_width, jdouble _winSize_height, jdouble _blockSize_width, jdouble _blockSize_height, jdouble _blockStride_width, jdouble _blockStride_height, jdouble _cellSize_width, jdouble _cellSize_height, jint _nbins) 515 { 516 static const char method_name[] = "objdetect::HOGDescriptor_12()"; 517 try { 518 LOGD("%s", method_name); 519 Size _winSize((int)_winSize_width, (int)_winSize_height); 520 Size _blockSize((int)_blockSize_width, (int)_blockSize_height); 521 Size _blockStride((int)_blockStride_width, (int)_blockStride_height); 522 Size _cellSize((int)_cellSize_width, (int)_cellSize_height); 523 cv::HOGDescriptor* _retval_ = new cv::HOGDescriptor( _winSize, _blockSize, _blockStride, _cellSize, (int)_nbins ); 524 return (jlong) _retval_; 525 } catch(const std::exception &e) { 526 throwJavaException(env, &e, method_name); 527 } catch (...) { 528 throwJavaException(env, 0, method_name); 529 } 530 return 0; 531 } 532 533 534 535 // 536 // HOGDescriptor(String filename) 537 // 538 539 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_13 (JNIEnv*, jclass, jstring); 540 541 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_HOGDescriptor_13 542 (JNIEnv* env, jclass , jstring filename) 543 { 544 static const char method_name[] = "objdetect::HOGDescriptor_13()"; 545 try { 546 LOGD("%s", method_name); 547 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 548 cv::HOGDescriptor* _retval_ = new cv::HOGDescriptor( n_filename ); 549 return (jlong) _retval_; 550 } catch(const std::exception &e) { 551 throwJavaException(env, &e, method_name); 552 } catch (...) { 553 throwJavaException(env, 0, method_name); 554 } 555 return 0; 556 } 557 558 559 560 // 561 // size_t getDescriptorSize() 562 // 563 564 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDescriptorSize_10 (JNIEnv*, jclass, jlong); 565 566 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDescriptorSize_10 567 (JNIEnv* env, jclass , jlong self) 568 { 569 static const char method_name[] = "objdetect::getDescriptorSize_10()"; 570 try { 571 LOGD("%s", method_name); 572 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 573 size_t _retval_ = me->getDescriptorSize( ); 574 return _retval_; 575 } catch(const std::exception &e) { 576 throwJavaException(env, &e, method_name); 577 } catch (...) { 578 throwJavaException(env, 0, method_name); 579 } 580 return 0; 581 } 582 583 584 585 // 586 // bool checkDetectorSize() 587 // 588 589 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_checkDetectorSize_10 (JNIEnv*, jclass, jlong); 590 591 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_checkDetectorSize_10 592 (JNIEnv* env, jclass , jlong self) 593 { 594 static const char method_name[] = "objdetect::checkDetectorSize_10()"; 595 try { 596 LOGD("%s", method_name); 597 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 598 bool _retval_ = me->checkDetectorSize( ); 599 return _retval_; 600 } catch(const std::exception &e) { 601 throwJavaException(env, &e, method_name); 602 } catch (...) { 603 throwJavaException(env, 0, method_name); 604 } 605 return 0; 606 } 607 608 609 610 // 611 // double getWinSigma() 612 // 613 614 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_getWinSigma_10 (JNIEnv*, jclass, jlong); 615 616 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_getWinSigma_10 617 (JNIEnv* env, jclass , jlong self) 618 { 619 static const char method_name[] = "objdetect::getWinSigma_10()"; 620 try { 621 LOGD("%s", method_name); 622 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 623 double _retval_ = me->getWinSigma( ); 624 return _retval_; 625 } catch(const std::exception &e) { 626 throwJavaException(env, &e, method_name); 627 } catch (...) { 628 throwJavaException(env, 0, method_name); 629 } 630 return 0; 631 } 632 633 634 635 // 636 // void setSVMDetector(Mat _svmdetector) 637 // 638 639 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_setSVMDetector_10 (JNIEnv*, jclass, jlong, jlong); 640 641 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_setSVMDetector_10 642 (JNIEnv* env, jclass , jlong self, jlong _svmdetector_nativeObj) 643 { 644 static const char method_name[] = "objdetect::setSVMDetector_10()"; 645 try { 646 LOGD("%s", method_name); 647 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 648 Mat& _svmdetector = *((Mat*)_svmdetector_nativeObj); 649 me->setSVMDetector( _svmdetector ); 650 return; 651 } catch(const std::exception &e) { 652 throwJavaException(env, &e, method_name); 653 } catch (...) { 654 throwJavaException(env, 0, method_name); 655 } 656 return; 657 } 658 659 660 661 // 662 // bool load(String filename, String objname = String()) 663 // 664 665 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_load_10 (JNIEnv*, jclass, jlong, jstring, jstring); 666 667 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_load_10 668 (JNIEnv* env, jclass , jlong self, jstring filename, jstring objname) 669 { 670 static const char method_name[] = "objdetect::load_10()"; 671 try { 672 LOGD("%s", method_name); 673 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 674 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 675 const char* utf_objname = env->GetStringUTFChars(objname, 0); String n_objname( utf_objname ? utf_objname : "" ); env->ReleaseStringUTFChars(objname, utf_objname); 676 bool _retval_ = me->load( n_filename, n_objname ); 677 return _retval_; 678 } catch(const std::exception &e) { 679 throwJavaException(env, &e, method_name); 680 } catch (...) { 681 throwJavaException(env, 0, method_name); 682 } 683 return 0; 684 } 685 686 687 688 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_load_11 (JNIEnv*, jclass, jlong, jstring); 689 690 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_load_11 691 (JNIEnv* env, jclass , jlong self, jstring filename) 692 { 693 static const char method_name[] = "objdetect::load_11()"; 694 try { 695 LOGD("%s", method_name); 696 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 697 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 698 bool _retval_ = me->load( n_filename ); 699 return _retval_; 700 } catch(const std::exception &e) { 701 throwJavaException(env, &e, method_name); 702 } catch (...) { 703 throwJavaException(env, 0, method_name); 704 } 705 return 0; 706 } 707 708 709 710 // 711 // void save(String filename, String objname = String()) 712 // 713 714 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_save_10 (JNIEnv*, jclass, jlong, jstring, jstring); 715 716 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_save_10 717 (JNIEnv* env, jclass , jlong self, jstring filename, jstring objname) 718 { 719 static const char method_name[] = "objdetect::save_10()"; 720 try { 721 LOGD("%s", method_name); 722 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 723 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 724 const char* utf_objname = env->GetStringUTFChars(objname, 0); String n_objname( utf_objname ? utf_objname : "" ); env->ReleaseStringUTFChars(objname, utf_objname); 725 me->save( n_filename, n_objname ); 726 return; 727 } catch(const std::exception &e) { 728 throwJavaException(env, &e, method_name); 729 } catch (...) { 730 throwJavaException(env, 0, method_name); 731 } 732 return; 733 } 734 735 736 737 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_save_11 (JNIEnv*, jclass, jlong, jstring); 738 739 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_save_11 740 (JNIEnv* env, jclass , jlong self, jstring filename) 741 { 742 static const char method_name[] = "objdetect::save_11()"; 743 try { 744 LOGD("%s", method_name); 745 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 746 const char* utf_filename = env->GetStringUTFChars(filename, 0); String n_filename( utf_filename ? utf_filename : "" ); env->ReleaseStringUTFChars(filename, utf_filename); 747 me->save( n_filename ); 748 return; 749 } catch(const std::exception &e) { 750 throwJavaException(env, &e, method_name); 751 } catch (...) { 752 throwJavaException(env, 0, method_name); 753 } 754 return; 755 } 756 757 758 759 // 760 // void compute(Mat img, vector_float& descriptors, Size winStride = Size(), Size padding = Size(), vector_Point locations = std::vector<Point>()) 761 // 762 763 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_compute_10 (JNIEnv*, jclass, jlong, jlong, jlong, jdouble, jdouble, jdouble, jdouble, jlong); 764 765 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_compute_10 766 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong descriptors_mat_nativeObj, jdouble winStride_width, jdouble winStride_height, jdouble padding_width, jdouble padding_height, jlong locations_mat_nativeObj) 767 { 768 static const char method_name[] = "objdetect::compute_10()"; 769 try { 770 LOGD("%s", method_name); 771 std::vector<float> descriptors; 772 Mat& descriptors_mat = *((Mat*)descriptors_mat_nativeObj); 773 std::vector<Point> locations; 774 Mat& locations_mat = *((Mat*)locations_mat_nativeObj); 775 Mat_to_vector_Point( locations_mat, locations ); 776 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 777 Mat& img = *((Mat*)img_nativeObj); 778 Size winStride((int)winStride_width, (int)winStride_height); 779 Size padding((int)padding_width, (int)padding_height); 780 me->compute( img, descriptors, winStride, padding, locations ); 781 vector_float_to_Mat( descriptors, descriptors_mat ); 782 return; 783 } catch(const std::exception &e) { 784 throwJavaException(env, &e, method_name); 785 } catch (...) { 786 throwJavaException(env, 0, method_name); 787 } 788 return; 789 } 790 791 792 793 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_compute_11 (JNIEnv*, jclass, jlong, jlong, jlong); 794 795 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_compute_11 796 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong descriptors_mat_nativeObj) 797 { 798 static const char method_name[] = "objdetect::compute_11()"; 799 try { 800 LOGD("%s", method_name); 801 std::vector<float> descriptors; 802 Mat& descriptors_mat = *((Mat*)descriptors_mat_nativeObj); 803 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 804 Mat& img = *((Mat*)img_nativeObj); 805 me->compute( img, descriptors ); 806 vector_float_to_Mat( descriptors, descriptors_mat ); 807 return; 808 } catch(const std::exception &e) { 809 throwJavaException(env, &e, method_name); 810 } catch (...) { 811 throwJavaException(env, 0, method_name); 812 } 813 return; 814 } 815 816 817 818 // 819 // void detect(Mat img, vector_Point& foundLocations, vector_double& weights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), vector_Point searchLocations = std::vector<Point>()) 820 // 821 822 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detect_10 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jlong); 823 824 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detect_10 825 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong foundLocations_mat_nativeObj, jlong weights_mat_nativeObj, jdouble hitThreshold, jdouble winStride_width, jdouble winStride_height, jdouble padding_width, jdouble padding_height, jlong searchLocations_mat_nativeObj) 826 { 827 static const char method_name[] = "objdetect::detect_10()"; 828 try { 829 LOGD("%s", method_name); 830 std::vector<Point> foundLocations; 831 Mat& foundLocations_mat = *((Mat*)foundLocations_mat_nativeObj); 832 std::vector<double> weights; 833 Mat& weights_mat = *((Mat*)weights_mat_nativeObj); 834 std::vector<Point> searchLocations; 835 Mat& searchLocations_mat = *((Mat*)searchLocations_mat_nativeObj); 836 Mat_to_vector_Point( searchLocations_mat, searchLocations ); 837 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 838 Mat& img = *((Mat*)img_nativeObj); 839 Size winStride((int)winStride_width, (int)winStride_height); 840 Size padding((int)padding_width, (int)padding_height); 841 me->detect( img, foundLocations, weights, (double)hitThreshold, winStride, padding, searchLocations ); 842 vector_Point_to_Mat( foundLocations, foundLocations_mat ); vector_double_to_Mat( weights, weights_mat ); 843 return; 844 } catch(const std::exception &e) { 845 throwJavaException(env, &e, method_name); 846 } catch (...) { 847 throwJavaException(env, 0, method_name); 848 } 849 return; 850 } 851 852 853 854 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detect_11 (JNIEnv*, jclass, jlong, jlong, jlong, jlong); 855 856 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detect_11 857 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong foundLocations_mat_nativeObj, jlong weights_mat_nativeObj) 858 { 859 static const char method_name[] = "objdetect::detect_11()"; 860 try { 861 LOGD("%s", method_name); 862 std::vector<Point> foundLocations; 863 Mat& foundLocations_mat = *((Mat*)foundLocations_mat_nativeObj); 864 std::vector<double> weights; 865 Mat& weights_mat = *((Mat*)weights_mat_nativeObj); 866 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 867 Mat& img = *((Mat*)img_nativeObj); 868 me->detect( img, foundLocations, weights ); 869 vector_Point_to_Mat( foundLocations, foundLocations_mat ); vector_double_to_Mat( weights, weights_mat ); 870 return; 871 } catch(const std::exception &e) { 872 throwJavaException(env, &e, method_name); 873 } catch (...) { 874 throwJavaException(env, 0, method_name); 875 } 876 return; 877 } 878 879 880 881 // 882 // void detectMultiScale(Mat img, vector_Rect& foundLocations, vector_double& foundWeights, double hitThreshold = 0, Size winStride = Size(), Size padding = Size(), double scale = 1.05, double finalThreshold = 2.0, bool useMeanshiftGrouping = false) 883 // 884 885 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detectMultiScale_10 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble, jboolean); 886 887 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detectMultiScale_10 888 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong foundLocations_mat_nativeObj, jlong foundWeights_mat_nativeObj, jdouble hitThreshold, jdouble winStride_width, jdouble winStride_height, jdouble padding_width, jdouble padding_height, jdouble scale, jdouble finalThreshold, jboolean useMeanshiftGrouping) 889 { 890 static const char method_name[] = "objdetect::detectMultiScale_10()"; 891 try { 892 LOGD("%s", method_name); 893 std::vector<Rect> foundLocations; 894 Mat& foundLocations_mat = *((Mat*)foundLocations_mat_nativeObj); 895 std::vector<double> foundWeights; 896 Mat& foundWeights_mat = *((Mat*)foundWeights_mat_nativeObj); 897 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 898 Mat& img = *((Mat*)img_nativeObj); 899 Size winStride((int)winStride_width, (int)winStride_height); 900 Size padding((int)padding_width, (int)padding_height); 901 me->detectMultiScale( img, foundLocations, foundWeights, (double)hitThreshold, winStride, padding, (double)scale, (double)finalThreshold, (bool)useMeanshiftGrouping ); 902 vector_Rect_to_Mat( foundLocations, foundLocations_mat ); vector_double_to_Mat( foundWeights, foundWeights_mat ); 903 return; 904 } catch(const std::exception &e) { 905 throwJavaException(env, &e, method_name); 906 } catch (...) { 907 throwJavaException(env, 0, method_name); 908 } 909 return; 910 } 911 912 913 914 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detectMultiScale_11 (JNIEnv*, jclass, jlong, jlong, jlong, jlong); 915 916 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_detectMultiScale_11 917 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong foundLocations_mat_nativeObj, jlong foundWeights_mat_nativeObj) 918 { 919 static const char method_name[] = "objdetect::detectMultiScale_11()"; 920 try { 921 LOGD("%s", method_name); 922 std::vector<Rect> foundLocations; 923 Mat& foundLocations_mat = *((Mat*)foundLocations_mat_nativeObj); 924 std::vector<double> foundWeights; 925 Mat& foundWeights_mat = *((Mat*)foundWeights_mat_nativeObj); 926 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 927 Mat& img = *((Mat*)img_nativeObj); 928 me->detectMultiScale( img, foundLocations, foundWeights ); 929 vector_Rect_to_Mat( foundLocations, foundLocations_mat ); vector_double_to_Mat( foundWeights, foundWeights_mat ); 930 return; 931 } catch(const std::exception &e) { 932 throwJavaException(env, &e, method_name); 933 } catch (...) { 934 throwJavaException(env, 0, method_name); 935 } 936 return; 937 } 938 939 940 941 // 942 // void computeGradient(Mat img, Mat& grad, Mat& angleOfs, Size paddingTL = Size(), Size paddingBR = Size()) 943 // 944 945 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_computeGradient_10 (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jdouble, jdouble, jdouble, jdouble); 946 947 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_computeGradient_10 948 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong grad_nativeObj, jlong angleOfs_nativeObj, jdouble paddingTL_width, jdouble paddingTL_height, jdouble paddingBR_width, jdouble paddingBR_height) 949 { 950 static const char method_name[] = "objdetect::computeGradient_10()"; 951 try { 952 LOGD("%s", method_name); 953 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 954 Mat& img = *((Mat*)img_nativeObj); 955 Mat& grad = *((Mat*)grad_nativeObj); 956 Mat& angleOfs = *((Mat*)angleOfs_nativeObj); 957 Size paddingTL((int)paddingTL_width, (int)paddingTL_height); 958 Size paddingBR((int)paddingBR_width, (int)paddingBR_height); 959 me->computeGradient( img, grad, angleOfs, paddingTL, paddingBR ); 960 return; 961 } catch(const std::exception &e) { 962 throwJavaException(env, &e, method_name); 963 } catch (...) { 964 throwJavaException(env, 0, method_name); 965 } 966 return; 967 } 968 969 970 971 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_computeGradient_11 (JNIEnv*, jclass, jlong, jlong, jlong, jlong); 972 973 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_computeGradient_11 974 (JNIEnv* env, jclass , jlong self, jlong img_nativeObj, jlong grad_nativeObj, jlong angleOfs_nativeObj) 975 { 976 static const char method_name[] = "objdetect::computeGradient_11()"; 977 try { 978 LOGD("%s", method_name); 979 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 980 Mat& img = *((Mat*)img_nativeObj); 981 Mat& grad = *((Mat*)grad_nativeObj); 982 Mat& angleOfs = *((Mat*)angleOfs_nativeObj); 983 me->computeGradient( img, grad, angleOfs ); 984 return; 985 } catch(const std::exception &e) { 986 throwJavaException(env, &e, method_name); 987 } catch (...) { 988 throwJavaException(env, 0, method_name); 989 } 990 return; 991 } 992 993 994 995 // 996 // static vector_float getDefaultPeopleDetector() 997 // 998 999 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDefaultPeopleDetector_10 (JNIEnv*, jclass); 1000 1001 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDefaultPeopleDetector_10 1002 (JNIEnv* env, jclass ) 1003 { 1004 static const char method_name[] = "objdetect::getDefaultPeopleDetector_10()"; 1005 try { 1006 LOGD("%s", method_name); 1007 1008 std::vector<float> _ret_val_vector_ = cv::HOGDescriptor::getDefaultPeopleDetector( ); 1009 Mat* _retval_ = new Mat(); vector_float_to_Mat(_ret_val_vector_, *_retval_); 1010 return (jlong) _retval_; 1011 } catch(const std::exception &e) { 1012 throwJavaException(env, &e, method_name); 1013 } catch (...) { 1014 throwJavaException(env, 0, method_name); 1015 } 1016 return 0; 1017 } 1018 1019 1020 1021 // 1022 // static vector_float getDaimlerPeopleDetector() 1023 // 1024 1025 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDaimlerPeopleDetector_10 (JNIEnv*, jclass); 1026 1027 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_getDaimlerPeopleDetector_10 1028 (JNIEnv* env, jclass ) 1029 { 1030 static const char method_name[] = "objdetect::getDaimlerPeopleDetector_10()"; 1031 try { 1032 LOGD("%s", method_name); 1033 1034 std::vector<float> _ret_val_vector_ = cv::HOGDescriptor::getDaimlerPeopleDetector( ); 1035 Mat* _retval_ = new Mat(); vector_float_to_Mat(_ret_val_vector_, *_retval_); 1036 return (jlong) _retval_; 1037 } catch(const std::exception &e) { 1038 throwJavaException(env, &e, method_name); 1039 } catch (...) { 1040 throwJavaException(env, 0, method_name); 1041 } 1042 return 0; 1043 } 1044 1045 1046 1047 // 1048 // Size HOGDescriptor::winSize 1049 // 1050 1051 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1winSize_10 (JNIEnv*, jclass, jlong); 1052 1053 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1winSize_10 1054 (JNIEnv* env, jclass , jlong self) 1055 { 1056 static const char method_name[] = "objdetect::get_1winSize_10()"; 1057 try { 1058 LOGD("%s", method_name); 1059 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1060 Size _retval_ = me->winSize;//( ); 1061 jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); 1062 return _da_retval_; 1063 } catch(const std::exception &e) { 1064 throwJavaException(env, &e, method_name); 1065 } catch (...) { 1066 throwJavaException(env, 0, method_name); 1067 } 1068 return 0; 1069 } 1070 1071 1072 1073 // 1074 // Size HOGDescriptor::blockSize 1075 // 1076 1077 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1blockSize_10 (JNIEnv*, jclass, jlong); 1078 1079 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1blockSize_10 1080 (JNIEnv* env, jclass , jlong self) 1081 { 1082 static const char method_name[] = "objdetect::get_1blockSize_10()"; 1083 try { 1084 LOGD("%s", method_name); 1085 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1086 Size _retval_ = me->blockSize;//( ); 1087 jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); 1088 return _da_retval_; 1089 } catch(const std::exception &e) { 1090 throwJavaException(env, &e, method_name); 1091 } catch (...) { 1092 throwJavaException(env, 0, method_name); 1093 } 1094 return 0; 1095 } 1096 1097 1098 1099 // 1100 // Size HOGDescriptor::blockStride 1101 // 1102 1103 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1blockStride_10 (JNIEnv*, jclass, jlong); 1104 1105 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1blockStride_10 1106 (JNIEnv* env, jclass , jlong self) 1107 { 1108 static const char method_name[] = "objdetect::get_1blockStride_10()"; 1109 try { 1110 LOGD("%s", method_name); 1111 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1112 Size _retval_ = me->blockStride;//( ); 1113 jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); 1114 return _da_retval_; 1115 } catch(const std::exception &e) { 1116 throwJavaException(env, &e, method_name); 1117 } catch (...) { 1118 throwJavaException(env, 0, method_name); 1119 } 1120 return 0; 1121 } 1122 1123 1124 1125 // 1126 // Size HOGDescriptor::cellSize 1127 // 1128 1129 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1cellSize_10 (JNIEnv*, jclass, jlong); 1130 1131 JNIEXPORT jdoubleArray JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1cellSize_10 1132 (JNIEnv* env, jclass , jlong self) 1133 { 1134 static const char method_name[] = "objdetect::get_1cellSize_10()"; 1135 try { 1136 LOGD("%s", method_name); 1137 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1138 Size _retval_ = me->cellSize;//( ); 1139 jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); 1140 return _da_retval_; 1141 } catch(const std::exception &e) { 1142 throwJavaException(env, &e, method_name); 1143 } catch (...) { 1144 throwJavaException(env, 0, method_name); 1145 } 1146 return 0; 1147 } 1148 1149 1150 1151 // 1152 // int HOGDescriptor::nbins 1153 // 1154 1155 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1nbins_10 (JNIEnv*, jclass, jlong); 1156 1157 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1nbins_10 1158 (JNIEnv* env, jclass , jlong self) 1159 { 1160 static const char method_name[] = "objdetect::get_1nbins_10()"; 1161 try { 1162 LOGD("%s", method_name); 1163 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1164 int _retval_ = me->nbins;//( ); 1165 return _retval_; 1166 } catch(const std::exception &e) { 1167 throwJavaException(env, &e, method_name); 1168 } catch (...) { 1169 throwJavaException(env, 0, method_name); 1170 } 1171 return 0; 1172 } 1173 1174 1175 1176 // 1177 // int HOGDescriptor::derivAperture 1178 // 1179 1180 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1derivAperture_10 (JNIEnv*, jclass, jlong); 1181 1182 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1derivAperture_10 1183 (JNIEnv* env, jclass , jlong self) 1184 { 1185 static const char method_name[] = "objdetect::get_1derivAperture_10()"; 1186 try { 1187 LOGD("%s", method_name); 1188 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1189 int _retval_ = me->derivAperture;//( ); 1190 return _retval_; 1191 } catch(const std::exception &e) { 1192 throwJavaException(env, &e, method_name); 1193 } catch (...) { 1194 throwJavaException(env, 0, method_name); 1195 } 1196 return 0; 1197 } 1198 1199 1200 1201 // 1202 // double HOGDescriptor::winSigma 1203 // 1204 1205 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1winSigma_10 (JNIEnv*, jclass, jlong); 1206 1207 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1winSigma_10 1208 (JNIEnv* env, jclass , jlong self) 1209 { 1210 static const char method_name[] = "objdetect::get_1winSigma_10()"; 1211 try { 1212 LOGD("%s", method_name); 1213 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1214 double _retval_ = me->winSigma;//( ); 1215 return _retval_; 1216 } catch(const std::exception &e) { 1217 throwJavaException(env, &e, method_name); 1218 } catch (...) { 1219 throwJavaException(env, 0, method_name); 1220 } 1221 return 0; 1222 } 1223 1224 1225 1226 // 1227 // int HOGDescriptor::histogramNormType 1228 // 1229 1230 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1histogramNormType_10 (JNIEnv*, jclass, jlong); 1231 1232 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1histogramNormType_10 1233 (JNIEnv* env, jclass , jlong self) 1234 { 1235 static const char method_name[] = "objdetect::get_1histogramNormType_10()"; 1236 try { 1237 LOGD("%s", method_name); 1238 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1239 int _retval_ = me->histogramNormType;//( ); 1240 return _retval_; 1241 } catch(const std::exception &e) { 1242 throwJavaException(env, &e, method_name); 1243 } catch (...) { 1244 throwJavaException(env, 0, method_name); 1245 } 1246 return 0; 1247 } 1248 1249 1250 1251 // 1252 // double HOGDescriptor::L2HysThreshold 1253 // 1254 1255 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1L2HysThreshold_10 (JNIEnv*, jclass, jlong); 1256 1257 JNIEXPORT jdouble JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1L2HysThreshold_10 1258 (JNIEnv* env, jclass , jlong self) 1259 { 1260 static const char method_name[] = "objdetect::get_1L2HysThreshold_10()"; 1261 try { 1262 LOGD("%s", method_name); 1263 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1264 double _retval_ = me->L2HysThreshold;//( ); 1265 return _retval_; 1266 } catch(const std::exception &e) { 1267 throwJavaException(env, &e, method_name); 1268 } catch (...) { 1269 throwJavaException(env, 0, method_name); 1270 } 1271 return 0; 1272 } 1273 1274 1275 1276 // 1277 // bool HOGDescriptor::gammaCorrection 1278 // 1279 1280 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1gammaCorrection_10 (JNIEnv*, jclass, jlong); 1281 1282 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1gammaCorrection_10 1283 (JNIEnv* env, jclass , jlong self) 1284 { 1285 static const char method_name[] = "objdetect::get_1gammaCorrection_10()"; 1286 try { 1287 LOGD("%s", method_name); 1288 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1289 bool _retval_ = me->gammaCorrection;//( ); 1290 return _retval_; 1291 } catch(const std::exception &e) { 1292 throwJavaException(env, &e, method_name); 1293 } catch (...) { 1294 throwJavaException(env, 0, method_name); 1295 } 1296 return 0; 1297 } 1298 1299 1300 1301 // 1302 // vector_float HOGDescriptor::svmDetector 1303 // 1304 1305 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1svmDetector_10 (JNIEnv*, jclass, jlong); 1306 1307 JNIEXPORT jlong JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1svmDetector_10 1308 (JNIEnv* env, jclass , jlong self) 1309 { 1310 static const char method_name[] = "objdetect::get_1svmDetector_10()"; 1311 try { 1312 LOGD("%s", method_name); 1313 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1314 std::vector<float> _ret_val_vector_ = me->svmDetector;//( ); 1315 Mat* _retval_ = new Mat(); vector_float_to_Mat(_ret_val_vector_, *_retval_); 1316 return (jlong) _retval_; 1317 } catch(const std::exception &e) { 1318 throwJavaException(env, &e, method_name); 1319 } catch (...) { 1320 throwJavaException(env, 0, method_name); 1321 } 1322 return 0; 1323 } 1324 1325 1326 1327 // 1328 // int HOGDescriptor::nlevels 1329 // 1330 1331 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1nlevels_10 (JNIEnv*, jclass, jlong); 1332 1333 JNIEXPORT jint JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1nlevels_10 1334 (JNIEnv* env, jclass , jlong self) 1335 { 1336 static const char method_name[] = "objdetect::get_1nlevels_10()"; 1337 try { 1338 LOGD("%s", method_name); 1339 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1340 int _retval_ = me->nlevels;//( ); 1341 return _retval_; 1342 } catch(const std::exception &e) { 1343 throwJavaException(env, &e, method_name); 1344 } catch (...) { 1345 throwJavaException(env, 0, method_name); 1346 } 1347 return 0; 1348 } 1349 1350 1351 1352 // 1353 // bool HOGDescriptor::signedGradient 1354 // 1355 1356 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1signedGradient_10 (JNIEnv*, jclass, jlong); 1357 1358 JNIEXPORT jboolean JNICALL Java_org_opencv_objdetect_HOGDescriptor_get_1signedGradient_10 1359 (JNIEnv* env, jclass , jlong self) 1360 { 1361 static const char method_name[] = "objdetect::get_1signedGradient_10()"; 1362 try { 1363 LOGD("%s", method_name); 1364 cv::HOGDescriptor* me = (cv::HOGDescriptor*) self; //TODO: check for NULL 1365 bool _retval_ = me->signedGradient;//( ); 1366 return _retval_; 1367 } catch(const std::exception &e) { 1368 throwJavaException(env, &e, method_name); 1369 } catch (...) { 1370 throwJavaException(env, 0, method_name); 1371 } 1372 return 0; 1373 } 1374 1375 1376 1377 // 1378 // native support for java finalize() 1379 // static void cv::HOGDescriptor::delete( __int64 self ) 1380 // 1381 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_delete(JNIEnv*, jclass, jlong); 1382 1383 JNIEXPORT void JNICALL Java_org_opencv_objdetect_HOGDescriptor_delete 1384 (JNIEnv*, jclass, jlong self) 1385 { 1386 delete (cv::HOGDescriptor*) self; 1387 } 1388 1389 1390 // 1391 // void groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 1392 // 1393 1394 JNIEXPORT void JNICALL Java_org_opencv_objdetect_Objdetect_groupRectangles_10 (JNIEnv*, jclass, jlong, jlong, jint, jdouble); 1395 1396 JNIEXPORT void JNICALL Java_org_opencv_objdetect_Objdetect_groupRectangles_10 1397 (JNIEnv* env, jclass , jlong rectList_mat_nativeObj, jlong weights_mat_nativeObj, jint groupThreshold, jdouble eps) 1398 { 1399 static const char method_name[] = "objdetect::groupRectangles_10()"; 1400 try { 1401 LOGD("%s", method_name); 1402 std::vector<Rect> rectList; 1403 Mat& rectList_mat = *((Mat*)rectList_mat_nativeObj); 1404 Mat_to_vector_Rect( rectList_mat, rectList ); 1405 std::vector<int> weights; 1406 Mat& weights_mat = *((Mat*)weights_mat_nativeObj); 1407 cv::groupRectangles( rectList, weights, (int)groupThreshold, (double)eps ); 1408 vector_Rect_to_Mat( rectList, rectList_mat ); vector_int_to_Mat( weights, weights_mat ); 1409 return; 1410 } catch(const std::exception &e) { 1411 throwJavaException(env, &e, method_name); 1412 } catch (...) { 1413 throwJavaException(env, 0, method_name); 1414 } 1415 return; 1416 } 1417 1418 1419 1420 JNIEXPORT void JNICALL Java_org_opencv_objdetect_Objdetect_groupRectangles_11 (JNIEnv*, jclass, jlong, jlong, jint); 1421 1422 JNIEXPORT void JNICALL Java_org_opencv_objdetect_Objdetect_groupRectangles_11 1423 (JNIEnv* env, jclass , jlong rectList_mat_nativeObj, jlong weights_mat_nativeObj, jint groupThreshold) 1424 { 1425 static const char method_name[] = "objdetect::groupRectangles_11()"; 1426 try { 1427 LOGD("%s", method_name); 1428 std::vector<Rect> rectList; 1429 Mat& rectList_mat = *((Mat*)rectList_mat_nativeObj); 1430 Mat_to_vector_Rect( rectList_mat, rectList ); 1431 std::vector<int> weights; 1432 Mat& weights_mat = *((Mat*)weights_mat_nativeObj); 1433 cv::groupRectangles( rectList, weights, (int)groupThreshold ); 1434 vector_Rect_to_Mat( rectList, rectList_mat ); vector_int_to_Mat( weights, weights_mat ); 1435 return; 1436 } catch(const std::exception &e) { 1437 throwJavaException(env, &e, method_name); 1438 } catch (...) { 1439 throwJavaException(env, 0, method_name); 1440 } 1441 return; 1442 } 1443 1444 1445 1446 1447 } // extern "C" 1448 1449 #endif // HAVE_OPENCV_OBJDETECT 1450