博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android opencv2.4.10使用SIFT编译出libnonfree.so
阅读量:6094 次
发布时间:2019-06-20

本文共 2319 字,大约阅读时间需要 7 分钟。

My development environment is set up as follows:

  • android-ndk-r10d (install path: D:\adt-bundle-windows-x86_64-20140702\android-ndk-r10d\)
  • OpenCV-2.4.10-android-sdk (install path: D:\CODE\OpenCV-2.4.10-android-sdk\), 
  • OpenCV-2.4.10 (install path: D:\CODE\OpenCV-2.4.10\), 

Building the nonfree module

  1. We actually only need to copy a few files from OpenCV-2.4.10 source code to OpenCV-2.4.10-android-sdk, namely:

    Copy the  folder from OpenCV-2.4.10\sources\modules\nonfree\include\opencv2\to OpenCV-2.4.10-android-sdk\sdk\native\jni\include\opencv2.

  2. Create a folder to hold our new project for libnonfree.so. Here, I call it libnonfree. Create a jni folder under libnonfree. Copy the following files from OpenCV-2.4.10\sources\modules\nonfree\src to libnonfree\jni\ folder:

    •  (use the original file)
    •  (use the original file)
  3. Building libnonfree.so:

    Create Android.mk and Application.mk scripts. This Android.mk is used to build libnonfree.so.

    •  (you should modify OPENCV_PATH where your OpenCV-2.4.10-android-sdkis)

    cd into the project folder libnonfree and type ndk-build to build the libnonfree.so.

So far, you have got libnonfree.so along with libopencv_java.so and libgnustl_shared.so in libnonfree\libs\armeabi-v7a folder.

You can easily build any SIFT or SURF applications using those libraries. If you want to use SIFT and SURF in JAVA code in your Android application, you only need to write JNI interfaces for the functions you want to use.

Building a sample application

  1. Create a project folder call libnonfree_demo. Create a jni folder inside the project folder. Then copy libnonfree.so along with libopencv_java.so and libgnustl_shared.so into jni.

  2. Create a  in jni. It is simple SIFT test program. It basically reads an image and detects the keypoints, then extracts feature descriptors, finally draws the keypoints to an output image.

  3. Create Android.mk and Application.mk inside jni:

    •  (you should modify OPENCV_PATH where your OpenCV-2.4.10-android-sdkis)

    cd into the project folder libnonfree_demo and type ndk-build to build the libnonfree_demo.so.

At this point you can easily extend the sample app with your SVMDetector. Just copy the source and include files int to the folder libnonfree_demo\jni and add cpp files to LOCAL_SRC_FILES in Android.mk.

The whole source can be downloaded from: .

Original source from: 

 

转载地址:http://ixwza.baihongyu.com/

你可能感兴趣的文章
[Spring]01_环境配置
查看>>
用AliOS Things在Developer Kit 上点亮一个LED
查看>>
Hadoop集群nodes unhealthy解决方法
查看>>
云栖科技评论NO.3 | 新技术正在打破“新药26亿美元”魔咒
查看>>
因为聊天机器人的表现太令人失望,Facebook决定削减AI投入
查看>>
搭建了一个小型VR游乐园,Topshop的营业额蹭蹭上涨
查看>>
「镁客·请讲」EAI科技龙军:从模块化切入,做服务机器人整体解决方案
查看>>
用户对物联网设备的“宽容”会让物联网陷入反乌托邦?
查看>>
FBS2017: 伊利智慧 惊艳登场
查看>>
安卓问题集-Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED
查看>>
MySQL复制表结构和内容到另一张表(转)
查看>>
React Native在Windows下修改js代码后reload无效
查看>>
阿里首席技术官王坚:互联网将被区块链彻底重构,未来区块链将用于数据价值的交换...
查看>>
rabbitMQ、activeMQ、zeroMQ、Kafka、Redis 比较
查看>>
传阿里将在南京云栖大会推出国际短信服务 全面对标Twilio
查看>>
为什么说这件事“做梦都要想”?
查看>>
Chrome无法播放m3u8格式的直播视频流的问题解决
查看>>
日本公司推出云平台STYLY,零基础低配置也能开发VR内容
查看>>
javascript删除创建多个子节点
查看>>
使用 Ruff 开发板+ Link Develop 快速开发 IoT 应用(环境预配置版)
查看>>