We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jni导出未 catch 异常,导致了如果传入一个非正确的图片(如 docx 改名为 png),jvm 崩溃,因为在 java 中无法捕获 c++ exception 可在 jni 接口中捕获异常,异常情况视为未检测到文字: `
extern "C" JNIEXPORT jobject JNICALL Java_com_benjaminwan_ocrlibrary_OcrEngine_detect(JNIEnv *env, jobject thiz, jstring input, jint padding, jint maxSideLen, jfloat boxScoreThresh, jfloat boxThresh, jfloat unClipRatio, jboolean doAngle, jboolean mostAngle ) {
std::string imgPath = jstringToChar(env, input); bool hasTargetImgFile = isFileExists(imgPath); if (!hasTargetImgFile) { fprintf(stderr, "Target image not found: %s\n", imgPath.c_str()); OcrResult result{}; return OcrResultUtils(env, result).getJObject(); } std::string imgDir = imgPath.substr(0, imgPath.find_last_of('/') + 1); std::string imgName = imgPath.substr(imgPath.find_last_of('/') + 1); printf("imgDir=%s, imgName=%s\n", imgDir.c_str(), imgName.c_str()); try { OcrResult result = ocrLite->detect(imgDir.c_str(), imgName.c_str(), padding, maxSideLen, boxScoreThresh, boxThresh, unClipRatio, doAngle, mostAngle); return OcrResultUtils(env, result).getJObject(); } catch (...) { OcrResult result{}; return OcrResultUtils(env, result).getJObject(); }
}
`
The text was updated successfully, but these errors were encountered:
我也遇到了,一个图片格式为ico(非png、jgp、tif、webp)就会崩溃,或者图片或文件损坏也会崩溃,导致服务完全的中断。希望的结果是,即使传入错误的内容,要返回错误信息或异常,而不是整个JVM崩溃。 这是一个特别普遍的现象,导致ocr服务完全无法稳定的提供服务。
Sorry, something went wrong.
No branches or pull requests
jni导出未 catch 异常,导致了如果传入一个非正确的图片(如 docx 改名为 png),jvm 崩溃,因为在 java 中无法捕获 c++ exception
可在 jni 接口中捕获异常,异常情况视为未检测到文字:
`
extern "C" JNIEXPORT jobject JNICALL
Java_com_benjaminwan_ocrlibrary_OcrEngine_detect(JNIEnv *env, jobject thiz, jstring input, jint padding,
jint maxSideLen,
jfloat boxScoreThresh, jfloat boxThresh, jfloat unClipRatio,
jboolean doAngle, jboolean mostAngle
) {
}
`
The text was updated successfully, but these errors were encountered: