3

I've recently developed a new approach to detecting image edges. Everything seems to be normal except the noises! As you can see in the following image, there are many noises I'm not able to handle them properly. I used some bluring filters on the output, but the results were not as acceptable as those I expected. Moreover, since my digital number results generally range from 0.2e-8 to 0.5, thresholding methods, especially those of Python which only work on 8-bit images, have not been effective at all.

I would like to know your suggestions and comments on this denoising problem.

enter image description here

1
  • 1
    Is this a gis related question, or is this related to just using the python image processing packages like openCV and PIL?
    – TsvGis
    Commented Oct 11, 2015 at 22:38

1 Answer 1

5

I think you can do some thresholding if you stretch your histogram. In the example below, I streched it between percentile 2 and 98 and set a treshold at 250. It looks like a start.

import numpy as np
import matplotlib.pyplot as plt
from scipy import ndimage as ndi
from skimage import exposure

# rebuilding your image from capure
noisy = ndi.imread('img/Capture.PNG')
pan = (noisy.sum(axis = 2)/4).astype('uint8') # fast flatening to 1 band

# stretching it bektween p2 and p98
p2, p98 = np.percentile(pan, (2, 98))
pan_stretch = exposure.rescale_intensity(pan, in_range=(p2, p98))

# arbitrary threshold
threshold = 250

# plotting 

plt.subplot(2, 2, 1)
plt.imshow(pan, cmap='gray', interpolation='none')
plt.title('Original image')

plt.subplot(2,2,2)
plt.imshow(pan_stretch, cmap='gray', interpolation='none', vmin = threshold)
plt.title('Stetched image with Threshold at 250')

plt.subplot(2,2,3)
plt.hist(pan.ravel(), bins=256)

plt.subplot(2,2,4)
plt.hist(pan_stretch.ravel(), bins=256)
plt.axvline(threshold, color='r', linestyle='--', label='TRESHOLD')
plt.legend()
plt.show()

Results

If you also want to combine filters, you may have a look to scikit-image tools, maybe bilateral denoising skimage.restoration.denoise_bilateral which is an edge-preserving filter. See image denoising a picture

Not the answer you're looking for? Browse other questions tagged or ask your own question.