From 3609bb41a741c393be20da40139b774d1d56e7e5 Mon Sep 17 00:00:00 2001 From: Roman Donchenko Date: Mon, 9 Sep 2013 18:17:02 +0400 Subject: [PATCH] Updated the native activity sample to master's API. --- samples/android/native-activity/jni/native.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/samples/android/native-activity/jni/native.cpp b/samples/android/native-activity/jni/native.cpp index 0054da9..052b866 100644 --- a/samples/android/native-activity/jni/native.cpp +++ b/samples/android/native-activity/jni/native.cpp @@ -11,9 +11,10 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #define LOG_TAG "OCV:libnative_activity" #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) @@ -115,10 +116,10 @@ static void engine_handle_cmd(android_app* app, int32_t cmd) { LOGI("APP_CMD_INIT_WINDOW"); - engine->capture = new cv::VideoCapture(0); + engine->capture = cv::makePtr(0); union {double prop; const char* name;} u; - u.prop = engine->capture->get(CV_CAP_PROP_SUPPORTED_PREVIEW_SIZES_STRING); + u.prop = engine->capture->get(cv::CAP_PROP_ANDROID_PREVIEW_SIZES_STRING); int view_width = ANativeWindow_getWidth(app->window); int view_height = ANativeWindow_getHeight(app->window); @@ -135,8 +136,8 @@ static void engine_handle_cmd(android_app* app, int32_t cmd) if ((camera_resolution.width != 0) && (camera_resolution.height != 0)) { - engine->capture->set(CV_CAP_PROP_FRAME_WIDTH, camera_resolution.width); - engine->capture->set(CV_CAP_PROP_FRAME_HEIGHT, camera_resolution.height); + engine->capture->set(cv::CAP_PROP_FRAME_WIDTH, camera_resolution.width); + engine->capture->set(cv::CAP_PROP_FRAME_HEIGHT, camera_resolution.height); } float scale = std::min((float)view_width/camera_resolution.width, @@ -210,7 +211,7 @@ void android_main(android_app* app) if (!engine.capture.empty()) { if (engine.capture->grab()) - engine.capture->retrieve(drawing_frame, CV_CAP_ANDROID_COLOR_FRAME_RGBA); + engine.capture->retrieve(drawing_frame, cv::CAP_ANDROID_COLOR_FRAME_RGBA); char buffer[256]; sprintf(buffer, "Display performance: %dx%d @ %.3f", drawing_frame.cols, drawing_frame.rows, fps); -- 2.7.4