14

Is there a standarized API for taking pictures using Android NDK?

Or is it really necessary to go through Java for that?

qdot
  • 6,195
  • 5
  • 44
  • 95

4 Answers4

15

Yes. It is necessary to go through Java. Since NDK access will be specific to particular hardware.

Inspite there are few realizations through NDK.

Check the following links for relevant details.

http://nhenze.net/?p=253

http://osdir.com/ml/android-ndk/2010-10/msg00518.html

MduSenthil
  • 2,019
  • 3
  • 18
  • 39
  • 14
    +1 for links, but the claim "Since NDK access will be specific to particular hardware" is pure nonsense, or you think code that handles different hardware is written in Java? I'm pretty sure Java just calls some messy c-api that does all the dirty work. – Pavel P Apr 24 '12 at 22:10
  • 2
    the links are dead now. – Fanglin Oct 21 '14 at 04:05
  • This answer is obsolete since Android 7. – Ruslan Nov 17 '19 at 21:31
11

In Android 7 (API 24) Google has added support for native camera access (Camera2 API).

In ndk-r12:

  • Headers:

    1. $NDK_ROOT/android-24/$ARCH/usr/include/camera/Ndk*.h
    2. $NDK_ROOT/android-24/$ARCH/usr/include/media/Image*.h
  • Libs:

    1. libcamera2ndk.so
    2. libmediandk.so
Ruslan
  • 18,162
  • 8
  • 67
  • 136
y30
  • 722
  • 7
  • 17
5

1) There was an access to Camera.h in older releases like Froyo, 2.3.3.

Now, I see a Camera.h in KitKat, 4.4.4. It changed completely.

This is an unofficial API, so it's subject to change. Be ready to code and deploy different versions for different Android releases.

2) There is a Camera component in OpenMAX. People managed to create an OpenMAX recorder for Raspbery Pi. I yet have to find a working solution for Android.

These two questions are unanswered:

and I'm going to try OpenMAX.

3) We ran into an Android device where video4linux2 works (one can access /dev/video0).

Community
  • 1
  • 1
Victor Sergienko
  • 13,115
  • 3
  • 57
  • 91
1

Post Android 7 or API version 24 : Camera 2 APIs are possible not just in Java space but in the native(NDK/C++) space too. This article give you all the details with code.

Milind Deore
  • 2,887
  • 5
  • 25
  • 40