Ask Your Question

Dave's profile - activity

2016-04-19 19:11:58 -0600 received badge  Famous Question (source)
2014-04-10 02:27:59 -0600 received badge  Notable Question (source)
2013-12-24 04:57:05 -0600 received badge  Student (source)
2013-10-30 08:56:43 -0600 received badge  Popular Question (source)
2013-10-20 18:03:09 -0600 asked a question Unit of objectPoints in solvePnP()

Hello

I'm currently playing with OpenCV to build an AR application. I'm using the findChessboardCorners() function to detect the chessboard and then estimate the pose with solvePnP(). After this I display a 3D cube with OpenGL. The rotation and translation seem to be correct.

The problem right now is, that even though the translations are in the right direction, the distance is not correct. What I discovered is, that the size (distance between two points) of the objectPoints argument given to solvePnP() influences the results of solvePnP().

At the moment I have two things I don't understand:

  • What are the units of these object points?
  • How are they related to other numbers (world, image, intrinsics)?
  • How can I determine the correct size of a square on the chessboard (to build objectPoints)?

I hope you can give me some hints to point me in the right direction!

2013-03-03 17:49:51 -0600 received badge  Editor (source)
2013-03-03 17:46:53 -0600 asked a question Android NDK Native Activity: Problem using OpenCV

Hello

I'm trying to use OpenCV VideoCapture in an Android NDK Native Activity. Unfortunately I can't find a tutorial for integrating OpenCV with Native Activity, so I was trying to discover a solution myself.

This is my Android.mk file:

LOCAL_PATH := $(call my-dir)
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
OPENCV_SDK_DIR := $(SELF_DIR)/../../OpenCV-2.4.4-android-sdk

include $(CLEAR_VARS)
OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on
OPENCV_LIB_TYPE:=SHARED
include $(OPENCV_SDK_DIR)/sdk/native/jni/OpenCV.mk

LOCAL_MODULE    := CameraTest
LOCAL_SRC_FILES := AppEngine.cpp ConcreteApp.cpp main.cpp
LOCAL_LDLIBS    += -llog -landroid -lEGL -lGLESv1_CM
LOCAL_STATIC_LIBRARIES += android_native_app_glue
include $(BUILD_SHARED_LIBRARY)

$(call import-module,android/native_app_glue)

The problem is that the app is only starting, when I do static linking of OpenCV with OPENCV_LIB_TYPE := STATIC. With dynamic linking, the app doesn't even start and I get the following exception:

03-04 00:19:39.880: E/AndroidRuntime(3667): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.cameratest/android.app.NativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/data/com.example.cameratest/lib/libCameraTest.so

I actually wouldn't mind static linking, but I discovered other problems with this method: The video capture doesn't seem to work. I tried the camera examples in the samples folder of the OpenCV Android SDK and they all work. So the problem seems to be on my side.

As I said, the video capture doesn't work when linking statically. I get the following log messages:

03-04 00:26:59.090: D/OpenCV::camera(3818): CvCapture_Android::CvCapture_Android(0)
03-04 00:26:59.090: D/OpenCV::camera(3818): Library name: libCameraTest.so
03-04 00:26:59.090: D/OpenCV::camera(3818): Library base address: 0x80400000
03-04 00:26:59.100: D/OpenCV::camera(3818): Libraries folder found: /data/data/ch.bfh.cpvr.cameratest/lib/
03-04 00:26:59.100: D/OpenCV::camera(3818): CameraWrapperConnector::connectToLib: folderPath=/data/data/ch.bfh.cpvr.cameratest/lib/
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r4.2.0.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r3.0.1.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r2.3.3.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r2.2.0.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r4.0.3.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r4.1.1.so
03-04 00:26:59.100: E/OpenCV::camera(3818): ||libnative_camera_r4.0.0.so
03-04 00:26:59.100: D/OpenCV::camera(3818): try to load library 'libnative_camera_r4.2.0.so'
03-04 00:26:59.110: D/OpenCV::camera(3818): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/data/ch.bfh.cpvr.cameratest/lib/libnative_camera_r4.2.0.so, dlerror="Cannot load library: reloc_library[1311]:  1386 cannot locate '_ZN7android11BufferQueueC1EbRKNS_2spINS_19IGraphicBufferAllocEEE'...
03-04 00:26:59.110: D/OpenCV::camera(3818): "
03-04 00:26:59.110: D/OpenCV::camera(3818): try to load library 'libnative_camera_r4.1.1.so'
03-04 00:26:59.110: D/OpenCV::camera(3818): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library /data/data/ch.bfh ...
(more)