open .raw image data using python

后端 未结 1 479
温柔的废话
温柔的废话 2021-02-14 02:45

I have been searching google for the method to display a raw image data using python libraries but couldn\'t find any proper solution. The data is taken from a camera module and

相关标签:
1条回答
  • 2021-02-14 03:13

    Have a look at rawpy:

    import rawpy
    import imageio
    
    path = 'image.raw'
    raw = rawpy.imread(path)
    rgb = raw.postprocess()
    imageio.imsave('default.tiff', rgb)
    

    rgb is just an RGB numpy array, so you can use any library (not just imageio) to save it to disk.

    If you want to access the unprocessed Bayer data, then do:

    bayer = raw.raw_image
    

    See also the API docs.

    0 讨论(0)
提交回复
热议问题