I'm attempting to find an image processing library that can add filters and things of this nature. Something like ImageMagick (which I have tried, but couldn't get png support and other issues specifically with Android).
The main requirement is that it produces the same images given the same filters in iOS, linux and Android.
Have a look to android package graphics. It contains all that you need to perform image transformation and filters and there are a lot of example on the web.
Related
I have checked this question.
It is very similar:
I want to record a video with android camera.
After that with a library remove the background, which is with chroma key.
First I think I should use android NDK in order to escape from SDK memory limitation and use the whole memory.
The length of the video is short, a few seconds so maybe is able to handle it.
I would prefer to use an SDK implementation and set the android:largeHeap="true" , because of mismatching the .so files architecture.
Any library suggestion for SDK or NDK please.
IMO you should prefer NDK based solution, since video processing is a CPU-consuming operation and java code won't give you a better performance. Moreover, the most popular and reliable media-processing libraries are often written in C or C++.
I'd recommend you to take a look at FFmpeg. It offers reach abilities to cope with multimedia. chromakey filter may help you to remove green background (or whatever color you want). Then you can use another video as new background, if needed. See blend filter docs.
Filters are a nice and powerful concept. They may be used both via ffmpeg tool command line or via libavfilter API. For the former case you should find ffmpeg binary compiled for android and run it with traditional Runtime.exec(). For the latter case - you need to write native code, that creates proper filter graph and performs processing. This code must be linked against FFmpeg libraries.
I'm trying to decide which library to choose in order to create app that can
filters a video, for example beautify or clarity.
During my search I came across 2 candidates: OpenCv and FFmpeg, and I found a complete framework only for FFmpeg(so +1 for this).
I couldn't found a complete comparision between the two so if someone has tried them and can post the answer it would be really helpful.
Edit:
Another candidate is Marvin framework(Java project) for Android - https://code.google.com/p/android-image-filtering/
OpenCV is a framework for Computer Vision and it's very limited for what you need because it requires you to write most of the cool filters yourself. Nevertheless, it provides a few techniques to blur images, change contrast, convert to grayscale, flip, crop, threshold, erode, dilate, resize, rotate, isolate colors, composite, and few other things. Just so you have an idea of how to implement filters, I recently implemented a Displacement Map Filter using OpenCV.
FFmpeg has a few filters as well, but it's meant to be a cross-platform solution to record, convert and stream audio and video, which means it doesn't really offer many filter effects.
Nevertheless, both APIs can read video (files and stream from camera) on Android and provide access to the video frames so you can execute your custom filters.
I believe the technology that can really help you bring a large collection of filters to your application is ImageMagick. Note that ImageMagick doesn't handle videos, so you can use Android's native API, OpenCV or FFmpeg for this part. Here are a few examples of what you can do with an image using ImageMagick from the command line, a program interface, or script:
there is a very useful OpenGL ES 2.0 library for video processing with many filters for ios
GPUImage for Ios
the android wrapper is here :
GPUImage Wrapper for Android
The GPUImage framework is a BSD-licensed iOS library that lets you apply GPU-accelerated filters and other effects to images, live camera video, and movies. In comparison to Core Image (part of iOS 5.0), GPUImage allows you to write your own custom filters, supports deployment to iOS 4.0, and has a simpler interface. However, it currently lacks some of the more advanced features of Core Image, such as facial detection.
My android app uses only two image processing functions in the OpenCV library - Gaussian blur and Adaptive Threshold.
The beta testers of my app all feel that it would be better if they don't need to download the seperate app, the OpenCV Manager before they can use my app. I could include the OpenCV library inside my app but my app would increase in size by 50Mb which is not very great..
Is it possible just to extract these two functions out? Or is there java source codes which could perform adaptive threshold on a Bitmap out there that can be used?
Thanks in advance!
How can i make some loop that run on all the pixels on the image that i got from the camera ?
I want to be able to scan all the pixels and according to the RGB of some pixel i need to make some decision about the next activity that my application will make.
I know some android or java image libraries, maybe you can find what you want in one.
Android image filter
Android image filtering
Jhlabs pure java and Android
Javacv
JJil
I think you can use some C++ libraries too, like:
CImg
OpenCV
Does Android support SVG? any example?
The most complete answer is this:
The Android 2.x default browser does not natively support SVG.
The Android 3+ default browsers DO support SVG.
To add SVG support to 2.x versions of the platform, you have two basic choices:
Install a more capable browser (like Firefox or Opera Mobile - both support SVG)
Use a JavaScript polyfill that can parse SVG and render it to an HTML5 canvas
The first option is okay if you're just trying to make SVG work for personal uses or a limited (controllable) set of users. It's not a great option if you want to use SVG while targeting a large, uncontrolled user base.
In the later case, you want to use a polyfill. There are many JavaScript libraries available today that can prase SVG and render to a canvas. Two examples are:
canvg
fabric.js
Using a polyfill, you can render your SVG in a canavs on all versions of Android 2.x.
For a more complete example of this approach, you can refer to this blog post that discusses the use of the canvg polyfill for making Kendo UI DataViz charts (SVG-based) work on Android 2.x. Hope that helps!
There is a new open-source library that supports loading and drawing SVG Basic 1.1 files: https://github.com/pents90/svg-android. Performance is good as the actual drawing is handled natively by an android.graphics.Picture object.
There is a new library (under active development) androidsvg which allows one to incorporate svg images directly in to projects. It has the advantage of defining an SVGImageView which allows one to incorporate an svg directly in the layout xml.
Finally, including svg in android is straightforward.
More details: Stack Overflow post
Android supports vector drawables: https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html
And there exists an Android SVG to VectorDrawable Converter:
http://inloop.github.io/svg2android/
I know my solution is somewhat hardcore, but it works great, doesn't require any external libraries (at least not in your final code) and is extremely fast.
1) Just take an existing SVG loading library, such as for example svg-android-2 (which is a fork of svg-android mentioned in another answer, just with more features and bugfixes): https://code.google.com/p/svg-android-2/
2) Write a simple app that will do nothing else but load and display your SVG image.
3) Modify the SVG loading library, so that it prints the Java code that creates the Picture class or saves it in a String variable.
4) Copy-paste the Java code obtained this way into the app you are writing.
To get more information about this technique and download sample source code, go to my blog:
http://androiddreamrevised.blogspot.it/2014/06/transforming-svg-images-into-android.html
You can get a working example of this technique from Google Play here:
https://play.google.com/store/apps/details?id=pl.bartoszwesolowski.svgtodrawablesample
Here's an example of a commercial app created using this technique (Milan metro map):
https://play.google.com/store/apps/details?id=pl.bartoszwesolowski.atmmetroplan
Notice how fast the map loads and how pretty it looks, even when magnified.
Firefox for Android supports SVG.
Opera Mobile for Android supports svg, and Opera Mini supports static svg content.