4

I'm currently working in a project where noise removal in document image is required. But i cant create any useful code to start my project. thanks.

According to what I've studied, noise (specifically salt/pepper noise) that produce in faulty scanner can be removed by k-Fill algorithm, but i can't understand that theory.

I'm using OpenCV in C++ , and Codeblocks IDE. I'm new in the world of image processing. Source code or any related link/s are appreciated.

kcire arraveug
  • 213
  • 1
  • 6
  • 13

3 Answers3

3

If you do not understand k-fill try to use a simpler approach first.

Here is an article of alternative noise reduction algorithms with their performances.

I would suggest you to take a try with opening. The OpenCV documentation has a short explanation on built-in morphological operations. You can make experiments with the example code as well.

rics
  • 5,494
  • 5
  • 33
  • 42
  • Thanks for the info. I think i'll have to study those morphology functions in OpenCV. Maybe they can help me a lot. – kcire arraveug Dec 29 '11 at 12:05
  • Sir, I've tried that opening and also closing morphology but it can only remove salt and pepper noise. It failed when I've tried it with photocopied image that contains marginal noise. Can you suggest other techniques? – kcire arraveug Dec 29 '11 at 14:11
  • You can play with the size and the form of the structuring element and the number of iterations in which the morphological operator is used. You may also try the median filter what Kos suggested. – rics Dec 29 '11 at 16:51
0

K-filter, isnt that hard to understand. Take a small area (ea 3x3 pixels or 5x5 pixels or so). Now count the 'enabled' (ea dark) pixels on the border. If total count is greater then n, fill central pixel(s) (which is a single pixel on (3x3 grid). and repeat this on the whole image. Or delete it, if total border is lower then n

Peter
  • 2,043
  • 1
  • 21
  • 45
0

I do not know how effective k-fill can be; But,

I explain this; it might be useful for someone else: I will give an example with Python but CPlusPlus and Java should be similar (I do not know) One way to reduce noise is the medianFilter algorithm, which definitely reduces image quality. How much this quality decreases depends on the ksize parameter. You must select a small number for this parameter (for example 3); This makes the quality not too low. Eliminates very small noise.

import cv2
im = cv2.imread("noisy_flower.png")
im = cv2.medianBlur(im, ksize=5)
cv2.imwrite("clean_flower.png", im)

enter image description here

This mode is applicable to images. For the text inside a photo, you may be able to create a mask and copy the text back to the final image according to the mask. It depends a lot on your case.


Java Version:

Imgproc.medianBlur(src, dst, 5);
Shamshirsaz.Navid
  • 2,224
  • 3
  • 22
  • 36