Android NDK and rendering to live wallpapers - android

I'm just looking around for starting learning NDK, with one particular project in mind:
I want to continually render a changing bitmap from NDK side to be able to show it in a live wallpaper.
(hence I'm not talking about rendering to OpenGL texture here, but about rendering to a Bitmap)
I googled a bit and found out that there's an option to directly manipulate a Bitmap pixels. But I also found that documentation says that this feature is avaiable only since Android 2.2.
And I'd like to support 2.1 in my live wallpaper.
On the other hand I found several projects that do similar stuff - render something from ndk and show it in live wallpaper. And they work on 2.1. Examples are: wonderful Video Live Wallpaper, and I think Shake Them All Live Wallpaper does the same kind of stuff.
So the question is - am I missing some other way to do continuous rendering to LW other than direct manipulation of Bitmap data?
Or some other thing I got wrong? :)

As far as I know, the other projects that do rendering with the NDK and use jnigraphics prior to 2.2 actually include that library in the project and load it as a 3-rd party library.
See the description of PREBUILT_SHARED_LIBRARY in android-ndk-r5b/docs/ANDROID-MK.html for more information on how to do that.
You can find jnigraphics in:
android-ndk-r5b/platforms/android-8/arch-arm/usr/lib/libjnigraphics.so
Of course, I don't know if it's actually permissible to redistribute part of the NDK (maybe someone else can weigh in on this), but apparently the only holdup with using jnigraphics prior to Android 2.2 is simply the fact that it's not present in earlier releases.
Hope that helps.

Related

Android face detection alternatives

I have sucesfully implemented face detection in my app using Android's Camera.FaceDetectionListener (following the Android Developers guide), but unfortunatelly some devices does not support this feature. Is there another way to achieve the same result?
I usually work with OpenCV to make image processing algorithms.
http://opencv.org/platforms/android.html
Its algorithms are much better than Android face detection, besides if you download the SDK you have a faceDetection example.
Here are the downloads:
http://opencv.org/downloads.html
The sdk, handles camera api 2, which it works at 30 fps, with a wrapper if you want to process video frames. Besides there are samples where you can mix Java OpenCV code with JNI code, to make so much faster your algorithm.
Unfortunately, these examples are made on Eclipse projects, but they are not difficult to merge into Android studio project.
I hope that these references are useful
Cheers.

Image Panorama in Android

In my app, i need to take continuous images and make them as panoramic.For that it requires android sensor rotation calculations.Accelerometer pitch,roll,azimuth returns values based on orientation.But it is not accurate,ie suppose if a image is taken in the beginning as the starting image,then next image should be clicked only after sufficient device rotation.Likewise it should take some 5 - 6 images and make one panoramic image.
Here the problem is:
How to calculate the device rotation(using augmented reality if possible) and take images automatically?
Any help is appreciated.Thanks
My answer is actually not about gyroscope, and I don't know if it's still actual for you, but hope it will be helpful for someone.
Panorama feature is already implemented in standard android camera at least since Android 4.0 (perhaps it was available in even earlier versions but I'm not sure, you can check it), so since source code is open for everyone, it might be the easiest way just to copy required functionality.
Although you can download source of apps from https://android.googlesource.com/ (you want LegacyCamera or Camera), you can't just open project of any standard app in Eclipse or other IDE. For example, LegacyCamera depends on Gallery2 and other dependences that might be hard to be resolved.
I spent several days trying to move panorama feature to separate project. You can download it from here: https://github.com/yankeppey/PanoramaSample . Several remarks:
Functional core (creating one panorama image from several ones, progress notices, etc) is on native part.
I used java code from from LegacyCamera which was used in Android 4.0-4.1, not 4.2, because it was significantly easier for me. Native part is taken from 4.2, it has only minor changes inside and almost the same JNI interfaces.
This project is just to help you move panorama feature to your own app, it's not like kind of library, don't expect clean code without bugs, it's just pretty dirty and buggy project. If I have time I'll try to make it cleaner, but there is no warranty :)

Include OpenCV in android application package

