I've been searching for an API which can generate (and i'll need one that can then read) image hashes.
I don't know if that exactly what they are called. They are those black and white crossword looking like images you see on tickets or groceries at the supermarket that uniquely identify something.
Those are not called image hashes, they are regular barcodes, albeit 2-d or matrix barcodes. The reason why they identify things is due to the fact that the barcode contains a unique id, or in the case of matrix barcodes, quite some amount of data.
Popular examples would be the QR-code or Datamatrix. You did not specify any language, so you have to look up compatible libraries yourself, but I guess with the keywords provided here, this will be very easy.
Do you mean barcodes? QR code?
http://fukuchi.org/works/qrencode/index.en.html (c)
http://code.google.com/p/zxing/ (java)
http://www.twit88.com/home/opensource/qrcode (c#)
The word you are searching for is "barcode". The first examples were one-dimensional. They were patterns of bars and spaces that were scanned normal to the bar. Information is coded by the variations of widths of the bars and spaces. One dimensional barcodes have the advantage that they generally require relatively low-precision print processes to form. They have the disadvantage of low information density. Common 1D symbologies include Code 39, UPC-A and Interleaved 2 of 5.
More recent codes use 2D patterns to pack more information into less area. Common examples are the hexagonal MaxiCode symbols seen on UPS packages, and the various square pattern symbols (QR code, Aztec code, Datamatrix are common) turning up on a lot of goods, in postage, and even in advertising.
There are many recognized kinds of barcode (known as symbologies to the industry). Here is a link to a nice concise list with examples of some commonly found symbols.
Most of the vendors of barcode equipment also sell software to generate symbols and labels containing symbols. There are also a number of open source projects, usually focused on a single symbology, or a group of closely related symbologies.
Related
Local travel cards in Saint-Petersburg, Russia have got huge id numbers that aren't easy to read and type into a web page when topping up the card online. So I want to build a small app that would take a photo of a travel card and parse the number out.
The task is a bit easier than a free form recognition:
card is of the very well known size
id numbers are of known size, are located in the very well known location on a card and they are number only, no letters (okay, there are two variations I think and maybe they will add 1-2 more in the future)
even the font is known in advance
even the first several numbers are the same for most of the card (so far there are only two prefixes used)
How would you do it? Are there any libraries tuned not for the general OCR, but for a "hinted" OCR like I need?
Best regards,
Artem.
P.S.
Actually a free/cheap web service for this task would also be good enough
Yes Google has a library called Tesseract and there is an iOS SDK on Github you can import into your application. So you can use this SDK and it has some documentation that you can read that will explain how to set it up in your app. It has methods that will return you a string with the text of the card in the string. BUT it will be ALL of the text from the card. So best thing to do would be to:
1 "clip" the original image to extract a sub image that displays only the portion of the card you wish to get the numbers from.
2 Process this sub image through Tesseract to retrieve the string you are looking for.
3 Then parse through the string and pick out the data that you need.
But just be warned, it can be a bit quirky. This SDK tends to recognize words best from images that are scanned, not "taken a picture of". Because although it is an advance piece of technology, it isn't perfect. So to get it to work as perfectly as possible for you, try to get scanned copies of the originals.
Best of luck.
The ideal solution for you would have three components:
1) Detection of the card. This is useful because if you have the detection, then the end users have much easier time actually using the scanner, because they can place the phone above the card in an arbitrary direction
2) Accurate OCR component. Ideally, customizable for this exact font you have on the card, for the exact position on the card.
3) Parsing mechanism. This would enable you to obtain the exact string written on the card without writing huge amount of OCR parsing code.
BlinkID SDK has all this. It has a preset for detection cards in the ID-1 format. It has integrated OCR engine. And it provides RegexParser, where you can define the exact format of the text which you're trying to extract from the document.
BlinkID was initially built for scanning ID documents which have very similar properties as the problem you're trying to solve.
Note. I'm one of the developers working on BlinkID.
This question already has an answer here:
How to generate the random default "gravatars" like on Stack Overflow?
(1 answer)
Closed 8 years ago.
What is a suitable algorithm that can be used to generate random, but likely humanly distinguishable, graphic square icons?
Icons, from 57x57 up to 1024 square, such as used for mobile apps, preferably using something like Core Graphics commands/operations? (or an equivalent)
I tried filling square bitmaps with rand(), but they all look like mud, very hard to distinguish between by sight.
Identicon
Random icon you are talking about is an Identicon.
Identicons are icons that are generated from some form of user information.
An Identicon is a visual representation of a hash value, usually of an
IP address, that serves to identify a user of a computer system as a
form of avatar while protecting the users' privacy. The original
Identicon was a 9-block graphic, and the representation has been
extended to other graphic forms by third parties. – Wikipedia
Sample Implementation
You can have a look at:
NIdenticon - a C# library that helps creating simple Identicons. Examine IdenticonGenerator class that has only one method called Create(). You should be able to extract the algorithm/general idea from it.
Contact-Identicons source - Android app source code. The app generated Identicons. This blog post includes a sample of Java code used to generate a 5*5 pixel, horizontally symmetrical identicon much like the ones github uses.
IGIdenticon source - Objective-C identicon generator. A port of identicon library written in Java.
Good luck!
One way to approach this is similar to a random sentence generator: Rather than a random sequence of letters or words, you can use simple grammar templates like "The (adjective) (noun) (transitive verbed) a (adjective) (noun)." Then pick random nouns etc. to fill it in.
So here, you could compose an icon by randomly selecting some small image pieces like a document icon, a person icon, a right arrow, a question mark, etc. Randomly colorize the pieces, using a randomly chosen color scheme. Randomly arrange the pieces together. Add a shadow. Stuff like that.
For avatars, this could work similar to Mr. Potato Head.
My goal is to import EPS file to the app(language is C++) to create a 3D object. I am looking for some library/tool which will help me to parse EPS to a list of primitives(circles, lines, paths, etc. like in SVG) or even contours array. I've already tried the way to convert EPS to SVG first using pstoedit and uniconverter tools. But sometimes both tools make wrong conversation with data loosing. So I can not say that this way is acceptable.
Does anyone have experience in this area or have any suggestions?
This is a big project. For starters you will need a PostScript interpreter, there is no alternative to this, since the EPS can contain very nearly anything.
Rather than writing your own interpreter I would suggest you use an existing one, in fact I would suggest you use Ghostscript as it is the only GPL PS interpreter I know of.
You can write a Ghostscript containing methods which will be executed whenever the relevant operation is interpreted from the input. There is an existing (very limited, incomplete) SVG output device which would get you started.
You are going to have to handle a lot of different kinds of operations if you want a general purpose solution; For instance PostScript doesn't have a circle primitive, its curves are all Beziers, there are different kinds of line joins. You will need to consider what to do with images and presumably text (possibly discard these) and shading patterns. You will have to at least understand the various colour spaces which can be used, even if you don't plan on utilising them yourself.
Given that PostScript is inherently 2D I don't really see how you are going to construct a 3D object, but that's a different problem.
I have a slightly unusual profanity-related question.
Now we're used to dealing with profanity-filtering of user-generated content — any method is imperfect, but products like CleanSpeak and WebPurify do a good-enough job.
The problem we have at the moment, though, is that we've been building an engine to run promotional-code–based competitions, that will be used internationally. We could do with checking that none of these codes is profane in Latin American Spanish or Malay (at least in the first instance), to make sure we don't send out a code that's equivalent to FUCK23 or PEN15 or something.
We've tried Googling around and asking people we know, but we can't find an easy way of getting hold of an es-419 or an ms profanity list to filter the codes against. As there are literally millions of codes per locale, we'd rather do an offline check than hit an API for each code (which would be expensive both in terms of bandwidth and usage fees).
I know this is a bit of a long shot, but does anyone know of a good source for profanity lists in different languages?
#disclaim: We know that no profanity filtering is perfect, that it's essentially futile with user-generated content and we have read SO #273516: How do you implement a good profanity filter? — that's not what we're asking.
Building or finding lists in other languages is extremely time consuming and difficult (trust me, we've built many of them at Inversoft). You might be better off tweaking the code generators instead (from what I could tell your code is generating the promotional codes rather than humans).
The best way to tweak a generator is to ensure that the codes can't easily form words based on the general use of consonants and vowels in most European languages. Things get a bit dicey in Polish and others, but it usually works.
Generally, most codes that start with a vowel are followed by another vowel or a non-joining consonant (like 'q' without a 'u'). If the code starts with a consonant then the next character is the same consonant or one that has a low probability of being used. For example, if you start with 's' then adding 'g' is a good choice.
You could also use wiktionary or other similar sources (like Linux dictionary files) to build a statistical approach to this. By extracting the probability of characters being next to each other, you should be able to generate codes with good accuracy of never being words in any language.
However, if I misread your question and you aren't generating the codes programmatically, you can ignore my response completely. :)
I have had the same thoughts. in trying to generate 6 character codes for a project i am doing.
I decided to reduce the likelyhood of obvious porfain codes So i removed the vowels that i found in as many "bad" words as i could think of, from my intial base 36 generation code. Leaving me with something more like a base 28 system that did not include a,e,i,o,u, 1,0. the one and zero were removed to reduce confusion between those characters in some fonts with I,L,O's
so far I have not seen a "profain" code genreated. Although base 28 has 1.something billion unique combinations.
i cannot vouch for other languages, and had not even considered it...
I'm in the process of researching code pages and have come across many conflicting uses of terminology, even amongst different Wikipedia entries. I just can't find a source of information that spells out the entire character handling process from start to finish. Could someone well versed in this field suggest ways in which the following information is inaccurate or incorrect:
The process of character representation as far as I understand:
We start with sets of symbols (not sure of the correct terminology here, possibly 'scripts') that are not associated with any specific platform. 'The Cyrillic alphabet' is understood to refer to the same entity in the context of Windows as in Linux, for example.
Members of these sets are selected, generally in bunches, by vendors to form a platform specific character set. The platform might assign these various codes such as GDI values on Windows (eg. 0 for ANSI_CHARSET and the other codes mentioned here: http://asa.diac24.net/wiki/index.php?title=ASS:fe&printable=yes). I cannot find much information on these sets such as whether they are in fact coded character sets or if they are simply unordered and abstract.
From these sets, individual code pages are developed that appear to have a one to one mapping with GDI values. Since these GDI values appear to represent sets that are platform dependent, does this mean Windows code pages are essentially a coded version of each individual set?
I've been having trouble reconciling this idea with a link shown to me earlier (which I've lost) that showed a one to many mapping between these GDI charsets and code pages across different platforms. Is this accurate, do these GDI values point to sets from which different code pages across different platforms can be developed?
Each code page maps a member of an abstract character set onto an integer to represent its position in the set. In the case of the 'simpler' code pages mentioned on the above webpage, these can be referred to using the more precise 'character map' term. Is this term worth considering or is the distinction too subtle and unimportant?
A font resolves a code point to a glyph if it contains one for that code point, otherwise it reports a failure. I've also read that a font may return its own blank glyph for those code points which it doesn't support. Can an application distinguish between this blank glyph and a successful resolution, ie. does the font return an error code of sorts with this blank glyph?
I believe that's the extent of my confusion. Any clarification in this regard would be invaluable. Thanks in advance.
You are essentially correct:
Start with the number of known characters.
Select a subset of this characters (a character set)
Map these to bit patterns (code page and encoding)
Render these to an output device by combining the character with a glyph (ie. using a font, a bit pattern, and a codepage/encoding that maps bit pattern to character).
Across platforms, there are similar code pages. And even across many code pages there are similar mappings of value to character. For example, Windows Latin, Mac Roman and unicode share characters for the first 127 values. There is some standardization (eg. http://en.wikipedia.org/wiki/Shift_JIS for Japanese) of codepages so that machines can interact.
Generally for new development, you should be using a unicode codepage with one of the popular encodings. UTF8 is popular on most modern systems. UTF16LE is used for Windows system calls ending in W.
This might be a good match: http://mihai-nita.net/2006/08/06/basic-lingo/