[Python] Handling Variable Spatial Resolution When Generating a Wave Surface from a Camera...

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I’m working on a simulation that generates a randomized angle field representing ocean waves as seen by a camera pitched towards the horizon. Because of perspective projection, rows of pixels near the camera (bottom of the image) correspond to very small spatial patches on the surface, while rows near the horizon cover much larger patches.

    Currently, I am generating the wave's surface using a smooth noise field (e.g., Gaussian-filtered random slopes) that respects the smallest spatial resolution. And I divide the FOV in two to avoid having a slope array that is two big when addressing the horizon pixels.

    My array is generated using the following code:

    base_high_res_grid = gaussian_filter(
    np.random.normal(0, slope_std_deg / min_res, (grid_height, grid_width)),
    sigma=correlation_length / min_res)


    For any pixel within the FOV: I am then binning values from this array based on a computation of the distances (azimuth and elevation direction to x, y coordinates) to select the correct central array value and I use the local spatial resolution of this pixel projected on the surface to decide how many values of the array are binned per pixel.

    The issue I am encountering is that even while dividing in two the FOV I am still generating huge arrays resulting in very long computational time and because I am splitting the FOV in two there is a noticeable discontinuity in the wave shapes.

    Continue reading...

Compartilhe esta Página