I need to work on detecting edges from an Image, I'm using Canny algorithm for that.
Since OpenCV for android is available 2.4.2 while i'm trying to run examples it says.
"OpenCV Manager is not installed, please try to install it." after install it from the market it is working fine.
But if i want the user's to install my application so that they don't have to install another .apk for using my application.
-> How to use openCV without without asking for another application i.e. manger should be pre installed.?
-> is there any way i can use Canny algorithm for edge detection without OpenCV any good angorithm tutorials for implementing in in android.?
You might find information about this on the OpenCV webpage. This said, this is deprecated and OpenCV advises not to do this in production. The manager actually allows the user to download the OpenCV library once for all. Then, your application will be much smaller!
About not using OpenCV, you can try FastCV (as Aaron suggested), but it seems overkill for your application (and it requires you to be familiar with NDK development). With OpenCV, in the other hand, you can code either in java (by the way, have a look at JavaCV) or using the NDK.
Finally, if you only need a Canny Edge detector and don't want to use a library, you can try to write it yourself. The related page on Wikipedia should be enough for this (I could do it a few years ago as an exercise).
Have you looked into Qualcomm's FastCV? It offers some of the more common image processing algorithms offered in libraries like OpenCV. They also have a pretty cool augmented reality API called Vuforia.
Fair warning, the support documentation isn't that great and it requires that you are familiar with NDK development.
https://developer.qualcomm.com/mobile-development/mobile-technologies/computer-vision-fastcv

android 3d live wallpaper - what engine to use?

I saw this live 3d wallpaper and was wondering how it is made, e.g. what engine should be used to make it? From what I found, Unity3D currently does not support making wallpaper...
If you would like a true 3d live wallpaper, you can check out Rajawali here:
https://github.com/MasDennis/RajawaliWallpaperTemplate
Follow his tutorials and utilize that template and you can make some really amazing live wallpapers. I use it myself and found it very fun and educational.
Check out this live wallpaper made with the Rajawali library:
https://play.google.com/store/apps/details?id=com.PM.AutumnGrove3DFREE
It's not mine but it definitely shows the potential with the Rajawali library.
Hopes this helps you and anyone else looking to make a 3d live wallpaper.
I don't know if you can make 3D wallpapares, but try with
AndEngine
or
Cocos2D
Checkout Unity3D and the Unity2Eclipse plugin, it's the easiest way I've found. Be warned, it's still beta and you have to use Unity 3.4 to get it to work. I see a lot of Unity crashes in my error reports and my retention rate is pitiful
I've got some examples of what you can do if your into Sharks, Neon, Zombies and Birds they are worth checking out http://www.app8ite.com/live-wallpapers/
You can use Uni2LwP (not free) and Unity3D. This new plugin works very well with almost every version of Unity.
Check dev thread for more information : Forum
From analyzing the screenshot you've provided, it seems like a pretty simple scene, with some post-effects added on top of the final image. Unity engine makes it easy to do stuff like that, with its visual editor, good asset import pipeline and post-processing chains. There are others engines that you could use to achieve similar visual quality (Rajawali is a particular good example), but it'd be a much more tedious task.
The negative side of using Unity is that it is somewhat heavy - it's expected to have an APK of around 9 MB in size for an empty scene. This doesn't really matters if you have a resource-heavy live wallpaper, though.
I've recently released uLiveWallpaper - a Unity asset that makes it possible to create live wallpapers for Android using Unity 5. It is well-tested and reliable, creates projects for Android Studio, complete with placeholder code to get you started.
Check it out!
http://forum.unity3d.com/threads/ulivewallpaper-develop-android-live-wallpapers-with-unity-5.375255/

Android image filter libraries

Are there any image libraries available for Android as seen in http://www.jhlabs.com/ip/filters/index.html? Or have some one ported the same? Thanks in advance.
I know this is an old topic, but in the absence of the AWT libraries I have started porting some image filters from the Marvin Image framework (found here)
I have set it up as a googlecode project here so feel free to go check it out.
I don't believe there is a very elaborate set of them, but the graphics class contains a number of methods that are useful for some types of these operations.
For example, using the color matrix you could perform a convolution on an image. Depending on what you want to do, you may have what you need.
Samsung S Pen SDK Has image filters. The filters are implemented for ARM devices. Here's a link: S Pen SDK. Works fine for any Android devices with or without S Pen.

Categories

Resources