--- /dev/null
+CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )
+
+IF( NOT PROJECT_NAME )
+ IF ( NOT "x$ENV{PROJECT_NAME}" STREQUAL "x" )
+ SET( PROJECT_NAME $ENV{PROJECT_NAME} )
+ ELSE()
+ SET( PROJECT_NAME HelloAndroid )
+ ENDIF()
+ENDIF()
+SET( PROJECT_NAME ${PROJECT_NAME} CACHE STRING "The name of your project")
+
+PROJECT( ${PROJECT_NAME} )
+
+#########################################################
+# Find OpenCV
+#########################################################
+
+SET( OpenCV_DIR ${CMAKE_SOURCE_DIR}/../../build CACHE PATH "The path where you built opencv for android" )
+FIND_PACKAGE( OpenCV REQUIRED )
+
+#########################################################
+# c/c++ flags, includes and lib dependencies
+#########################################################
+
+#notice the "recycling" of CMAKE_C_FLAGS
+#this is necessary to pick up android flags
+SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic" )
+SET( CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -pedantic" )
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+SET( LIBRARY_DEPS ${OpenCV_LIBS} )
+IF( ANDROID )
+ SET( LIBRARY_DEPS ${LIBRARY_DEPS} log dl )
+ENDIF()
+
+#########################################################
+# source files
+#########################################################
+
+FILE( GLOB hdrs "*.h*" )
+FILE( GLOB srcs "*.cpp" )
+
+ADD_EXECUTABLE( ${PROJECT_NAME} ${srcs} )
+TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${LIBRARY_DEPS} )
--- /dev/null
+@ECHO OFF\r
+SETLOCAL\r
+PUSHD %~dp0\r
+SET PROJECT_NAME=HelloAndroid\r
+CALL ..\..\scripts\build.cmd %*\r
+POPD\r
+ENDLOCAL
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+cd `dirname $0`
+
+BUILD_DIR=build_armeabi
+opencv_android=`pwd`/../..
+opencv_build_dir=$opencv_android/$BUILD_DIR
+
+mkdir -p $BUILD_DIR
+cd $BUILD_DIR
+
+cmake -DOpenCV_DIR=$opencv_build_dir -DARM_TARGET=armeabi -DCMAKE_TOOLCHAIN_FILE=$opencv_android/android.toolchain.cmake ..
+
--- /dev/null
+#include <opencv2/core/core.hpp>\r
+#include <opencv2/highgui/highgui.hpp>\r
+\r
+using namespace cv;\r
+const char* message = "Hello Android!";\r
+\r
+int main(int argc, char* argv[])\r
+{\r
+ // print message to console\r
+ printf("%s\n", message);\r
+ \r
+ // put message to simple image\r
+ Size textsize = getTextSize(message, CV_FONT_HERSHEY_COMPLEX, 3, 5, 0);\r
+ Mat img(textsize.height + 20, textsize.width + 20, CV_32FC1, Scalar(230,230,230));\r
+ putText(img, message, Point(10, img.rows - 10), CV_FONT_HERSHEY_COMPLEX, 3, Scalar(0, 0, 0), 5);\r
+\r
+ // save\show resulting image\r
+#if ANDROID\r
+ imwrite("/mnt/sdcard/HelloAndroid.png", img);\r
+#else\r
+ imshow("test", img);\r
+ waitKey();\r
+#endif\r
+ return 0;\r
+}\r
+\r
--- /dev/null
+:: this batch file copies compiled executable to the device,\r
+:: runs it and gets resulting image back to the host\r
+::\r
+:: Here is sample output of successful run:\r
+::\r
+:: 204 KB/s (2887388 bytes in 13.790s)\r
+:: Hello Android!\r
+:: 304 KB/s (8723 bytes in 0.028s)\r
+\r
+@ECHO OFF\r
+\r
+:: enable command extensions\r
+VERIFY BADVALUE 2>NUL\r
+SETLOCAL ENABLEEXTENSIONS || (ECHO Unable to enable command extensions. & EXIT \B)\r
+\r
+PUSHD %~dp0\r
+SET PROJECT_NAME=HelloAndroid\r
+\r
+:: try to load config file\r
+SET CFG_PATH=..\..\scripts\wincfg.cmd\r
+IF EXIST %CFG_PATH% CALL %CFG_PATH%\r
+\r
+:: check if sdk path defined\r
+IF NOT DEFINED ANDROID_SDK (ECHO. & ECHO You should set an environment variable ANDROID_SDK to the full path to your copy of Android SDK & GOTO end)\r
+(PUSHD "%ANDROID_SDK%" 2>NUL && POPD) || (ECHO. & ECHO Directory "%ANDROID_SDK%" specified by ANDROID_SDK variable does not exist & GOTO end)\r
+SET adb=%ANDROID_SDK%\platform-tools\adb.exe\r
+\r
+:: copy file to device (usually takes 10 seconds or more)\r
+%adb% push .\bin\armeabi\%PROJECT_NAME% /data/bin/sample/%PROJECT_NAME% || GOTO end\r
+\r
+:: set execute permission\r
+%adb% shell chmod 777 /data/bin/sample/%PROJECT_NAME% || GOTO end\r
+\r
+:: execute our application\r
+%adb% shell /data/bin/sample/%PROJECT_NAME% || GOTO end\r
+\r
+:: get image result from device\r
+%adb% pull /mnt/sdcard/HelloAndroid.png || GOTO end\r
+\r
+GOTO end\r
+\r
+:: cleanup (comment out GOTO above to enable cleanup)\r
+%adb% shell rm /data/bin/sample/%PROJECT_NAME%\r
+%adb% shell rm /mnt/sdcard/HelloAndroid.png\r
+\r
+:end\r
+POPD\r
+ENDLOCAL
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+cd `dirname $0`
+PROJECT_NAME=HelloAndroid
+
+# copy file to device (usually takes 10 seconds or more)
+adb push ./bin/armeabi/$PROJECT_NAME /data/bin/sample/$PROJECT_NAME || return
+
+# set execute permission
+adb shell chmod 777 /data/bin/sample/$PROJECT_NAME || return
+
+# execute our application
+adb shell /data/bin/sample/$PROJECT_NAME || return
+
+# get image result from device
+adb pull /mnt/sdcard/HelloAndroid.png || return
\ No newline at end of file