I am making an app for extracting number from image card using sample code of android-ocr(tesseract-ocr).
I have trained the data as per the card font. It is detecting few card if the card having unique background, but if the card having multi background (attached sample) then the number is not recognizing.
Even if the card number little overlapping the background then also not recognition.
I tried to use the steps below, to remove the background:
Smoothing the cropped image using:
GaussianBlur( crop, crop, Size(3,3), 0, 0, BORDER_DEFAULT );
cvtColor( crop, crop, CV_RGB2GRAY );
Edge detection used sobel:
crop = SobelEdgeDetect(crop);
Converting to bitwise not cv:
bitwise_not(crop,crop);
Used adaptiveThreshold to remove shadowed kind of things:
adaptiveThreshold(crop,crop,255,CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY,75,10);
After using these steps I am getting the image (attached bar-Process`png, citi1-Process.png, citi-Process.png), which is coming bold with blank space inside the number. In this case the ocr application is not recognize the number.
I do not know how can fill these number with bold letter.
Now the big challenge for me to remove the background from any image card with out disturbing the text part of the card. So please suggest me how can I overcome all the above issue specific how can remove the background of the image`
I have attached few sample & output data for your reference.
Thanks & regards
Anil
Related
I recently aquired a 112x16 pixel Flip-Dot sign and I want to put cool stuff on it. (Think current temp, playlist items etc.)
The sign has two modes, a rather limited text mode and a bitmap mode.
I know how to put text or a bitmap on the sign, what I'm looking for is tips how to put texts, sprites and simple things like a line on a bitmap that I can then put on the sign.
For example: If I want to show a progress bar of my current playing Item, I would want to draw a few lines/rectangles showing the progress bar, and some text with current and total time above it.
I'm not looking for specific code, but what libraries/projects you would use.
At first glance a BufferedImage looks right to hold the image, but can't find a lot on how to draw on it.
Also, looking for specific tips on low-res bitmap fonts.
I could find a lot on how to draw on the android-specific Canvas, which isn't helping, since this will be something that runs on a raspberry Pi.
I'm uploading an image, from that image I want to get the white color rectangular portion which contains some numbers or even if I get the location means the pixel values of that whole rectangular portion it will be sufficient for me.
I want to send that block of image to Tesseract for Image Processing,
Can anyone tell me How can I get it ?
Note - I do not want to use OpenCV.
Thanks in Advance !!!
How can crop and display a character in an image without using mouse?
The image contain only a one charater and nothing else.
Example a scanned copy of a paper, which contain a character drawn on it.
This will require some image processing, and there is a lot of libraries available for this task. General processing sequence would be:
convert image to b&w image
calculate integral image over it
using integral image determine glyph boundaries
( if nothing of the above make sense to you, read some image processing books first )
You could get Slick2D library and then use the SpriteSheet class to crop it. It works like this:
SpriteSheet s = new SpriteSheet("imagelocation");
Image cropped = s.getSubImage(x,y,width,length);
Worked for me :D
I have to create a custom component on my JFrame, the Component will show the storage status of that user, the storage will be in percentage.
I need to create something like this:
I tried a custom JLabel to create a label and then coloring that label from left to right, but I was unable to create a cloud shape Label and then filling that label according to a variable value.
How should I do this and what is the best way to do it?
One time I thought I should use series of images to show the status of user storage.
Thanks!
I think you're going to need to use an image mask (examples here and here) if you are to replicate that cloud exactly.
The process will require 2 images:
The cloud outline (the blue parts)
An image mask is the shape of the cloud, probably black outside and white inside
Then your drawing process, which you'll have to do each time the % storage changes will be:
Create a new buffered image
Draw then green fill bar in the style you want (e.g. slanted as in this image)
Copy the image mask over this
Draw this new image to the screen, with the mask applied as described here
Draw the cloud outline image to screen
That's going to take an hour or so for you to put together, so I'm not going to do it for you. Have a go, and if you run in to problems (or don't understand anything I just described) then ask about that specifically.
You can use GlyphVector#getGlyphOutline() to get the shape of a Unicode character like ☁ \u2601 and fill it with a GradientPaint.
You can do that with a JLabel and a custom-implemented class derived from Icon.
doesn't this help? Java gradient label example
And if you understand (or can translate from) portuguese, there's also this discussion with a solution at the end
My web application requires users to upload a passport-style photo of themselves. This photo will be used to generate several images:
web avatars of multiple sizes to display within the application (72 dpi)
printable image to print a 1"x1" face shot using an ID card printer (300 dpi)
printable image to print in reports on a standard printer (300+ dpi)
I'm going to use a jquery-based image cropping tool (perhaps JCrop) so that the user can select an area just around their face and disregard the rest of the image.
Are there any techniques to make sure that the image that is uploaded is of high enough resolution that it can be printed to the card printer and regular printers with a dimension of at least 1" x 1"?
My understanding is that EXIM dpi information is not reliable. Should I simply verify that the size they select in the crop equates to at least 300x300 pixels in the raw image?
Would it be best to handle this on the client in javascript or on the server (which is using Java)?
Well if you want to make sure the image resolution is big enough so that it can be printed at 300dpi with a good quality you just need to make sure that the part that is being selected by the user.
After having a quick look on JCrop it seem like you can access the coordinates of the selected image part easily (using showCoords() ).
With that you know the size of the selected image parts in pixels. It now depends on how big you want to print your image with 300dpi.
Therefore for i.e. an US Letter at 300dpi it needs to be 2550x3300px. For DIN A4 it would be 2480x3508 pixels.
So out of the coordinates you get from JCrop simply calculate how big the rectangle dimensions are in pixels and check if it's big enough to be printed to the size you desire at 300dpi...
Hope that helps...
Edit:
If you want to make sure the image is correct, by which I mean it has a face that fills about 80% of the image you could try using a python script that uses OpenCV... OpenCV already provides basic face detection algorithms. So maybe you can have the uploaded image run through the face detection algorithm which then says whether it contains a face or not...