问题描述
我正在尝试获取每90°破裂的图像的OCR,但将旋转后的图像分配给数组并不能像我旋转前一样识别文本,有人知道如果该图像的某些属性会发生什么情况图片还是因为信息丢失?我添加了代码。
using (var engine = new TesseractEngine(path + "\\tessdata","eng",EngineMode.Default))
{
//using (var img = Pix.LoadTiffFromMemory(buffer))
using (var img = Pix.LoadFromMemory(buffer))
{
Utils.PixToBitConverter pixToBit = new Utils.PixToBitConverter();
Bitmap bmp = pixToBit.Convert(img,true);
Grayscale filter = new Grayscale(0.2125,0.7154,0.0721);
Bitmap grayImage = filter.Apply(bmp);
Threshold filterBin = new Threshold(100);
filterBin.ApplyInPlace(grayImage);
for (int i = 0; i < 4; i++)
{
switch (i)
{
case 0:
arrayImage[i] = grayImage;
break;
case 1:
grayImage.RotateFlip(RotateFlipType.Rotate90FlipNone);
arrayImage[i] = grayImage;
break;
case 2:
grayImage.RotateFlip(RotateFlipType.Rotate180FlipNone);
arrayImage[i] = grayImage;
break;
case 3:
grayImage.RotateFlip(RotateFlipType.Rotate270FlipNone);
arrayImage[i] = grayImage;
break;
}
}
int k = 0;
for (k= 0; k < 4; k++)
{
using (var page = engine.Process(arrayImage[k]))
{
text = page.GetText();
text = text.ToLower();
}
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)