【发布时间】:2020-06-15 20:26:04
【问题描述】:
好的,我同意我是图像处理和 OCR 方面的菜鸟。我有我必须传递给 tesseract OCR 的彩色 Pan 卡。我在 [这里] 找到了以下线程。
(we are doing pan OCR, using tesseract but is not able to detect the details like name and pan number)。我知道我可能需要执行以下步骤。
- 转换为灰色
- 阈值
- 查找轮廓
- boundingRect
当我将彩色图像转换为灰度图像并将灰度图像转换为阈值时,我的灰度图像会变成完全黑色。 我玩弄了参数,但没有得到任何积极的结果。 那么有人可以帮我解决吗?
另一件事我想知道是否需要将彩色图像转换为灰度然后转换为 OCR 的阈值?或者我可以直接将彩色图像转换为阈值?
我忘了提到我正在使用 emguCV、Tesseract 和 Csharp。
我已经发布了上面的图片和下面的代码。
Image<Bgr, byte> imgInput; = new Image<Bgr, byte>(impath);
Image<Gray, Byte> img2 = imgInput.Convert<Gray, Byte>();
Image<Gray, byte> imgout = imgInput.Convert<Gray, byte>().Not().ThresholdBinary(new Gray(50), new Gray(125));
VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint();
var blurredImage = imgout.SmoothGaussian(5, 5, 0, 0);
CvInvoke.AdaptiveThreshold(imgout, imgout, 255, Emgu.CV.CvEnum.AdaptiveThresholdType.GaussianC, Emgu.CV.CvEnum.ThresholdType.Binary, 5, 45);
我们将不胜感激。
【问题讨论】:
-
你能发布一些示例图像和代码吗?
-
已更新。
标签: c# .net ocr tesseract emgucv