JAVA - Removing noise of processed image OPENCV

asked 2018-08-28 20:40:07 -0500

brinx gravatar image

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();
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);


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


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

Sample Output

image description

edit retag flag offensive close merge delete


Do you have to read ALL the text on the card? However I'll do something like crop only the card shape from the image and do some processing on it like thresholding, bgr2hsv or inRange. It all depends on the card color and text color

m93c gravatar imagem93c ( 2018-09-14 02:32:20 -0500 )edit