Search code examples
pythonopencvscikit-imagesobel

Filtering out faint sobel filter lines?


I'm using skimage to creator a sobel filter image similar to this... enter image description here

I was wondering is there a way to sharpen this sobel filter image? To say, remove the white lines that are more faint like for example the faint lines behind the air balloons?

I used Skimage to do this, but I can get access to other things like OpenCV.

My code specifically is...

from skimage.filters import sobel
elevation_map = sobel(img)
plt.imshow(elevation_map, cmap=plt.get_cmap('gray'))

Solution

  • Maybe a bit late but the simplest way to remove faint pixels is to apply a threshold to the image.

    It can be done like this (with a threshold of 50 for instance) elevation_map[elevation_map < 50] = 0 You can adjust the threshold to get more of less dark gray pixels set to 0.