Adjust Image properties (Like change contrast, brightness etc) using NDK - android

How to perform image manipulations using NDK?
I have already set up the NDK and have done a lot of research on the topic but did not get any result.
Thanking you in advance

For a quick start I would recommend Craig Lindley's book (Practical image processing in C). The image (bitmap) is nothing more than a 2D array of bytes (actually represented as an 1D-array). You may manipulate individual pixels to achieve brightness/contrast adjustment.
Build the histogram, recalculate new values for the image (to adjust constract).
If you don't want to read any book, look for tutorials like this: http://homepages.inf.ed.ac.uk/rbf/HIPR2/histgram.htm and read about it on Wikipedia

Related

Can we add a invisible image watermark to another image in Android? If yes then how?

I need the code to add invisible watermark to another image in Android
As the comments mentioned, Stackoverflow isn't a free coding service. I will provide you with a high level design advice from which you can implement your own code.
Invisible watermark could just be metadata. The point is to make your particular photo unique and identifiable, right? I would recommend you looking into image metadata manipulation for a simple solution.
That being said, if you are looking for some high tech stealthy watermarking, then you might be looking for pixel manipulation. You can change a few of the pixel colors so if it's compared with the original image with the naked eye, it looks identical but if compared with their base64 encoding you can see a difference. Simply create your own pattern as some sort of signature to attach to images to identify them.
Both method allows you to determine if an image is yours due to the "watermark" you leave on it.

How to get Color Depth and Bit Depth from an Image Android

I have been trying for some days to find the Color depth and/or Bit depth of any already available image (jpeg,png format preferable) in SD card for Android.
I have not been able to get any breakthrough till now.
I want output to be accordingly like 8 bit,16 bit,24 bit,32 bit...
Yes it should be inclusive of the R,G,B pattern.
I have stumbled upon A Java class to determine image width, height and color depth for a number of image file formats. Written by Marco Schmidt
Any guidance is welcomed.

Manipulate bitmap for best ocr detection

I'm using Tesseract ORC library to extract text from images taken on screens. Problem is that most modern cameras also captures the pixel on a display while taking a photo.
Is there anyway to apply like a filter or threasholding to the bitmap to "extract" the text to a clearer one for better results with tesseract?
Se example, before processing:
After processing (threshold effect in photoshop):
Tesseract has a built-in threshold method, TessBaseAPI#ThresholdRect. Have you tried that? If so, what problems did you have with it?
If it didn't work so well on some pictures, you may want to try looking up some "mean" or "adaptive" threshold algorithms, since it looks like Tesseract's is a straight threshold, so it may not adapt well to darker/lighter images without some tweaking.

Image processing in android with stretch scale and Twist effect

Now a day i am doing a project related to image processing with the fallowing feature
1)Stretch 2)Scale 3)Twist
I am not understand how to achieve it in android.
Here i am putting some screen shot related to this project for makeing more clarity in my question.
The above image is the real image i want to apply image processing over this image for making it like
blow image.
Please me any suggestion,help url ,tutorial and other thinks for achieve this task.
You need to find a function which, when applied to pixel coordinates, outputs new pixel coordinates producing the twist effect you're looking for.
It may help to take a look at some of the functions listed at http://reference.wolfram.com/mathematica/ref/ImageTransformation.html (esp. the section "Neat examples").
Once you have defined the function, you'd need to implement in Android the equivalent of the ImageTransformation command. Basically, for each pixel in the output image, call the function to know where to sample in the input image; use windowing when sampling the input image so that you limit artifacts and get a smoother result.

Is it possible to chop a bitmap to small pieces without loading the entire thing into memory?

I'm working on an image processing application for Android that recognizes music notation from pictures taken of music sheets.
I tried to load the entire image into a Bitmap using the BitmapFactory.decodeFile(imgPath) method, but because my phone doesn't have enough memory I get a "VM heap size" error. To work around this, I'd like to chop the full image into smaller pieces, but I'm not sure how to do that.
I also saw that it was possible to reduce the memory size of the Bitmap by using the inSampleSize property of the BitmapFactory.Option class, but if I do that I won't get the high resolution image I need for the music notation recognition process.
Is there anyway to handle this without going to NDK?
Android 2.3.3 has a new API called android.graphics.BitmapRegionDecoder that lets you do exactly what you want.
You would for instance do the following:
BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(myStream, false);
Bitmap region = decoder.decodeRegion(new Rect(10, 10, 50, 50), null);
Easy :)
If it's from a camera the image will likely be jpeg format. You could use an external jpeg library - either in java or via the NDK, whatever you can find - to give you better control and load it a piece at a time. If you need it as an android.graphics.Bitmap then I suspect you will then need to re-encode the subimage as PNG or JPEG and pass it to BitmapFactory.decodeByteArray(). (If memory is a concern then do be sure to forget your references to the pieces of the bitmap promptly so that the garbage collector can run effectively.)
The same technique will also work if the input graphic is PNG format, or just about anything else provided you can find suitable decode code for it.
I think that by loading the image piecewise you are setting yourself an algorithmic challenge in deciding what parts of it you are really interested in the full detail of. I notice that BitmapFactory.Options includes the option to subsample, that might be useful if you want to analyse an overview of the image to decide what regions to load in full detail.
If you're dealing with JPEG images, see my answer to this question as well as this example.
I don't know how possible it is to get libijg on Android, but if it is, then it's worth a shot.

Categories

Resources