Main Content


Combine planar sensor images into full Bayer pattern CFA



    cfa = planar2raw(I) combines the individual sensor element images, stored as channels of the input image I, into a complete Bayer pattern Color Filter Array (CFA) image, cfa.


    collapse all

    Read RAW image data into the workspace.

    cfa = rawread("colorCheckerTestImage.NEF");

    Create an image with individual channels for each sensor in the CFA image.

    rggb = raw2planar(cfa);

    Convert the image with separate channels for each sensor into a complete CFA image.

    cfaFull = planar2raw(rggb);

    Input Arguments

    collapse all

    Image with a channel for each sensor element, specified as an M-by-N-by-4 numeric array.

    Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

    Output Arguments

    collapse all

    CFA image, returned as a (2*M)-by-(2*N) numeric matrix of the same class as I.

    planar2raw constructs the CFA image by placing I(:,:,1) starting at cfa(1,1), placing I(:,:,2) starting at cfa(1,2), placing I(:,:,3) starting at cfa(2,1), and placing I(:,:,4) starting at cfa(2,2).

    Introduced in R2021a