Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem usaing 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!

Problem usaing 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!