使用 PHP 从图像中识别字体
我很好奇 - 如何从提供的图像中识别字体...
编辑:...使用 PHP?例如 - 用户上传一些文本的照片(假设来自报纸)并想知道使用了哪种字体或者哪种字体最相似。
I'm curious - how to recognize font from 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试这个在线工具:什么字体
try this online tool: What The Font
http://new.myfonts.com/WhatTheFont/
http://new.myfonts.com/WhatTheFont/
我认为他要求的是一个可公开使用的模式识别库。基本上是某种 OCR,它可以识别文本,并将图像中的文本与字体系列向量进行匹配。我说得对吗?
不幸的是,我必须说(据我所知)没有这样的库可用。不过有普通 OCR 功能。
http://www.aquaforest.com/en/ocrsdk.asp
一个识别问题图像的字体系列是许多字体系列具有相似的向量。这意味着像 Georgia 这样的字体很容易被误认为 Times New Roman 等。
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.
如果您手头没有扫描件,请尝试 http://www.identifont.com/。 (但不可否认,这并不能帮助你在 php 中做到这一点。)
If you have no scans handy, try http://www.identifont.com/. (But that's not helping you do it in php, admittedly.)
我正在寻找同样的东西,发现了这个 Whatfontis API 。它对我来说效果很好。你可以使用任何语言,输入和输出都是用json完成的
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
这显然是一个老问题,但我对我们的字体匹配引擎感到非常自豪,
所以请让我添加一些相关信息。
这不是一个公开可用的库或 SDK(至少目前还不是)
但它是嵌入在产品中的引擎:
http://www.findmyfont.com
它读取图像(或采取屏幕截图)并将您选择的字符与计算机的所有字体(无论是否安装)进行匹配。
匹配速度高达500万个字体/分钟,这意味着它可以在1-2秒内将5-6个字母的图像与100.000种字体进行匹配。
匹配精度主要取决于图像质量和匹配精度。分辨率(建议高度至少为 20 像素),并且还取决于所选字母形状的独特程度。
一般来说:如果您的计算机中确实有该字体并选择任何图像的 2-3 个字母,您将在前 5 个匹配项中找到实际字体 - 通常是顶部匹配项 - 对于多达 600.000 种字体来说都是如此文件。
我们现在正在进行新版本的 Beta 测试,该版本允许应用程序通过向在线服务器发送匹配请求来匹配您计算机上没有的字体。
我无法透露太多有关我们专有匹配算法的信息,但我可以这样说
:您不需要弄乱矢量字体的实际轮廓:渲染良好的字母位图足以成功提取特征。
b.如果要实现高性能匹配,则需要通过扫描所有字体的所有字母来创建并存储适当的索引。
我希望大家清楚,我发布所有这些信息并不是为了宣传该产品,
但要说的是,作为一名设计和开发人员,我真的很自豪。该字体匹配引擎的实现。
干杯
Fivos
PS:实现环境/语言:Windows/Mac OS/CentOS 上的 Qt/C++。
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.