not working on .so library for unity-android application using opencv

asked 2015-06-09 04:37:08 -0500

supersmash gravatar image

Hi everyone,

I'm new in the community, hope my question will find an answer here !

I'm trying to build a .so library for an android application made with Unity.

Unity loads the library, which contains openCV functions.

I'm working on Visual Studio 2013, using Nvidia GameWorks to build a Dynamic Library For Android Application with OpenCV-2.4.11-android-sdk

The build seems to work, except one detail : I'm unable to find any camera on the android device... I tryed on a Nexus 5 and a Kurio7s tablet.

Here is the code :

#define TEST_TRACKING_DLL_API __declspec(dllexport) 

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>

TEST_TRACKING_DLL_API int InitCameraCapture(int channel)
        cv::VideoCapture* camera_capture = new cv::VideoCapture();


        if (!camera_capture->isOpened())
            return -1;

        return 1;

this code always returns -1...

I tried all the possible values in VideoCapture::open(). from 0 to 1000 ! :p

Note1: When I'm building this code as a Win32 DLL, it is working smoothly in the Unity Editor

Note2: Unity can access the android camera with his own functions without erros.

What is wrong with my method ??

Thanks ! :)

edit retag flag offensive close merge delete