Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 1117

JAVA - Removing noise of processed image OPENCV

$
0
0
I have process an image for OCR, I encountered a problem where the processed image has too much noise. I am a beginner in this type of programming and Im just wondering if you guys can help me denoise it? Here's the code I have so far 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); **Sample Output** ![image description](/upfiles/15355067504591669.png)

Viewing all articles
Browse latest Browse all 1117

Latest Images

Trending Articles



Latest Images