从tif图像中提取文本,其中文本为斜体 [英] Extract text from tif images in which text are in italic font
本文介绍了从tif图像中提取文本,其中文本为斜体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用下面的代码,这些代码适用于大多数图像,但是我有一些特殊类型的图像,它们具有斜体文本和tiff扩展名.在这种情况下,代码不起作用.
代码::
Hi,
I am using following code that is working for mostly images but i have some special kinds of images which have italic text and tiff extension. in that case code is not working.
Code::
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
string extractedText = string.Empty;
string getFileName;
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
getFileName = openFileDialog1.FileName;
Image targetImage = Image.FromFile(getFileName);
targetImage = fitInPBox(targetImage);
pBox.Image = targetImage;
}
}
//This function fit the browsed image in picture box
private Image fitInPBox(Image img)
{
Bitmap image = new Bitmap(img, new Size(pBox.Size.Width, pBox.Size.Height));
return (Image)image;
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Text = string.Empty;
MODI.Document doc = new MODI.Document();
doc.Create(getFileName);
doc.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true);
MODI.Image img = (MODI.Image)doc.Images[0];
MODI.Layout layout = img.Layout;
for (int i = 0; i < layout.Words.Count; i++)
{
MODI.Word word = (MODI.Word)layout.Words[i];
if (extractedText.Length > 0)
{
extractedText += " ";
}
extractedText += word.Text;
richTextBox1.Text = extractedText;
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
特殊图像URL
请帮帮我..
在此先感谢
[edit]添加了代码块,对代码进行了格式化,将链接转换为正确的链接-OriginalGriff [/edit]
Special Image URL
Please help me..
Thanks in advance
[edit]Code block added, code formatted, Link converted to a proper link - OriginalGriff[/edit]
推荐答案
您需要与提供OCR库和向他们寻求帮助,您可能会遇到该库的限制.
如果您不告诉我们您使用的是什么库,那么您当然就无法寻求帮助.
You need to talk to whoever provides your OCR library and ask them for help, you may be hitting a limit of that library.
You certainly can''t expect help if you don''t tell us what libraries you are using.
这篇关于从tif图像中提取文本,其中文本为斜体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文