From 36135fc59d59f1ebfce4b00bb36ce6edfbcd9018 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Wed, 10 Oct 2012 12:40:36 +0400 Subject: [PATCH] Issue #2035 Calling cv::namedWindow crashes on Android fixed. Window-related functions is guarded from calls from application code. Old implementations with "no-gui" exception are stell compiled and linked to OpenCV library for binary compatibility. --- modules/highgui/CMakeLists.txt | 2 ++ modules/highgui/include/opencv2/highgui/highgui.hpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 30c0c82f4d..86ad1c79e4 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -70,6 +70,8 @@ set(highgui_srcs file(GLOB highgui_ext_hdrs "include/opencv2/${name}/*.hpp" "include/opencv2/${name}/*.h") +add_definitions(-DHAVE_ANDROID_UI) + if(HAVE_QT) if (HAVE_QT_OPENGL) set(QT_USE_QTOPENGL TRUE) diff --git a/modules/highgui/include/opencv2/highgui/highgui.hpp b/modules/highgui/include/opencv2/highgui/highgui.hpp index c511beb955..59be1358fe 100644 --- a/modules/highgui/include/opencv2/highgui/highgui.hpp +++ b/modules/highgui/include/opencv2/highgui/highgui.hpp @@ -54,6 +54,7 @@ struct CvVideoWriter; namespace cv { +#if defined(ANDROID) && defined(HAVE_ANDROID_UI) enum { // Flags for namedWindow WINDOW_NORMAL = CV_WINDOW_NORMAL, // the user can resize the window (no constraint) / also use to switch a fullscreen window to a normal size @@ -155,6 +156,8 @@ CV_EXPORTS int createButton( const string& bar_name, ButtonCallback on_change, void* userdata=NULL, int type=CV_PUSH_BUTTON, bool initial_button_state=0); +#endif + //------------------------- enum