So I'm trying to work on pure native android application as i need the performance of C/C++. I want to access the camera in a NativeActivity, grab the frames and process them using OpenCV and custom library. I have found multiple answers for using the new JavaCameraView with the cvCameraViewListener2 but in my opinion doing a JNI call to C++ everytime is completely unnecessary and time consuming - and a lot of the forums even post that JNI are expensive!
So my question is if there is either a way to integrate OpenCV in Android SDK Version 23 (6.0 Marshmellow) or another way of accessing the camera natively as i did not have any success finding an alternative. I am running android 6.0.1 on a Samsung Galaxy S7.
Thanks for your help in advance!
so incase anyone was wondering how i solved it...upgrade to Android 7 was necessary. Android 7 introduced NdkCamera headers as #y30 has answered in this post.
Related
I was very tired when making a call recording application for Android.
I know the official Android SDK has not allowed using VOICE_CALL. So my recording is based entirely on the MIC source.
I tried the Android NDK but I also fell into a deadlock.
Someone, please give me away. If you have the source code, it's great. Thank you very much!
Android has officially blocked the SDK method since Marshmallow. After that a work around was introduced with the NDK to solve the problem. This seemed to work in android 6, 7 and 8. The NDK based approach is also blocked in Pie. So technically it is impossible to record calls.
Source
Record a call in Android could be a strenuous work, this because not all Android version support the call recording.
Question 1
Question 2
Question 3
I'm working on converting my SpriteKit made, Objective-C app into an Android app through Apportable. On 'apportable load', I'm running into issues with SKTextureAtlas.
[SKTextureAtlas atlasNamed:ATLAS_NAME_CONSTANT] gives back nil when running on Android, which it doesn't do when running on iPhone.
Are there any particular work-arounds to get a texture atlas to work nicely with Apportable, or am I going to be stuck using regular images?
Thanks in advance!
Unfortunately, our SpriteKit is a hacked-together-over-a-weekend implementation. If it's currently working for regular images, I'd recommend keeping it that way. Internally, we're considering how we can better support SpriteKit in the future--look for notes in future SDK releases.
Is there a standarized API for taking pictures using Android NDK?
Or is it really necessary to go through Java for that?
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
In Android 7 (API 24) Google has added support for native camera access (Camera2 API).
In ndk-r12:
Headers:
$NDK_ROOT/android-24/$ARCH/usr/include/camera/Ndk*.h
$NDK_ROOT/android-24/$ARCH/usr/include/media/Image*.h
Libs:
libcamera2ndk.so
libmediandk.so
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:
OpenMAX recorder on Android
Access camera via OpenMAX in Android
and I'm going to try OpenMAX.
3) We ran into an Android device where video4linux2 works (one can access /dev/video0).
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.
Im long time c++ developer . and I like to start to develop 3d applications and games for the android , now I do know I wil be limit with java VM
So I like to start to develop with c++ with the NDK API , before I start , what version should I start to develop ? 2.3 ? can I do complete application just
With c++ ? what problems should I expect ? can you please point me to articles on the subject.
You can write a complete android application only using c/c++ code. But i would not recommend it due to the fact that you have to use android 2.3 or above and we all know that most android devices out there today, are likely to not ever receive the 2.3 update.
I would recommend you to use android 2.0, because android 2.0 have support for OpenGL ES 2.0 (only) in native code. The three limitations that i know is that you have to "start" your app in java code, you have to grab input in java code (not 100% sure of this) and you have to handle audio in java code. Although you can handle audio in native code if you are targeting android 2.2 and above, but again i would not recommend it since there is a lot of devices out there with 2.1.
Hope that answered some of your Q:s, sorry for tha bad English btw.
Edit: download the Android NDK and read trough the docs, that might clear more things up for you.
I need to open camera from NDK to enhance the performances and I have search several days in internet. But nothing get help.
Does anyone know how to open the camera using NDK?
NDK and Performance:
Native code is primarily useful when you have an existing native codebase that you want to port to Android, not for "speeding up" parts of a Java app.
Avoid jumping to the NDK because you think it'll improve performance. Stick to Java and use the profiler to work out bottlenecks there.