[好吧,我同意我在图像处理和OCR方面是菜鸟。我有色卡,必须将其传递给tesseract OCR。我在以下[这里]找到了线程。
(we are doing pan OCR, using tesseract but is not able to detect the details like name and pan number)。我了解我可能必须执行以下步骤。
当我将彩色图像转换为灰度图像并将灰度图像转换为阈值时,我的灰度图像变为全黑。我玩弄参数,但没有得到任何积极的结果。 有人可以帮我吗?
我想知道是否需要将彩色图像转换为灰度然后转换为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);
任何帮助将不胜感激。
我总是更喜欢使用Cvinvoke方法,而不是使用Image类中的阈值函数。您可以阅读下面的文档,但是可以使用以下代码根据自己的喜好进行调整。但是,请确保图像仍为灰度。
CvInvoke.Threshold(img, output, 20, 50, ThresholdType.Binary);
http://www.emgu.com/wiki/files/3.0.0/document/html/54f2f6fb-b6dc-b974-16f4-f6b4bbb578d8.htm
如果它仍然看起来很黑,请尝试对阈值图像进行放大。尽管整个算法都不需要使用此方法,但是它可以帮助您可视化问题所在。
http://www.emgu.com/wiki/files/3.2.0/document/html/25f5c3ea-ed93-fcbd-20b7-b046874f8fbe.htm