buzz2050 Posted November 3, 2008 Share Posted November 3, 2008 Hi All, I have been assigned a project to develop a "font recognition application" using PHP. It goes something like this:- The user uploads an image file containing some text. The application is required to identify the text and the font used there. Below are links to 2 great applications which I would like to derive from:- http://www.myfonts.com/WhatTheFont/ http://www.imagaro.com/m2.html So far what I understand is, I'll need to have the font names along with their features to be stored in a database, then I'll need to analyze the image, pick up the characters from it, identify their typographical features and run a match on the database to get the top matching fonts. However right now I haven't got a clue as to how I go about the implementation of the above logic or whether there's some other approach. Need to start right from a scratch, any inputs/suggestions are greatly appreciated. Thanks in advance . Quote Link to comment Share on other sites More sharing options...
htzone Posted November 3, 2008 Share Posted November 3, 2008 You might want to try and track down some OCR (optical character recognition) code from somewhere for the image analysis. I doubt something like that will be able to give you detailed info about the characteristics of the font itself, but it would (in most cases) allow you to identify specific characters. I suspect you'll have to write code for recognizing font features yourself, or find some type of image comparison tool that you can adapt. Quote Link to comment Share on other sites More sharing options...
buzz2050 Posted November 4, 2008 Author Share Posted November 4, 2008 Hi, Thanks for replying. I have been told to use 'pattern recognition', 'font recognition' algorithms and the like. I also downloaded a small phpOCR class from net, but its very minimal compared to my requirement. I would ideally like to delve deeper into the subject and understand the nitigrities and probably come up with my own code. Lets see, but thanks a lot for your suggestion though. Quote Link to comment Share on other sites More sharing options...
GKWelding Posted November 4, 2008 Share Posted November 4, 2008 Look up Content Based Image Recognition... Here may be a good start... http://www.searchlores.org/finn_cbir_1.htm Quote Link to comment Share on other sites More sharing options...
GKWelding Posted November 5, 2008 Share Posted November 5, 2008 Basically, what I think you're going to have to do here is merge a typical OCR script with some CBIR techniques. If you can isolate the characters in the image, use the CBIR techniques to give it some kind of numerical 'reference' then compare that to a database of index references for known font types. The difficult bit will be obtaining only 1 character from the image at a time, the rest of it is fairly easy though. Quote Link to comment Share on other sites More sharing options...
GKWelding Posted November 5, 2008 Share Posted November 5, 2008 I have also just had another thought regarding this. You could recolour the font images in your version of the database bright green, then recolour all font samples sent to your script black. You could then overlay the font sample sent to your script over the top of the sample in your database, get your script to count the number of green pixels. Then do the reverse, overlay the database sample with the one submitted to the script, get the code to count the number of black pixels. If both comparrisons are close (low number of detected pixels) then you have a match for your font... If one is very close and the other is miles out, or both are miles out then you don't have a match... Quote Link to comment Share on other sites More sharing options...
Psycho Posted November 5, 2008 Share Posted November 5, 2008 Here is an existing PHP OCR class that may be a good starting point for you. http://www.phpclasses.org/browse/package/2874.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.