Example of wavelet analysis of a surface

Dear all,

I would like to analysis images of surface with variable roughness in space. In practice, I would like to quantify the roughness of signals and report it on 2D maps (in the original spatial coordinates). It seems that a discrete wavelet analysis could be the ideal tool for this. If I understand well, I could report the spatial distribution of energy for different frequencies… (I am a newbie on that topic)

Does anyone know an example that does such type of analysis using Julia-based tools?
It looks like it could be done with Wavelets.jl but I failed at finding a detailed example/tutorial.

Here’s an example of a synthetic signal that may be relevant. I would expect that a wavelet analysis will be able to detect energy in high frequency range in the upper right region. And energy at low frequency in the lower-left region.

Is Wavelets.jl the appropriate tool to carry out such analysis? Is there a tutorial that I could use to get started with this?
(If not I’d be happy to progress on this example and then contribute to the docs)

    # Synthetic signal
    nx, ny = 128, 150  
    x = LinRange(0, 1.0, nx)
    y = LinRange(0, 1.0, ny)

    # Create a low frequency part in the the upper-right region
    k         = (5., 10)     # Wavenumbers
    shift     = (0.75, 0.75) # Shift
    gauss     = @. exp(-((x .- shift[1]).^2 + (y' .- shift[2]).^2) / 0.1)  # Gaussian function for varying energy
    signal_HR = @. gauss * (sin(2π * k[1] * x) + cos(2π * k[2] * y'))

    # Create a low frequency part in the the lower-left region
    k         = (2., 2)      # Wavenumbers
    shift     = (0.25, 0.25) # Shift
    gauss     = @. exp(-((x .- shift[1]).^2 + (y' .- shift[2]).^2) / 0.1)  # Gaussian function for varying energy
    signal_LR = @. gauss * (sin(2π * k[1] * x) + cos(2π * k[2] * y'))

    # Total signal
    signal = signal_LR .+ signal_HR

edit: added the image corresponding to the test signal below

This quick guide to surface roughness measurements is quite clear and defines roughness profiles using wavenumber cutoffs. Is it applicable?

Thanks, it’s indeed a useful resource, I didn’t know the distinction between roughness and waviness.
I would still like to analyse the data maps using 2D wavelet analysis. I have tried GPT and Claude but none of them seem to know how to operate Wavelets.jl :smiley:

Another common method to analyse roughness is variogram analysis. You could compute the DirectionalVariogram along directions (1, 0) and (0, 1) and then derive properties from the resulting curves.

I explain the concept in this video:

The “behavior near the origin” is what you are after.

1 Like