python 图片 变清晰,如何使用OpenCV的处理图像,文字变得锐利和清晰?

本文介绍了如何使用OpenCV库来处理图像,使其变得更加清晰,以便进行OCR操作。通过尝试GaussianBlur、adaptiveThreshold以及medianBlur等方法,作者发现对于不同类型的图像,可能需要调整参数来达到最佳效果。最后,建议使用中值滤波和Otsu二值化阈值处理来改善图像质量。
摘要由CSDN通过智能技术生成

While searching for solutions, most of the answers were general instructions such as advise to look at adaptive filter, gaussian blur, dilation and erosion but none of them provide any sample code to start with (so can play around with the values)..

I know different image require different methods and values to achieve optimum clarity, but I just need some general filter so that the image at least slightly sharper and less noisy compare to the original, before doing any OCR on it.

this is what I've tried so far..

Mat imageMat = new Mat();

Utils.bitmapToMat(photo, imageMat);

Imgproc.cvtColor(imageMat, imageMat, Imgproc.COLOR_BGR2GRAY);

Imgproc.GaussianBlur(imageMat, imageMat, new Size(3, 3), 0);

Imgproc.adaptiveThreshold(imageMat, imageMat, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 5, 4);

but being an image

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值