Open sarmientoj24 opened 2 years ago
Hi @sarmientoj24, here are some ideas:
For CLAHE, I would install scikit-image and then use skimage.exposure.equalize_adapthist.
For BayesShrink
there is an implementation in skimage.restoration.denoise_wavelet that is based on PyWavelets. The denoise_wavelet
source code is likely a good starting point for your implementation. It currently is nD as oppopsed to 2D specific, so you will see pywt.wavedecn
and pywt.waverecn
used instead of their 2D counterparts.
The default for that function is method='BayesShrink'
, however it does NOT apply CLAHE to the approximation coefficients (it thresholds the detail coefficients, but also does not apply whatever the "linear enhancement" in the diagram above is). By default it uses a multilevel decomposition (i.e. using pywt.wavedecn
instead of pywt.dwt2
), but you could set wavelet_levels=1
to force this to be only a single level as in the diagram above.
Thank you @grlee77 Yeah I can do CLAHE actually. But then, when I reconstruct it, it's just some garbage image that is remaining. I guess it's because the values are now changed.
My question is more of a pseudocode or instruction how to do the pywt deconstruction -> clahe, then reconstruction.
I am trying to follow this image preprocessing block using![JMSS-5-59-g001](https://user-images.githubusercontent.com/8830319/159234375-a9e7932d-e6f4-4564-a7cd-6c2548ff71f5.jpg)
pywt
but I cannot do CLAHE on the coefficients such asLL
, and thresholding on the other three.How do you apply CLAHE for
LL
and thresholding forLH, HL, HH
and reconstruct the wavelets?