改善图像预处理 [英] Improve the image preprocessing

查看:75
本文介绍了改善图像预处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在进行OCR程序之前制作图像处理算法。



由于OCR失败。我需要进行预处理以获得更好的准确性。



我提供此处使用的示例代码以及输入和结果图像。



输入图片

结果图片



如果你仔细观察点缀区域就是问题。



你能告诉我如何优化图像处理吗?需要哪些程序来改善OCR输出?



我尝试过:



这是我的解决方案



I am trying to make image processing algorithm before proceeding to an OCR procedure.

Since the OCR fails. I needed to make a preprocessing in order to get better accuracy.

I am providing sample code used here and also the input and result image.

input image
result image

If you look close the dotted area is the problem.

Could you give me advise how to optimize the image processing? What kinds of procedures are needed to improve the OCR output?

What I have tried:

Here is my solution

Mat image = imread("address2.jpg");

Mat gray_image;
cvtColor(image, gray_image, CV_BGR2GRAY);

Mat bluredImage;
GaussianBlur(gray_image, bluredImage, Size(1, 1), 0);

Mat threshImage;
threshold(bluredImage, threshImage, 0, 255, THRESH_OTSU);

imwrite("result.jpg", asd);

推荐答案

看起来虚线区域从背面照射出来。一个解决方案可能是改变卡的照明 - 避免从背面照明。



如果你不能改变照明,我会尝试增加高斯模糊的大小约为该模式中距离点大小的两倍。您还必须使用动态阈值处理,即阈值应在图像上变化(您可以为此准备相应的蒙版和减法函数)。一般来说,你已经走在了正确的道路上。这只是一个相对困难的源图像。
It looks like the dotted area is shining through from backside. A solution could be to change the lighting of the card -- avoid lighting from the backside.

If you can't change the lighting, I would try to increase the size of the Gaussian blur to about twice the size of distance dot in that pattern. You will also have to use dynamic thresholding, i.e. the threshold value should vary across your image (you can prepare a corresponding mask and the subtract function for that). In general you are already on the right path. This is just a relatively difficult source image.


这篇关于改善图像预处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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