Shearlab.jl icon indicating copy to clipboard operation
Shearlab.jl copied to clipboard

Edge effects for non-periodic data

Open dsweber2 opened this issue 5 years ago • 0 comments

Turns out when I use the shearlet transform on functions which are non-periodic, I get edges showing up where they shouldn't be. This also happens in the Matlab version; I haven't had time to check either pyshearlab, bendlab, or PPFT. A pretty clear example:

using Shearlab, Plots
pyplot()
X = zeros(500,500)
X[200:300,250:500] = 1
heatmap(X)
system = Shearlab.SLgetShearletSystem2D(size(X)...,3)
sheared = Shearlab.SLsheardec2D(X,system)
heatmap(abs(sheared[:,:,2]))

data: edgeeffectsdata Second Shearlet: edgeeffects The problem is on the outsides of the transformed result: there's no edge there to detect (especially on the left), but because the fft interprets the signal as periodic, we get a jump from one side to the other.

There are certainly ways to address the issue. User-side, one could just mirror the data over both axes; however, this has run into memory problems for me. Since the Shearlet transform is implemented using a fft, I suspect that there's a way to adjust the creation of the coefficients to use the dct, which is equivalent to the mirroring, without the increase in memory usage.

dsweber2 avatar Sep 20 '18 22:09 dsweber2