[Python] Channel extraction and interpolation from sparse color image arrays

Discussão em 'Python' iniciado por Stack, Março 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have a 'sparse colour' camera (KAI-4070 chip) which gives images with clear, red, green, and blue filtered pixels arranged in a 4x4 grid (kind of a generalized Bayer matrix)

    G C R C
    C G C R
    B C G C
    C B C G


    I need to extract the 4 'colour' channels to individual images and then interpolate back to 2048x2048px. I am working in Python.

    I tried numpy reshaping the array to 3D 4x4x256K so that each line through the 3rd dimension is all pixels of the same filter. For each filter I would then set the other filter pixels to NaN and reshape back to 2K x 2K (with many NaN pixels) then interpolate to fill in the gaps. I haven't been able to get reshape to do that - the third dimension always has varying filters. Is this possible with reshape or is there something better.

    If this is not a viable approach I would appreciate suggestions. I might brute force it with nested loops but with ~300 images per night times 4M pixels it would be too slow.

    Continue reading...

Compartilhe esta Página