예제 #1
0
extern "C" JNIEXPORT void JNICALL
Java_budny_moneykeeper_cv_Recognizer_nativeRecognize(
       JNIEnv*, jobject,
       jlong j_recognizer, jlong j_src_mat, jlong j_dst_mat) {
    Recognizer* recognizer = reinterpret_cast<Recognizer*>(j_recognizer);
    cv::Mat& src_mat = *(reinterpret_cast<cv::Mat*>(j_src_mat));
    cv::Mat& dst_mat = *(reinterpret_cast<cv::Mat*>(j_dst_mat));
    recognizer->recognize(src_mat, dst_mat);
}
예제 #2
0
void recognizing(string filename, vector<uint> ids) {

	Mat image = imread(filename);

	Recognizer* rcg = new Recognizer(0.70f, 0.065f);
	Preprocessor* pr = new Preprocessor(image);
    pr->preprocess(10);

    Mat cover;

    if(!pr->warpObject()) {
    	cout << "#WARP-UNSUCCESSFUL" << endl;
    	cover = image.clone();
    	image.release();
    	Size newSize = (cover.size().width > cover.size().height) ? Size(1024, 768) : Size(768, 1024);
    	resize(cover, cover, newSize);
    	cout << "using the whole image..." << endl;
    } else {
    	cover = pr->WarpedCover();
    }

    Mat trainingImage;

    for(size_t i = 0; i < ids.size(); ++i) {
    	cout << "training " << i << endl;
    	rcg->train(ids.at(i));
	}

	if(rcg->recognize(Preprocessor::kuwaharaNagaoFilter(cover)))
	{
   		Book result = rcg->LastResult();
        cout << "#BEGIN-RESULT " << result.Id() << " #END-RESULT";
    } else {
    	cout << "#BEGIN-RESULT null #END-RESULT";
    }
    cout << endl;
}
void StrokesRecognizer::onRecognizeClicked() {
    Recognizer rec;
    QString recognizedChar = rec.recognize(mpCanvas->strokes());

    mpCharacterResult->setText(recognizedChar);
}