如何将 16 位 RGB 帧缓冲区转换为可视格式?
我正在设备上使用其他人的代码,该设备可以将图像放入 /dev/fb/0
并显示在视频输出上或通过网络将其发送到客户端应用程序。
我无法访问客户端应用程序的旧源,但我知道以下有关数据的信息:
- 720x480
- 16 位
- RGB(我不确定它是 5,5,5 还是 5,6,5)
- RAW (没有任何标题)
cat
-能够/dev/fb/0
- 675kb
我怎样才能给它一个标题或将其转换为 JPEG、BMP 或 RAW 类型然后我可以在桌面应用程序中查看吗?
最终,我希望它是 jpeg 格式并且可以在浏览器中查看,但目前我可以用眼睛看到的任何内容都可以。
成功
(见下面的评论)
ffmpeg \
-vcodec rawvideo \
-f rawvideo \
-pix_fmt rgb565 \
-s 720x480 \
-i in-buffer.raw \
\
-f image2 \
-vcodec mjpeg \
out-buffer.jpg
- github.com/coolaj86/image-examples
- image-examples/scripts/rgbtools-torgb
- image-examples/scripts/rgbtools-fromrgb
尝试失败 将
图像横向显示三倍几乎没有颜色,垂直挤压:
rawtoppm -rgb -interpixel 720 480 fb.raw > fb.ppm
显示图像,但有条纹,垂直挤压且颜色不好:
rawtoppm -rgb -interrow 720 480 fb.raw > fb.ppm
与上面类似
convert -depth 16 -size 720x480 frame_buffer.rgb fb.jpeg
I'm working with someone else's code on a device which can put an image to /dev/fb/0
and show up on video out or send it over the network to a client application.
I don't have access to the old source for the client app, but I know the following about the data:
- 720x480
- 16-bit
- RGB (I'm no sure if it's 5,5,5 or 5,6,5)
- RAW (no headers whatsoever)
cat
-able to/dev/fb/0
- 675kb
How can I give this a header or convert it to JPEG, BMP, or a RAW type that I could then view in a desktop application?
Ultimately, I want it to be jpeg and viewable in a browser, but anything I can see with my eyes will work for now.
Success
(see the comments below)
ffmpeg \
-vcodec rawvideo \
-f rawvideo \
-pix_fmt rgb565 \
-s 720x480 \
-i in-buffer.raw \
\
-f image2 \
-vcodec mjpeg \
out-buffer.jpg
- github.com/coolaj86/image-examples
- image-examples/scripts/rgbtools-torgb
- image-examples/scripts/rgbtools-fromrgb
Failed Attempts
Shows the image three times widthwise with almost no color, and squashed vertically:
rawtoppm -rgb -interpixel 720 480 fb.raw > fb.ppm
Shows the image, but with streaks and squashed vertically and bad color:
rawtoppm -rgb -interrow 720 480 fb.raw > fb.ppm
Similar to the above
convert -depth 16 -size 720x480 frame_buffer.rgb fb.jpeg
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RGB 到 ppm:只需调味即可!
维护于 https://github.com/coolaj86/image-examples
rgb to ppm: Just season to taste!
maintained at https://github.com/coolaj86/image-examples
我正在开发一个具有 5:6:5 RGB 格式的嵌入式系统,有时我需要捕获原始帧缓冲区数据并将其转换为可视图像。为了进行实验,我编写了一些 C 代码将原始二进制值转换为 链接文本。该格式很愚蠢,但很容易阅读 - 因此我发现它很方便进行黑客攻击。然后我使用 Imagemagick display 查看并convert 转换为 JPG。 (如果我没记错的话,convert 将接受原始二进制图像 - 但这假设您知道所有图像参数,即 5:6:5 与 5:5:5)。
如果需要,我可以发布示例 C 代码以将 5:6:5 转换为 8:8:8 RGB。
I'm developing an embedded system with a 5:6:5 RGB format, and on occasion I've needed to capture raw framebuffer data and convert it to a viewable image. For experimentation, I wrote a bit of C code to convert the raw binary values to link text. The format is dumb, but easily readable - thus I found it convenient for hacking about. I then used Imagemagick display to view and convert to convert to JPG. (If I recall correctly, convert will accept raw binary images - but that assumes you know all the image parameters, i.e. 5:6:5 versus 5:5:5).
I can post sample C code to convert 5:6:5 to 8:8:8 RGB if needed.