Recognition of a font from an image using PHP
I'm curious - how to recognize font fro开发者_运维技巧m an image supplied...
EDIT: ...with use of PHP? For example - user uploads photo of some text (let's say from a newspaper) and wants to know which font were used or which font is the most similar one.
try this online tool: What The Font
http://new.myfonts.com/WhatTheFont/
What I think he is asking for is a publicly available library for pattern recognition. Basically some sort of OCR, which can identify text, and match the text in an image against font family vectors. Am I correct?
Unfortunately I must say (with my knowledge) that there is no such library available. There is for plain OCR though.
http://www.aquaforest.com/en/ocrsdk.asp
One issue with identifying the font family of an image is that many font families have similar vectors. This means that a font like Georgia could easily be mistaken for Times New Roman, etc.
If you have no scans handy, try http://www.identifont.com/. (But that's not helping you do it in php, admittedly.)
I was searching for the same thing and found this Whatfontis API. It works pretty good for me. You can use any language, input and output is done in json
This is obviously an old question but I'm really proud of our font-matching engine, so please let me add some relative information.
This is not a publicly available library or SDK (at least not yet) but it's an engine embedded in a product:
http://www.findmyfont.com
It reads an image (or take a screen capture) and matches the characters you select against all fonts of your computer - either installed or not.
The matching speed is up to 5 millions fonts/min, that means it can match e.g. an image of 5-6 letters against 100.000 fonts in 1-2 secs.
The matching accuracy depends mostly on the image quality & resolution (a min of 20 pixels height is recommended) and it also depends on how unique is the shape of the selected letters. In general: If you really have the font in your computer and select 2-3 letters of any image, you will find the actual font on the top-5 matches - usually the top match - and this is true for as much as 600.000 font files.
We are now in beta testing of a new release, which allows the application to match also fonts you don't have on your computer by sending a match request to an online server.
I can't reveal much about our proprietary matching algorithm, but I can say this:
a. You don't need to mess-up with the actual outlines of a vector font: A well rendered bitmap of a letter is enough for a successful feature extraction.
b. If you want to achieve a high performance matching, you need to create and store an appropriate index by scanning once all letters of all fonts.
I hope it's clear that I haven't post all this info to advertise the product, but to say that I'm really proud as a developer for the design & implementation of this font-matching engine.
Cheers
Fivos
PS: Implementation environment/language: Qt/C++ on Windows/Mac OS/CentOS.
精彩评论