如何从图像和文字中读取文本将文字更新为图片? [英] How to read Text from Image & Update the text to Image?

查看:71
本文介绍了如何从图像和文字中读取文本将文字更新为图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在default.aspx中有一些图像,
某些图片的电话号码如
1-1234-22222.
现在,我想动态更改电话号码而又不影响
的质量 图片.

任何帮助将是感激之情,我们将不胜感激.


谢谢与问候,
Pawan

Hi,

I have a few images in default.aspx,
and some of the images are having phone numbers like
1-1234-22222.
now, I want to change the phone numbers dynamically without effecting the quality of
the image.

any help would be thankful and really appreciated.


Thanks & Regards,
Pawan

推荐答案

原则上不可能有完美的通用自动解决方案,因为您要处理的信息不足.背景图像的某些部分隐藏在数字图像的后面.您应该更改数字;然后您需要暴露背景图像中被数字隐藏的某些部分.您完全不知道应该在裸露区域中找到什么.

您所能做的就是根据背景图像的一般图案进行猜测并模仿缺失的信息.这个任务不能有一个通用的解决方案.可以有多种不同的解决方案,它们具有不同的主观质量"; 质量"这一概念本身并未定义,可以使用不同的标准进行估算,因此您对不影响图像质量"的要求完全没有严格意义.

您可以提出一个特殊的解决方案,但仅凭一个样本是不够的.您需要查看所有背景的可能情况.例如,使用以下操作可以还原参考图像中电话号码下方的红色背景:在电话号码的左侧(或右侧)复制一个小的矩形区域,并将其水平克隆以覆盖该号码占用的所有区域.您可以找到用于所有可能图像的完整集合的通用分母"算法,并自动识别电话号码的区域,但仅基于一般情况的精确且全面的描述图片.

—SA
There could not be perfect universal automatic solution to this problem in principle, as you''re dealing with insufficient information. Some part of your background image is hidden behind the images of the digits. You should change the digit; and then you need to expose some part of the background image which was hidden by the digit. What is supposed to be in the exposed area is completely unknown to you.

All you can do is to make a guesswork and mimic missing information based on general pattern of the background image. This task cannot have a general solution; there can be multiple different solutions of different "subjective quality"; the notion of "quality" itself is not defined and can be estimated using different criteria, so your requirement "without effecting the quality of the image" simply does not have strict sense.

You can suggest a special solution, but your single sample is not enough; one needs to see all possible cases of backgrounds. For example, the red background under the telephone number in the image you reference is restored using the following operation: copy a small rectangular area left (or right) of telephone number and clone it horizontally to cover all the area occupied by the number. You could find a "common denominator" algorithm for a complete set of all possible image and automatically recognize the area of the telephone number, but only based on precise and comprehensive description of a general case of the image.

—SA


如果您可以从图像中删除现有的电话号码,那么在这些图像上写新文本就没什么大不了的了.

您需要自动擦除吗?背景复杂吗?

给定图像,这是我可以添加的内容:

-检测文本需要良好的OCR功能( http://en.wikipedia.org/wiki/Optical_character_recognition [ ^ ]).您应该尝试使用具有多字体功能并接受彩色图像的商业软件包.获取文本字符串后,您将不得不进行分析以识别电话号码的结构.同时,您可以记录文本位置,颜色,字体和大小.

-删除文字更具挑战性.在给定的图片中,您可以通过在整个宽度上复制一列,用纯色或相同的红色渐变完全填充红色矩形.无法自动完成此操作,因为您需要识别出存在一个带有颜色渐变的矩形;因此,请参见图9.对于其他图像,您可能需要不同的解决方案.一种自动方法将需要最新的修补程序( http://en.wikipedia.org/wiki/Inpainting [^ ]).

这两个过程实施起来都很复杂,并且不会给出完美的结果(比如说95%的可靠性).对于您的情况,我建议使用一种半自动方法,对于每个样本,操作员将在要替换的电话号码周围拖动一个矩形.简单的背景重建可以通过复制水平或垂直边缘或在它们之间进行插值来实现.
If you can erase the existing phone numbers from the images, than it is no big deal to write new text over these images.

Do you need to erase automatically ? Is the background complex ?

Given the image, here is what I can add:

- detection of the text will require a good OCR function (http://en.wikipedia.org/wiki/Optical_character_recognition[^]). You should try a commercial package which has multi-font capability and accepts color images. After getting the text strings, you''ll have to analyze to recognize the structure of a phone number. At the same time, you can record the text location, color, font and size.

- erasing the text is more challenging. In the given picture you can wholly fill the red rectangle with solid color, or with the same red gradient by replicating one column over the full width. This cannot be done automatically because you need to recognize that there is a rectangle with a color gradient; and for other images, you may need different solutions. An automatic approach would require state-of-the-art inpainting (http://en.wikipedia.org/wiki/Inpainting[^]).

Both processes will be complex to implement and won''t give perfect results (say 95% reliability). In your case, I would recommend a semi-automatic approach where for every sample an operator would drag a rectangle around the phone number to be replaced. Simple background reconstruction would work by replicating the horizontal or vertical edges, or interpolating between them.


1-租用一个Photosoft家伙,可以渲染没有数字的图像副本!
2-使用任何图像编辑程序将所需的任何内容添加到图像.
3-不要忘记在步骤1中保留图像的副本:)

==>如果数字很大,或者您需要制作多份副本,我可以通过编写一个非常小的软件来帮助您,该软件可以帮助您生成数十亿张相同图像的副本,每个图像上都有不同的数字...

如果可以的话,我可以在此处附加解决方案:)
1- Rent a Photosoft guy that can render a copy of your images without Numbers!
2- Use any Image editing program to add any thing you like to the image.
3- Do not forget to keep a copy of the images in step #1 :)

==> if the numbers are verying or you need to produce several copies I can help you by writing a very small peice of software that helps you to generate billions of copies of the same image with different numbers on each ...

if so I can attach the solution here :)


这篇关于如何从图像和文字中读取文本将文字更新为图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