You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to follow this image preprocessing block using pywt but I cannot do CLAHE on the coefficients such as LL, and thresholding on the other three.
import pywt
import pywt.data
# Wavelet transform of image, and plot approximation and details
titles = ['Approximation', ' Horizontal detail',
'Vertical detail', 'Diagonal detail']
coeffs2 = pywt.dwt2(original, 'bior1.3')
LL, (LH, HL, HH) = coeffs2
fig = plt.figure(figsize=(12, 3))
for i, a in enumerate([LL, LH, HL, HH]):
ax = fig.add_subplot(1, 4, i + 1)
ax.imshow(a, interpolation="nearest", cmap=plt.cm.gray)
ax.set_title(titles[i], fontsize=10)
ax.set_xticks([])
ax.set_yticks([])
fig.tight_layout()
plt.show()
How do you apply CLAHE for LL and thresholding for LH, HL, HH and reconstruct the wavelets?
The text was updated successfully, but these errors were encountered:
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
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?The text was updated successfully, but these errors were encountered: