Closed manuelh9r closed 7 years ago
BTW, you could use Tesseract directly...
For the scene text recognition I may be able to use Tesseract directly. However, at least the scene text detection part from OpenCV is required (OpenCV doc).
I removed the include of <opencv2/text/ocr.hpp> but still get a issue:
jacacpp-presets/opencv/target/classes/org/bytedeco/javacpp/jniopencv_text.cpp:2643:10: error: cannot convert 'cv::Vec<int, 2>*' to 'cv::Point_<int>*' in assignment rptr = &(*ptr)[(size_t)arg0]; ^
The related generated jniopencv_text.cpp code looks like this:
JNIEXPORT jobject JNICALL Java_org_bytedeco_javacpp_opencv_1text_00024Vec2iVector_get(JNIEnv* env, jobject obj, jlong arg0) {
::std::vector<cv::Vec2i>* ptr = (::std::vector<cv::Vec2i>*)jlong_to_ptr(env->GetLongField(obj, JavaCPP_addressFID));
if (ptr == NULL) {
env->ThrowNew(JavaCPP_getClass(env, 16), "This pointer address is NULL.");
return 0;
}
jint position = env->GetIntField(obj, JavaCPP_positionFID);
ptr += position;
jobject rarg = NULL;
::cv::Point_<int>* rptr;
rptr = &(*ptr)[(size_t)arg0];
if (rptr != NULL) {
rarg = JavaCPP_createPointer(env, 22);
if (rarg != NULL) {
env->SetLongField(rarg, JavaCPP_addressFID, ptr_to_jlong(rptr));
}
}
return rarg;
}
Maybe modifying this line from presets/opencv_core.java
:
.put(new Info("cv::Vec2i").pointerTypes("Point"))
this way:
.put(new Info("cv::Vec2i").cast().pointerTypes("Point"))
would fix this issue.
Let me know if you are encountering any other errors. I can help with that. Thanks!
It's done! See #327 and #333. Enjoy
In the OpenCV preset the text module (Scene Text Detection & Scene Text Recognition) is currently disabled.
Would it be possible to enable this module as well? As far as I know this module also has dependencies to Tesseract and Leptonica. How should these dependencies be represented in JavaCpp?
I would be happy to contribute to enable this module. However, I would need some guidance as I am lacking experience with JavaCpp. I already enabled the text module in cppbuild.sh and created a src/main/java/org/bytedeco/javacpp/presets/opencv_text.java file with the following contents:
I get a lot of errors during the build of the generated jniopencv_text.cpp file, like the following: