image noise reduction in android - android

I've written a camera app which allow users to capture image of paper bills, send to server where it'll be printed.
Problem:
when I print the image, the background is blackish due to noise in captured image. All I want is a clean white background. I've tried Bitmap's compress method to save the image in JPEG/PNG format on different scales (1-100) but not much helpful. I've seen camscanner app doing this fantastically but have no clue how.
Any pointer to achieve this will be helpful.
thanks.

If the issue is some random noise, there are some noise removing filters out there you can use (i.e. median filter or a bilateral filter).
Is the image already binarized (converted to strictly black and white pixels)? You'd want to do the filtering before this.
EDIT(after clarification on dark gray): Since the background is a dark gray I'm guessing the problem is just that it is a low contrast and since it will be a natural image, there will be variation on how bad the contrast is. I suggest using Sauvola binarization for this which will separate out the black and the dark gray to black and white. Here is some detail and example results of Sauvola: http://www.leptonica.com/binarization.html. To run some tests to see which binarization algorithm would be best you can find a library here

Changing compress ratio cannot give any help to this question. A strong filter will help you reduce the noise.
Try to have a look at this Link

Related

Why Tesseract Tool for Android does not work in many cases

I am trying to implement Tesseract library to get text from the image, it works in some cases but in mostly it fails.
I am using this library in my Android project: https://github.com/rmtheis/tess-two
I am trying with this image
Actual Result
Expected Result
Wikipedia
The free Encyclopedia
Any suggestions as to why it's not working?
It's not working because of:
The uneven illumination in the image
The presence of part of the globe graphic at the top of the captured image.
By taking a picture of the screen, you're introducing some darker areas on the image that's captured. To fix it, you could use the image directly instead of taking a picture, or you could add code to your app to adjust for the uneven illumination.
With different illumination, and cropping around the text area, I get a better result:

Cleanly down-scaling images in Android: can it be done?

I'm having trouble cleanly down-scaling images on Android. I'm looking to scale small PNG images between arbitrary sizes of about 10-100% of their original size.
I've created a sample image to demonstrate the problem and exacerbate the unusual behaviors I'm seeing in Android's image scaler:
The above image is a screenshot from an Android device with some annotations added. I've also added the same images in a second column on the left side showing how they are rendered with a linear scaling by "The GIMP" (GNU Image Manipulation Program).
The base image consists of a checkerboard pattern background of red and blue pixels. On that background I've drawn some 1px-wide yellow lines and fairly thin green text. The image is 288x288 pixels.
When scaling the image to 1/3 of its original dimensions, Android seems to simply grab one in nine pixels, throwing out all other data. Some of the yellow lines disappear entirely as a result. Remarkably, the checkerboard pattern remains intact (which is simply a result of every 3rd pixel being used).
When scaling the image to a dimension of near-but-not-exactly 50% of its original size, e.g., 142x142 or 143x143, the scaler creates some fairly large anomalies/artifacts on the image.
At 50% size (144x144), the image looks correct.
The test image does bring out the worst of the image scaler, but "normal" PNG icon images are severely impacted as well. From 10-33% or so the images aren't properly resampled, and thus appear extremely "bitmapped". And certain larger size images have very strange anomalies in them at certain sizes.
If anyone knows a means to disable this strange scaling behavior, even at a performance cost, I'd greatly appreciate knowing about it. It can certainly be solved by writing an algorithm that works directly on the pixels of bitmaps, but I'm hopeful that isn't the only option.
Also noteworthy is the fact that all image work is being done with ARGB_8888 Bitmap.Configs. I've tried manipulating image size by setting maxwidth/maxheight on ImageViews, by using Bitmap.createScaledBitmap(), and by using Bitmap.createBitmap with a Matrix. All attempts have this same result. Bitmap filtering is enabled.
Thanks again for any suggestions!
Using Bitmap.createScaledBitmap() and Bitmap.createBitmap with a Matrix is the same; see the source for Bitmap.createScaledBitmap (which hasn't changed since Android 2).
On Android 4.0+, using a matrix (as in Bitmap.createScaledBitmap) allows hardware-accelerated operations if enabled (enabled by default on 4.1+ IIRC), thus we doesn't have direct control over what is being done and how it is done.
That means you'll have to implement your own scaling method using the desired (here, linear) filtering; either by pixel processing; or using OpenGL ES with the good filter, but it may not be available on all devices.

I am working on android camera app,I want to capture image and change its background using green screen chroma key effect

I am working on android camera app,I want green screen chroma key effect to captured image.
I have used http://code.google.com/p/chroma-key-project/downloads/list this chroma key project with my code,but it doesn't make that much sense to me.I am capturing image in green/blue background with chroma key effect then I need to set white background to it.. please help me out.
I am using this code for tablet but the program is automatically crashed and It gives this type of error "java.lang.OutOfMemoryError: bitmap size exceeds VM budget"..why? and what should i do for this?
The answer is rater simple, your application does not have enough memory to handle the bitmap size. What you should do is use smaller bitmaps to work with.
Rolf
Edit: it could be useful if you post some code y'r using.

Cocos2D android background image gets messed up

so im trying to make a game with just a simple static background at the moment, but when i draw it to the screen (no scaling being done as the resolution of the image is the same as the screen) it draws the bottom portion of the image incorrectly where the bottom few hundred pixels of the image are exactly the same going down the image. Sorry it's so difficult to explain but being new here i cant actually post an image of what is going wrong.
Now im just using a simple sprite to render this background image. Here is the code being used:
// background layer: another image
background = CCSprite.sprite("WaterBackground.png");
// change the transform anchor point (optional)
background.setPosition(CGPoint.make(GAME_WIDTH/2, GAME_HEIGHT/2));
addChild(background);
am i doing something wrong here? Does Cocos2D not support such large images for sprites? (resolution of 800*1280)
Any help would be greatly appreciated!
Since i am now able to upload images, here are visuals of what is going wrong:
And the problem in my game:
As you can see, the problem is hard to describe. The problem only exists with this larger image; i scaled it down manually in GIMP and then scaled it up for the game and it looked fine (except for being a lower resolution). I also tried scaling down this larger image which still resulted in the same problem. Hopefully you guys can help me as I have no clue what could possibly cause this error. Especially since i read that Cocos2D's max supported image size is 2048*2048 and my image is well within that.
Thanks for any help you guys can provide!
This is due to limitations on the size of textures. Coсos2d-android supports images with a maximum size of 1024 x 1024 pixels.
I faced the same problem and looking for a way to solve it.
EDIT
I found the solution
In cocos2d project open file CCTexture2d.java in org.cocos2d.opengl package and change kMaxTextureSize from 1024 to 2048
I'm not certain, as from your code and looking at the cocos2d code I can't see a definite reason why this would be happening, but given the number of sprites you've got on the screen, i'd definitely take a look at my answer to this question as you may well be hitting one of cocos2d's quirky little rendering faults around multiple sprites. can't hurt to try spritesheets, and it's certainly the correct way to actually do sprites in cocos.
also, definitely create yourself a helper utility to determine the scaling ratio of a device compared to your original image sizes, as unlike on iphone, android does have a pretty much unlimited variation of screen resolutions, and a simple bit of "scale as you load" utility code now will save you lots of time in the future if you want to use this on any other device.
you should try to make one method for adding background,i am doing this this like this way try this hope it will help full for you...here addBackGroundScene is my method and i am adding my background with this method,scrXScaleFactor is maintaining scaling part of my screen try this...
private void addBackGroundScene() {
CCSprite bgForLevel1 = addBackgroundAtOrigin("prelevel1/bgMenu.jpg");
bgForLevel1 .setScaleX(scrXScaleFactor);
bgForLevel1 .setAnchorPoint(0, 0);
addChild(bgForLevel1 );
}

Single Pixel Color Correction

I've created an android application that produces an image as output. This image has pixel errors that are unavoidable. Images are held in an integer array with a size of the image's length*width. The pixels are in ARGB8888 color configuration. I've been searching for a method to both find and approximate what the correct value of the pixel should be based off the surrounding pixels. Here is an example output that needs to be color corrected.
Median filter is your best friend in this situation. This is called salt-and-pepper noise.
That doesn't look (or sound) like what is normally meant by "color correction". Look for a despeckle algorithm.
Gaussian filter might work, or Crimmins Speckle Removal. You'll probably want to understand how Kernel Filters work.

Categories

Resources