bool srvLearnPerson(ed_perception::LearnPerson::Request& req, ed_perception::LearnPerson::Response& res) { std::cout << "Learn person " << req.person_name << std::endl; rgbd::ImagePtr image = rgbd_client.nextImage(); if (!image) { res.error_msg = "Could not capture image"; ROS_ERROR("%s", res.error_msg.c_str()); return true; } fr.train(image->getRGBImage(), req.person_name); // visualizeResult(*image); return true; }
JNIEXPORT void JNICALL Java_org_opencv_contrib_FaceRecognizer_train_10 (JNIEnv* env, jclass , jlong self, jlong src_mat_nativeObj, jlong labels_nativeObj) { static const char method_name[] = "contrib::train_10()"; try { LOGD("%s", method_name); vector<Mat> src; Mat& src_mat = *((Mat*)src_mat_nativeObj); Mat_to_vector_Mat( src_mat, src ); FaceRecognizer* me = (FaceRecognizer*) self; //TODO: check for NULL Mat& labels = *((Mat*)labels_nativeObj); me->train( src, labels ); return; } catch(const std::exception &e) { throwJavaException(env, &e, method_name); } catch (...) { throwJavaException(env, 0, method_name); } return; }