How to recognize image which template is stored in the app - android

It needs recognize icons. For example, the app scans with with phone camera and recognizes one of the icons below and if it recognized then the app performs some action. It recognizes it by comparing with icons stored in the app.
Any libs, manuals, please.
And how to name this task if to search it: optical image recognition? (This is not OCR because recognizing image, not text, right?)
Thank you very much!

how to compare set of images in java using pixel based image comparision metric based on mean squared error?
Image Comparison Techniques with Java
Java library to compare image similarity
Google "java code to compare two images"
Also you can try perform and compare MD5 of both images, but i can't guarantee it will work(depends on your situation and if the files are the same).

Related

Convert iPhone application logo to Android

I'm working on creating an Android application based on an already created iPhone app. I have a bunch of app icons from the iPhone application that end in '#xx.png' (x being a number).
I know this has something to do with the resolution of the image, but do I have to do anything regarding converting them into vectors/renaming them to a certain standard in Android?
This is not the pretty good practice, but in the end, if you don't have separated dimensions for Android too, then, somehow you can considerate the ratio like this:
#1x -> mdpi (the baseline)
#2x -> xhdpi
#3x -> xxhdpi
You need to use a tool that does what you need, just take the best image with the best resolution from iOS images, and use this link to generate the ic_launcher for android.
To answer your question, when you are inserting images or icons into the drawables folder of Android, you need to ensure the following:
The names of the images/icons cannot contain capital letters.
The file type of the image/icon is either .png or .jpg. .svg is not allowed.
You also can't have symbols like -, _, or #.
You can also refer to this article about naming Android Assets. And this website allows you to make your own app icons.
I hope this answers your question.

Tesseract character recognition problems in Android (but not on iOS?)

I've build an application that uses Tesseract (V3.03 rc1) to identify some specific text strings. These are, unfortunately, printed on a custom font that requires that I build my own traineddata file. I've built the application on both iOS (using https://github.com/gali8/Tesseract-OCR-iOS for inspiration) and Android (using https://github.com/rmtheis/tess-two/ for inspiration as well).
The workflow for both platforms is as follows:
I select a bounding box on the preview screen for where I can crop out the relevant text, and crop the image accordingly.
I use OpenCV to get a binary image (using OpenCV's adaptive threshold function with the same parameters for both platforms)
I pass this binary image to Tesseract. Both platforms (Android and iOS) use the same traineddata file.
And yet, iOS recognizes the text strings perfectly, while Android keeps misidentifying certain characters (6s for Ss, As for Hs).
On both platforms, I use the same white list string, I disable load_type_dawg and load_system_dawg, and also choose to save the blob choices.
Has anyone encountered this kind of situation before? Am I missing a setting on Android that's automatically handled in iOS? Is there something particular about Android that hasn't crossed my mind?
Any thoughts or advice would be greatly appreciated!
So, after a lot of work, I found out what was wrong with my Android application (thankfully, it wasn't an issue with Tesseract at all). As I'm more familiar with iOS apps than Android, I wasn't sure how I could load the traineddata file onto the application without requiring the user to have the file loaded on their external storage device. I found inspiration in this project (http://www.codeproject.com/Tips/840623/Android-Character-Recognition), as they autoload the trained data file.
However, I misunderstood how it worked. I originally thought that the TessDataManager did a file lookup on the project's local tesseract/tessdata folder in order to get the trained data file (as I do this also on iOS). However, that's not what it does. It, rather, checks the internal file structure (data/data/projectname/files/tesseract/tessdata/traineddatafilegoeshere) to see if the file exists and if it doesn't, it copies over the trained data file it keeps in the Resources/Raw directory. In my case, it defaulted to the eng file, so it never read my custom font file.
Hopefully this helps someone else having similar issues. Thanks to Robin and RmTheis for all of your help!

Tesseract - OCR issues with typewriter style fonts

We are using Tesseract.NET (and the Android version too) to recognize and extract document data. It worked really good with Arial and Cambria fonts, but now we have to recognize documents like that:
Tesseract cannot recognize it. Absolutely nothing (except the big sized serial number on the right upper corner).
We tried to train it, but - maybe it's our fault - it's still unstable.
What can we do?
(Btw the font is use by national offices, we cannot get it as true type or other font format.
In the current form it is very hard for an OCR tool to recognize any letters.
Serif fonts are hard to ocr.
Letters are very close together. Some are joined.
A dictionary is not of any help.
You might be able to improve the result with the following:
As this looks like an vehicle registration certificate you should be able to predict the positions of the textstrings of interest and then ocr they separatly.
Thereby using the -psm=7 or 8 option (assume single line or word).
As some strings seem to be numbers only you can help tesseract by using the digits argument.
For the alphanumeric strings it might help to reduce the dictionary pruning (or completely remove the dawg files.)
If those strings like 'ETZ' or 'MZ' are abbreviations you could also build an dictionary with those.
Reducing the yellow and green color is also an (easy) option you could test.
Use the barcode instead of trying to ocr the string.
For tesseract questions it always helps if you specify the version used and, if you do image preprocessing, provide a sample image of the processed input.

Android game Image format

I have a problem with an image for an android game. The problem is not a problem with the code because the code that I use I took from a book (Beginning Android 4 Games Developer).
The problem is this: I know the format that I have to use in android: png, but I don't know the settings for this format that I have to use (like RGB565...). Because if I use simply png, when I run the game the images are not good. So I need someone to explain to which settings I need to use for images for android games.
P.S The software that I used is photoshop. If there is better software for this purpose tell me.
I think there is a strong misconception in your understanding of Android and how it implements graphics. You are not constrained to .png for nearly any of your development. The .png and .9.png are only enforced strictly for managing drawable constants.
Android uses Java and has the capability to utilize nearly any graphical format. In particular native support for .bmp, .png, and .jpg are present for every device and Android OS version. You may even create your graphics in realtime byte by byte.
As for a good image editor, there are a number out there. I often use a combination of GIMP and Photoshop, myself.
Hope this helps,
FuzzicalLogic

Can I use Android SDK classes in a desktop application?

I have some android.graphics.Bitmap data saved to a file that I want to manipulate in a desktop application. The data is generated by a third party application, so I can't modify the app to save the data as png or jpeg.
I am wondering if I can import the android SDK jar into a java desktop project so I can use the android.graphics.Bitmap and android.graphics.BitmapFactory classes? I have tried adding android.jar from the SDK but when I try to call the BitmapFactory.decodeByteArray() method I get a runtime exception ("Stub!").
Please help.
If I can't import the SDK jar, does anybody know the format of the bitmaps that android uses?
The Android SDK is for Android's Dalvik VM, not the the normal JVM, so that is not going to work.
Since it is a bitmap, the data should be stored in a continuous list of Red, Green, and Blue pixels (the order of the colors can vary, there might also be alpha.)
So this might be an image:
[FF][00][00][00][FF][00][00][FF][00][FF][00][00]
Assuming that image was stored in RGB format and was defined as being two pixels wide (the pitch) then it would be a 2x2 px image that represented a tiny red and green checkerboard pattern.
Your app might be exporting the width/height of the image and it might not. If it isn't you'll need to determine the width in order to get a proper image.

Categories

Resources