Fedora 20 配置 Android + OpenCV 开发环境

Fedora 20 + OpenCV 2.4.9 + android-ndk-r10b + Eclipse 4.4 + CDT 8.4

sudo yum install gcc gcc-c++ cmake python-devel ffmpeg ffmpeg-devel zlib-devel
sudo yum install libtiff-devel jasper jasper-devel libpng-devel gtk2-devel
sudo yum install gstreamer-devel gstreamer-plugins-base-devel libdc1394-devel
sudo yum install libv4l-devel
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

cd ~/opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

vi ~/.bash_profile
在最后添加环境变量:
export ANDROID_SDK_ROOT=/home/li/android-sdk-linux
export PATH=${PATH}:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/tools
export ANDROID_NDK_ROOT=/home/li/android-ndk
export PATH=${PATH}:${ANDROID_NDK_ROOT}

$ source ~/.bash_profile

使用 ndk-build -v 测试配置:
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu

下载并安装 Eclipse + CDT + ADT
修改 Preferences -> Android -> NDK,指向 NDK 目录
导入 Android NDK 项目并测试编译:
Import -> Android -> Existing Android Code Into Workspace: /android-ndk-r10b/samples/hello-jni
在 HelloJni 项目上点右键,选择 Android Tools -> Add Native Support,
在项目的 Java Build Path 中添加 HelloJni 项目,用 ARM 模式的模拟器运行

导入 OpenCV for Android 中的全部项目(将根目录导入)
在 OpenCV Library 项目上点右键,选择 Android Tools -> Add Native Support,
设置项目版本 Android 3.0 or higher,运行 demo 项目

若出现对话框 OpenCV Manager package was not found! Try to install it? 则需安装 Manager,方法:
<Android SDK path>/platform-tools/adb install <OpenCV4Android SDK path>/apk/OpenCV_2.4.9_Manager_2.18_armv7a-neon.apk

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

20 + 4 =