schoolpost / PiDNG

Create Adobe DNG RAW files using Python. Works with any Bayer RAW Data including native support for Raspberry Pi cameras.
MIT License
199 stars 37 forks source link

Fix that gets raw2dng.py working again. #74

Open mcnalu opened 1 year ago

mcnalu commented 1 year ago

Fix that gets raw2dng.py working again by supporting fmt in init of camdefs.py.

osexpert commented 2 weeks ago

I tried your changes in 4.0.9 but got another error instead: Before:

    width, height = self.model.fmt.get("size", (0,0))
AttributeError: 'RaspberryPiHqCamera' object has no attribute 'fmt'

After:

    self.fmt['size']=(width,height)
TypeError: list indices must be integers or slices, not str
mcnalu commented 2 weeks ago

It looks like you've supplied fmt as a list but it should be a dict. Here's an example that works on 4.0.9 for me:

    fmt={}
    fmt['format']='SRGGB12_CSI2P'
    fmt['stride']=3072

    # choose a predefined camera model, set the sensor mode and bayer layout. 
    # this camera model class sets the appropriate DNG's tags needed based on the camera sensor. ( needed for bit unpacking, color matrices )
    #3 is 4056 by 3040, 12bpp
    #2 is 2028 by 1520, 12bpp, no crop so 2x2 bin I think
    camera = RaspberryPiHqCamera(2, fmt, CFAPattern.BGGR)