Quantcast
Channel: Questions in topic: "native plugin"
Viewing all articles
Browse latest Browse all 376

Can't open device camera with Native plugins using OpenCV and c++.

$
0
0
Hi, I breack my head trying solving this problem but I couldn't, so I post it here for help. I am trying to use Native plugins to use OpenCV libraries and using c++ language with unity. I created CallNativeCode file which invokes another file which is the native plugins "HandGestureNative.cpp". Inside "HandGestureNative.cpp" I am trying to create VideoCapture and open the camera, but the camera is not openning. I made sure that all the opencv dependeinces file has been delared in the file. Please check the following code inside the "HandGestureNative.cpp": ** #include "HandGestureNative.h" #include //opencv #include #include "opencv2/imgcodecs.hpp" #include "opencv2/imgproc.hpp" #include "opencv2/videoio.hpp" #include #include #include #include //C++ #include #include using namespace cv; using namespace std; // Global variables Mat temp; float result = 0.0; #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "HandGestureNative", __VA_ARGS__)) #define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "HandGestureNativex`", __VA_ARGS__)) extern "C" { float HandGestureNative::HandGestureCall() { //Creating camera and assign it to camera 0; VideoCapture capture; capture.open(0); capture >> temp; if (capture.isOpened()) { result = 5.5; } else { result = 1.5; } return result; } } ** Always the return result is 1.5, which means that the camera is not open. Please help and Thank you :).

Viewing all articles
Browse latest Browse all 376

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>