大部分都是参考下面的网址,如果感觉看起来不舒服,可以直接查看原网址。最后遇到了一点问题:

Description Resource Path Location Type

E:/~\code\Eclipse\opencvV4sdk\native\jni\/../libs/armeabi-v7a/libopencv_core.a(persistence.cpp.o): in function cvOpenFileStorage:persistence.cpp(.text.cvOpenFileStorage+0x1ac): error: undefined reference to 'gzrewind' ~ C/C++ Problem

可以直接拖到最后查看。

参考文章: http://www.cnblogs.com/adong7639/p/3925347.html(WINDOWS系统Eclipse+NDK+Android + OpenCv)

使用的ADT:

使用的NDK:android-ndk-r10c

使用的opencv:OpenCV-2.4.9-android-sdk

具体的配置就不说了,由于自己是NDK中直接调用opencv的函数,因而直接说明此步骤。

1. 将OpenCV-2.4.9-android-sdk 中的sdk文件夹放到Eclipse工程中,为了方便查看,可以改名成opencvV4sdk。

2. 安装OpenCV_Manager,没有测试如果不安装这个会怎么样(卸载后继续运行程序,可以正常运行。因而不确定是否一定需要这步)。

3. 利用JNI接口通过NDK平台调用OpenCV API函数

  1. 新建一个Android工程 NDK_OPENCV(后面将会看到这种命名方式不是很好)

默认使用MainActivitiy,包名com.example.ndk_opencv

  1. 构建Android的Java层代码

(1)布局文件:main.xml

 1 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent"
4 android:layout_height="match_parent"
5 tools:context="${packageName}.${activityClass}" >
6 <Button
7 android:id="@+id/imagegray"
8 android:layout_width="fill_parent"
9 android:layout_height="wrap_content"
10 android:text="图像灰度化" />
11
12 <ImageView
13 android:id="@+id/imageview"
14 android:layout_width="wrap_content"
15 android:layout_height="wrap_content"
16 android:layout_below="@+id/imagegray"
17 android:layout_centerHorizontal="true"
18 android:layout_marginTop="86dp" />
19 </RelativeLayout>

更多相关文章

  1. javaScript函数中执行C#代码中的函数
  2. JavaScript unshift()函数移入数据到数组第一位
  3. Java 8 新特性-菜鸟教程 (3) -Java 8 函数式接口
  4. 如何将动态参数传递给jquery函数
  5. Java多线程六:线程优先级和yield()让步函数
  6. javaScript里的string的match函数返回值的问题
  7. 使用超类中的构造函数
  8. JavaScript中的map()函数
  9. 自定义MapReduce输入格式 - 找不到构造函数

随机推荐

  1. Android原生(Native)C开发之二:framebuffe
  2. Android Web development Note
  3. Android持久化技术之SharedPreferences存
  4. Android的多媒体框架Opencore代码阅读
  5. Android(安卓)的 ListView 的CheckBox标
  6. 不能找到相应的target
  7. Android(安卓)向桌面添加快捷方式
  8. android用NFS的形式挂载工作.
  9. Ubuntu11.10下编译android内核源码
  10. 25、Android中通过Intent传递对象、集合