Does anyone know of any good image processing tutorials for android? I’m new to android, and I’m coding an app that places an effect on a bitmap. I can find plenty of tutorials in java, but android does not support awt. I’d like to manipulate the pixels in the bitmap just using the android sdk, e.g. warping, fisheye etc. I can access the pixels and change their colour but I’m not too good with transformations, and not sure where to start.
Has some great tutorials like:
Mean Removal effect
Boost up color intensity
Rounded Corner Image
Watermarking on the fly
Image Flipping / Mirroring
Pixel Color Replacement
Flea / Noise Effect
Black Filter (Increasing the Darkness)
Image Reflection Effect
Draw Text on a Curve
You can also checkout JavaCV that give you Java Objects with bindings to opencv lib. This way you wouldn’t need to do any c/c++ coding, you can do all directly in Java and access functions from opencv.
Answer to your followup question:
For example, take a cylindrical projection: Take a look at the image –
(sorry I’m not allowed to post pictures) this is taken from Szeliskis book (http://szeliski.org/Book/). The relation you have here in the end is
where f is the focal lenght of a camera and s the radius of the cylinder, you can use f=s. Now to get this into loops, here is some pseudocode:
%% xMitte , yMitte are the coordinates for the point in the middle
for yNeu =1: height
for xNeu =1: width
dx = xNeu – xMitte ; %% X relativ to origin
dy = yNeu – yMitte ; %% Y relativ to origin
theta = atan(dx / f);
h = dy / sqrt(dx ^2+f^2);
x = (f * theta) + xMitte ;
y = (f * h) + yMitte ;
BildNeu (xNeu ,yNeu) = BildAlt (x, y);
BildNeu is the new picture, this array has the same size as BildAlt (the original picture).
The Line with BildNeu and BildAlt at the end of the inner loop could be like:
/** returns the color value of that pixel **/
CvScalar pixel = cvGet2D(originalImage, i, j);
/** writes the new color value of that pixel **/
cvSet2D(destinationImage, y, x, pixel);
i found a post where somebody had transcribe a fisheye distortion from C++ into java. It used awt’s bufferedImage so i just matched up the setARGB methods in that class to the corresponding setPixel methods in the bitmap class and it works:). i would be interested in what you mentioned above with the loops. how would you do that if you only know the formular for the projection? how would i transform each pixel to it’s new coordinate? do i just have a src array and a dst array and apply the formular?
OpenCV Android is preferred due to the ease of use on an Android platform, although there maybe limitations. Here are some references that might help:
1.The best way to learn Image Processing on an Android platform is via implementation. Try running and understanding the existing OpenCV4Android Samples on Android Studio/Eclipse. They are available on https://github.com/joaopedronardari/OpenCV-AndroidSamples .
The description of each sample is available on the OpenCVAndroid Samples page. Mixed Processing, Camera Control, Image Manipulations and color-blob-detection deal with pre-processing and image manipulations. They comprise:
RGBA and GRAY preview
Canny (Edge Detection)
Markers (blob detection)
Since you will be working on a Java platform ,the OpenCV Java tutorials will be of use.
http://web.stanford.edu/class/ee368/Android/ has sample projects.
4.Check out The Android Arsenal, for Image Processing libraries.
Note:A Mat object has to be converted to a Bitmap object, in order to display it on the device screen (ImageView).