Ask Your Question

xarpus's profile - activity

2017-07-25 03:56:36 -0600 received badge  Enthusiast
2017-07-22 09:36:12 -0600 asked a question OpenCV with Java wrapper for Android

I am trying to build latest OpenCV with Java wrapper for Android, but I keep getting this error.

I've tried to build it with newer and older NDKs , build-tools and platform-tools. I've also tried with running build_sdk.py and configuring with different build systems.

CMake configuration always shows "SDK target: android_sdk_target_status-NOTFOUND".

Terminal throws this error : FAILED: bin/classes.jar bin/classes.jar.dephelper Buildfile: build.xml does not exist!

If someone was able to build OpenCV with Java wrapper, could you please explain how?

EDIT: I am not sure if this question is against forum rules because I mentioned Java wrapper , but I am using official opencv wrapper for java , not JavaCV.

2017-07-21 15:25:26 -0600 received badge  Editor (source)
2017-07-20 08:14:15 -0600 asked a question Linker error on Android project

Hello, I am having problem with linker in my Android build.

07-20 14:24:10.188 24318-25252/com.mygdx.main E/art: No implementation found for void org.opencv.aruco.Aruco.detectCharucoDiamond_0(long, long, long, float, long, long, long, long) (tried Java_org_opencv_aruco_Aruco_detectCharucoDiamond_10 and Java_org_opencv_aruco_Aruco_detectCharucoDiamond_10__JJJFJJJJ)
07-20 14:24:10.189 24318-25252/com.mygdx.main E/AndroidRuntime: FATAL EXCEPTION: Thread-9913
                                                                Process: com.mygdx.main, PID: 24318
                                                                java.lang.UnsatisfiedLinkError: No implementation found for void org.opencv.aruco.Aruco.detectCharucoDiamond_0(long, long, long, float, long, long, long, long) (tried Java_org_opencv_aruco_Aruco_detectCharucoDiamond_10 and Java_org_opencv_aruco_Aruco_detectCharucoDiamond_10__JJJFJJJJ)
                                                                    at org.opencv.aruco.Aruco.detectCharucoDiamond_0(Native Method)
                                                                    at org.opencv.aruco.Aruco.detectCharucoDiamond(Aruco.java:344)
                                                                    at com.mygdx.main.MarkerTracker.onCameraFrame(MarkerTracker.java:128)
                                                                    at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:392)
                                                                    at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:373)
                                                                    at java.lang.Thread.run(Thread.java:818)

I am trying to make simple AR application in which could app find markers and render it via LibGDX. For my camera calibration I've used camera from the opencv samples. Calibration activity works , but problem is when I start making calls to opencv_aruco. I've built opencv with this command:

sh ./scripts/cmake_android_arm.sh -DOPENCV_EXTRA_MODULES_PATH=/home/josip/git/opencv/opencv_contrib/modules -DANDROID_NATIVE_API_LEVEL=21 -DANDROID_EXECUTABLE=/home/josip/Android/Sdk/build-tools/25.0.3/

I only wanted to use java(I don't have enough experience with c++/CMake), but aruco classes are making calls to native code, so I've tried to connect it via Cmakelists.txt. I've linked opencv module with external CMakeLists("../android/CMakeLists.txt") inside build.gradle file. Opencv module is latest (3.3.0) and it is imported as library. I've put generated static libraries in src/jniLibs.

This is how my project currently looks like:

libGDX_RenderEngine

|_ android

|_ opencv

|_ core(libgdx render)

This is my CMakeLists.txt file:

#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 3.6)
#Name your project here
project(libGDX_RenderEngine)
#variable OPENCV_DIR
set(OpenCV_DIR "/home/josip/git/opencv/platforms/build_android_arm/")
set(SOURCE_FILES main.cpp)
#This tells CMake to main.cpp and name it as project
add_executable(libGDX_RenderEngine ${SOURCE_FILES})
#find & load OPEN_CV package
find_package(OpenCV REQUIRED)
#include the subdirectory containing our libs
include_directories(${OpenCV_DIR})
#link_libraries
message(STATUS "OpenCV libraries: ${OpenCV_LIBS}")
target_link_libraries(libGDX_RenderEngine ${OpenCV_LIBS} "-static")

EDIT: After some searching, it seems like missing libopencv_java is the real reason for this mess. During building I didn't notice that SDK target throwed "android_sdk_target_status-NOTFOUND".

2017-03-13 08:31:30 -0600 received badge  Self-Learner (source)
2017-03-13 06:38:54 -0600 answered a question opengl_interop.o build error

I realized what the problem was. I installed qt4-dev-tools (instead of qt5-dev-tools) that are in collision with current Qt version. As the @berak suggested , I deleted OpenCV with :

sudo find / -name "opencv" -exec rm -i {} \;

Then installed qt5 dev tools: sudo apt-get install qt5-dev-tools

I also should've add this line in .pro file :

LIBS += -lX11 -ldl -lXext -lz

and rebuild OpenCV (WITH_OPENGL in CMake-gui wasn't checked).

2017-03-10 15:48:47 -0600 asked a question opengl_interop.o build error

I recently started to use OpenCV on Qt Creator 4.2.1. Now I am trying to run opengl_interop.cpp from samples/opengl but I am getting this error: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'.

OS is Ubuntu 16.10.

ProjectTest.pro looks like this:

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/opengl_interop.cpp

INCLUDEPATH += "/usr/local/include"
LIBS += -L"/usr/lib/x86_64-linux-gnu/" -L"/usr/local/lib"
QMAKE_RPATHDIR += "/opt/Qt/5.8/gcc_64/lib"

LIBS += `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core


HEADERS += \
    ../../../../../../Downloads/opencv/opencv/samples/opengl/winapp.hpp

Compile output log

20:33:29: Running steps for project ProjectTest...
20:33:29: Configuration unchanged, skipping qmake step.
20:33:29: Starting: "/usr/bin/make" 

/opt/Qt/5.8/gcc_64/bin/qmake -o Makefile ../ProjectTest/ProjectTest.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug

g++ -Wl,-rpath,/opt/Qt/5.8/gcc_64/lib -o ProjectTest opengl_interop.o   -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/lib `pkg-config --libs opencv` -lGLU -lGL -lglut -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core 
/usr/bin/ld: warning: libopencv_imgproc.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_imgproc.so.2.4

/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /usr/local/lib/libopencv_videoio.so, may conflict with libopencv_core.so.2.4

Makefile:227: recipe for target 'ProjectTest' failed

//usr/bin/ld: opengl_interop.o: undefined reference to symbol '_ZN2cv3ogl13unmapGLBufferERNS_4UMatE'
//usr/local/lib/libopencv_core.so.3.2: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

make: *** [ProjectTest] Error 1

20:33:30: The process "/usr/bin/make" exited with code 2.

Error while building/deploying project ProjectTest (kit: Desktop Qt 5.8.0 GCC 64bit)

When executing step "Make"
20:33:30: Elapsed time: 00:01.