Giter Site home page Giter Site logo

opencv_android_nonfree's Introduction

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\), Download link
  • OpenCV-2.4.10 (install path: D:\CODE\OpenCV-2.4.10\), Download link

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 nonfree 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:

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

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 nonfree_jni.cpp 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:

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: https://github.com/bkornel/opencv_android_nonfree.

Original source from: http://web.guohuiwang.com/technical-notes/sift_surf_opencv_android

<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-61966204-1', 'auto'); ga('send', 'pageview'); </script>

opencv_android_nonfree's People

Contributors

bkornel avatar

Watchers

James Cloos avatar Anibal Bastias Soto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.