Code Monkey home page Code Monkey logo

caffe2-opencv-ndkcamera's Introduction

What is it?

An android ndk app integrating caffe2, opencv and ndk camera.

How to build

<1> Android Studio 2.3.0 or above

<2> Android-21 or above

If building this app failed, please build google ndk camera sample.

Which parts of program are in NDK?

<1> camera

<2> opencv

<3> caffe2

Screenshot

screenshot

Source Code Structure

In texture-view,

          |__build
          |__build.gradle
          |__src
               |__main
                     |__assets
                           |__squeeze_init_net.pb    (squeeze net architecture file)
                           |__squeeze_predict_net.pb (squeeze net pretrained weights)
                     |__cpp
                           |__caffe2  (caffe2 headers)
                           |__camera  (Android NDK native Camera API)
                           |__Eigen   (Eigen headers)
                           |__google  (protobuf headers)
                           |__opencv  (opencv headers)
                           |__opencv2 (opencv2 headers)
                           |__android_main.cpp   ( 1. contains all c++ files that are called from Java via JNI)
                                                 ( 2. handles all the native activities including camera, caffe, opencv.)
                           |__classes.h (Imagenet classes)
                           |__CMakeLists.txt     ( CMake )
                     |__Java
                           |__com__sample__textureview
                                                   |__ViewActivity.java (App's life cycle, UI)
                     |__libs
                           |__armeabi-v7a (This is the only ABI supported unfortunately)
                                        |__opencv (opencv4android libraries)
                                        |__(the rest libraries are copied from AICamera)
                     |__res
                     |__AndroidManifest.xml

Source code is based upon the following, and I am grateful to them.

[1] NDK sample code is from Google NDK camera texture-view sample

[2] Caffe2 C++ classification procedure is from Caffe2 example

[3] Caffe2 pretrained protobuf and libraries are from AIcamera

[4] The OpenCV libraries are from OpenCV4Android

And these NDK documentation are very helpful.

Issues and bugs (memory leaks, resource allocation and free, threads concurrency, how to balance workload between threads and etc ... ) if you see any of them or have any improvement suggestions, please help me by filing as many issues as you want. I will be very grateful.

caffe2-opencv-ndkcamera's People

Contributors

yge58 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

caffe2-opencv-ndkcamera's Issues

UnsatisfiedLinkError: dlopen failed: library "libcamera2ndk.so" not found

AndroidRuntime: FATAL EXCEPTION: main
Process: com.sample.textureview, PID: 21358
java.lang.UnsatisfiedLinkError: dlopen failed: library "libcamera2ndk.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:384)
at java.lang.System.loadLibrary(System.java:1086)
at com.sample.textureview.ViewActivity.(ViewActivity.java:302)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1070)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2342)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2504)
at android.app.ActivityThread.access$900(ActivityThread.java:165)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1368)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
11-13 16:31:27.405 21358-21358/com.sample.textureview I/Process: Sending signal. PID: 21358 SIG: 9

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.