Ask Your Question

Revision history [back]

Native method not found: org.opencv.imgproc.Imgproc.rectangle_1:(JDDDDDDDDI)V

Hello there. I'm syafiq and I'm new to OpenCv. I'm currently developing an Face Recognition on Android Studio. I have obtain a source code from github, but the source code using an old version of OpenCV (OpenCV 2.4.10) and I'm using the latest version which is 3.0.0. There's no error on the code and It successful to open the app, and the camera works fine. But when I pointed to someone face it's suddenly stop working.

The error that I've received is:

Process: com.example.syafiq.test, PID: 3249
java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.imgproc.Imgproc.rectangle_1:(JDDDDDDDDI)V
    at org.opencv.imgproc.Imgproc.rectangle_1(Native Method)
    at org.opencv.imgproc.Imgproc.rectangle(Imgproc.java:2779)
    at com.example.syafiq.test.FdActivity.onCameraFrame(FdActivity.java:431)
    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:393)
    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:346)
    at java.lang.Thread.run(Thread.java:841)

The (Imgproc.java:2779) pointed here:

rectangle_1(img.nativeObj, pt1.x, pt1.y, pt2.x, pt2.y, color.val[0], color.val[1], color.val[2], color.val[3], thickness);

The (FdActivity.java:431) pointed here:

(line430) for (int i = 0; i < facesArray.length; i++)
(line431) Imgproc.rectangle(mRgba, facesArray[i].tl(), facesArray[i].br(), FACE_RECT_COLOR,3);

Before this, the source code on (FdActivity.java:431) was Core.rectangle and it's an error, so I've changed it to Imgproc based on the Internet that I've found to fix that code line.

On (CameraBridgeViewBase.java:393) pointed here:

(line392) if (mListener != null) {
(line393) modified = mListener.onCameraFrame(frame);

On (JavaCameraView.java:346) pointed here:

(line345) if (!mFrameChain[1 - mChainIdx].empty())
(line346) deliverAndDrawFrame(mCameraFrame[1 - mChainIdx]);

I'm new to android development and new to OpenCV :/ I really appreciate your time and help to consideration to helping me.

Thanks in advance :)