android - 图像处理 : Removing noise of processed image OPENCV - JAVA

标签 android opencv

我已经为 OCR 处理了一张图像,我遇到了一个问题,即处理后的图像有太多噪点。我是此类编程的初学者,我只是想知道你们是否可以帮助我对其进行降噪?

这是我目前的代码

File newFile = new File(mFile);

        orig = Imgcodecs.imread(newFile.getAbsolutePath(),Imgcodecs.CV_LOAD_IMAGE_GRAYSCALE);
        Mat small = new Mat();
        Imgproc.pyrDown(orig,small);
        final Size kernelSize = new Size(3, 3);
        final Point anchor = new Point(-1, -1);
        final int iterations = 3;

        Mat kernel = Imgproc.getStructuringElement(Imgproc.MORPH_ELLIPSE, kernelSize);

        Imgproc.GaussianBlur(small,small, new Size(3,3),0);
        Imgproc.erode(small, small,kernel,anchor,iterations);
        Imgproc.dilate(small,small,kernel);

        Imgproc.adaptiveThreshold(small,small,255,Imgproc.ADAPTIVE_THRESH_GAUSSIAN_C,Imgproc.THRESH_BINARY,45,2);

        Mat kernel2 = Imgproc.getGaussianKernel(6,2);

        Imgproc.dilate(small,small,kernel2);
        Imgproc.erode(small,small,kernel);

        Bitmap bm = Bitmap.createBitmap(small.cols(), small.rows(),Bitmap.Config.ARGB_8888);
        Utils.matToBitmap(small, bm);

这里是输出

示例 1

enter image description here

示例 2

enter image description here

最佳答案

你为什么不试试 fastNlMeansDenoising方法?

而且我认为 GaussianBlur 也是一种很好的去噪方法。(在你的代码之后)

enter image description here enter image description here

关于android - 图像处理 : Removing noise of processed image OPENCV - JAVA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52049507/

相关文章:

Android sqlite fts3匹配和比较整数/ float

java - Android Studio - 为什么 WebView 不加载 Web URL

python - 如何在两个连续的视频帧中跟踪轮辐?

python - 如何使用python和openCV制作热图

android - 多密度设备上的 Phonegap

java - 在android中打开SQLite数据库文件

android - 为什么 Alarm Manager 仅在 30 分钟内更新?

opencv - 如何找到形状边界的直线近似值?

android - Android 版 OpenCV 中的不兼容垫

python - 将图像从 opencv 上传到 s3 存储桶