Problem using Imgproc.getTextSize() in java/Android
I'm trying to get the width and height of a text to draw it extremely precise in a rectangle. My code is bellow:
String id_text = String.valueOf(i);
int baseLine[] = null;
Size idSize = Imgproc.getTextSize(id_text,Imgproc.FONT_HERSHEY_COMPLEX_SMALL,1.0,1, baseLine);
double idSizeW = idSize.width;
double idSizeH = idSize.height;
canvas.drawText(id_text, (float) (cx-0.5*idSizeW), (float) (cy+0.5*idSizeH),cor);
I'm getting the error bellow:
/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.app, PID: 13760
java.lang.UnsatisfiedLinkError: No implementation found for double[] org.opencv.imgproc.Imgproc.n_getTextSize(java.lang.String, int, double, int, int[]) (tried Java_org_opencv_imgproc_Imgproc_n_1getTextSize and Java_org_opencv_imgproc_Imgproc_n_1getTextSize__Ljava_lang_String_2IDI_3I)
at org.opencv.imgproc.Imgproc.n_getTextSize(Native Method)
at org.opencv.imgproc.Imgproc.getTextSize(Imgproc.java:3897)
When I give a look in the line 3897 of Imgproc.java, it seems that my variable types fits the required by the function.
I don't know what I'm doing wrong, could anyone please help me? Thanks a lot!
is that ALL of your code ? do you load the opencv native libs somewhere ?
(it might be just the 1st opencv function to be found, not specifically getTextSize() )
The complete code has about 300 lines, it makes a lot of other things. I'm loading the opencv libraries with: import org.opencv.core.Size; import org.opencv.imgproc.Imgproc;
look at the error, it does not find the native jni function, it's not about importing java classes (which are only wrappers around c++ code)
look at your
System.loadLibrary
or similar again.I'm not using a native library wrote by me, I'm using the implementation in https://github.com/quickbirdstudios/o...