OpenCV4Android 3.0: VideoCapture doesn't open

asked 2015-08-15 11:31:00 -0500

adhamenaya gravatar image

updated 2015-08-15 11:58:34 -0500

berak gravatar image

Hi,

I want to open the camera from the native code using the OpenCV SDK for android (native) version 3. I am trying using android Nexus 5 android 5.0.1

My android.mk file:

LOCAL_PATH := $(call my-dir)

OPENCV_CAMERA_MODULES:=on
OPENCV_INSTALL_MODULES:=on

include $(CLEAR_VARS)
include D:\folder1\OpenCV-android-sdk\sdk\native\jni\OpenCV.mk
LOCAL_C_INCLUDES := D:\folder1\OpenCV-android-sdk\sdk\native\jni\include

OPENGLES_LIB := -lGLESv1_CM
OPENGLES_DEF := -DUSE_OPENGL_ES_1_1

LOCAL_LDLIBS += -lGLESv1_CM -ldl -llog
LOCAL_MODULE  := NativeCamera

LOCAL_SRC_FILES := Camera.cpp
include $(BUILD_SHARED_LIBRARY)

The c++ code :

#include <jni.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <android/log.h>
#include <opencv2/imgproc/types_c.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
#include <pthread.h>
#include <time.h>
#include <Math.h>

......
......
JNIEXPORT void JNICALL Java_com_example_opencvnativecamera_Native_initCamera(JNIEnv*, jobject,jint width,jint height)

{
 LOG("Camera Created");
 capture.open(CV_CAP_ANDROID + 0);
 capture.set(CV_CAP_PROP_FRAME_WIDTH, width);
 capture.set(CV_CAP_PROP_FRAME_HEIGHT, height);
......
}

Could you please help me in figuring out what is the problem ? libraries are correct ? Are there any libs missed ?

Thanks,

edit retag flag offensive close merge delete