Image Denoising with Better Edge Preservation I have the input image :



and the output of vein detection for the leaf using a Gabor filter, but the output is really noisy:



I tried using Total variation denoising however the results are not good:



However I don't want to loose the fine details in the leaf's veins, so a median filter won't suit my problem
Sounds like you want to denoise and preserve edges. Have you considered nonlocal means? There's some GPL'd C++ code along with a brief writeup of the algorithm by the original authors here: http://www.ipol.im/pub/algo/bcm_non_local_means_denoising/

One caveat, nonlocal means is very slow and the output can be sensitive to the implementation you have. You may also consider ROF minimzation as it's fast and does a good job of preserving edges. Here's some matlab code that does it: http://www.stanford.edu/~tagoldst/Tom_Goldstein/Split_Bregman.html