read and display raw image using python

只愿长相守 提交于 2021-02-19 04:22:46

问题


I want to try view the image using spyder python as in:

skydrive share the image is:

  • uint16 (10-bit)
  • width:1376 pixel, height: 960 pixel
  • no header
  • bayer pattern blue-green, green-red

What python script is suitable?

Thanks.


回答1:


Here is one way.

Start with imports

from matplotlib import pyplot as plt
import numpy as np

Now allocate the space

image = np.empty((1376,960), np.uint16)

Read the image into your array:

image.data[:] = open('20_1-20ms.raw').read()

Display it:

plt.imshow(image)


来源:https://stackoverflow.com/questions/15069028/read-and-display-raw-image-using-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!