# Remove white noise between white horizontal line

I currently have an image with white horizontal lines. between those lines, there is some noise that I would like to remove. I've already done Morphological Opening on the original image and the current one.

Does someone have an idea on how I could remove some of this noise between the lines?

original image:

Tom

edit retag close merge delete

If you have threshold. Then increasing value between 50 to 127. Then another one is dilate and erode.If you could post orignal image.

( 2019-02-20 08:46:52 -0500 )edit

The current image uses dilate en erode and it does work as you could see the noise isn't that bad between the lines, I'm wondering if there is a way so I could remove the remaining noise between the lines

( 2019-02-20 08:51:06 -0500 )edit

Sort by ยป oldest newest most voted

There are 2 steps. In cv.GaussianBlur, You can change odd number btween 15 to 21, but not even numbers to suit our needed. Step 1:

#!/usr/bin/env python3
#OpenCV 4.0.1
#Date: 20th April, 2019

import cv2 as cv
import numpy as np

img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
gray = cv.GaussianBlur(img, (19, 19), 0)
img = cv.bitwise_not(gray)

cv.waitKey(0)
cv.destroyAllWindows()


Output:

Step 2:

#!/usr/bin/env python3
#OpenCV 4.0.1
#Date: 20th April, 2019

import cv2 as cv
import numpy as np

img=cv.cvtColor(img, cv.COLOR_BGR2GRAY)
gray = cv.GaussianBlur(img, (19, 19), 0)

img = cv.bitwise_not(gray)
cv.waitKey(0)
cv.destroyAllWindows()


Output:

more

Well, that's an ugly image!

I suggest to clean up the original (RGB) image, it's much easier than the binary image.

Try also to improve the binarization (e.g. work on HSV or LAB color space, use several channels, combine the RGB channels) to get a cleaner result. If you post the original image, you could get better ideas.

If you must work with the binary image, a directional diffusion (Perona&Malik method, ~~not part of OpenCV~~ correction: see below) could be a solution.

[EDIT] I was wrong, Perona-Malik is part of the Extended image processing module: cv::ximgproc::anisotropicDiffusion

more

Thank you for your reaction. I've also add the original image right now. I've to make the edges between the items on the stack clearer so that the edge recognition is able to see them better

( 2019-02-20 08:59:46 -0500 )edit

Official site

GitHub

Wiki

Documentation