Skip to content

How to extract bayer pattern #179

@thomaskleiven

Description

@thomaskleiven

Is it possible to split the raw data up into its red, green, and blue components before demosaicing?

It seems like that raw data is available using raw_image (docs)

file_path = 'sample1.dng'
with rawpy.imread(file_path) as raw:
    img = raw.raw_image   

    print(img[0,0]) ## Prints 158

Provided that the sensor data is on the format RGGB, then img[0,0] would correspond to the first red pixel of the sensor data.


Goal: Extract the value of the first red pixel

Method 1)
Using rawpy, the value of img[0,0] is 158.

Method 2)
Using RawTherapee (docs) to read the same image, it suggests that the first red pixel (before demosaicing) is 57 as seen below.

rawtherapee_sample

Example RAW image: sample1.dng found (here: google drive)

I'm probably missing some basic logic here, but is it possible to obtain the same value using rawpy? Thanks in advance for any pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions