RGB565 1D阵列到3D RGB图像

发布于 2025-02-07 03:32:07 字数 312 浏览 3 评论 0原文

我有一个1D RGB565阵列,该数组从相机中获得,并希望将其转换为3D RGB图像。

因此,图像具有QVGA分辨率(320x240)和RGB565格式,从而导致153600字节阵列。

有没有快速的方法将其转换为图像,最好是使用PIL?

谢谢

I have a 1D RGB565 array that I get from a camera and would like to convert it to a 3D RGB image.

So the image has QVGA resolution (320x240) and with the RGB565 format that results to a 153600 byte array.

enter image description here

Is there a quick way to convert that to an image, preferably with PIL?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

迷迭香的记忆 2025-02-14 03:32:07

this 解决我的问题

,这里是 我的问题代码:

length = 76800 # 320*240
one = [46888] * length # this would be the list of 76800 16bit RGB565 values
xdim = 320
ydim = 240
im = Image.new("RGB",(xdim,ydim))
for y in range(ydim):
   for x in range(xdim):
      px = one[i]
      i = i+1
      im.putpixel((x,y),((px&0xF800) >> 8, (px&0x07E0) >> 3, (px&0x001F) << 3))

this solves my problem

And here's the code:

length = 76800 # 320*240
one = [46888] * length # this would be the list of 76800 16bit RGB565 values
xdim = 320
ydim = 240
im = Image.new("RGB",(xdim,ydim))
for y in range(ydim):
   for x in range(xdim):
      px = one[i]
      i = i+1
      im.putpixel((x,y),((px&0xF800) >> 8, (px&0x07E0) >> 3, (px&0x001F) << 3))
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文