Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default .bin image format of CAM utility is not documented. #65

Open
fishrockz opened this issue Jan 22, 2023 · 1 comment
Open

Default .bin image format of CAM utility is not documented. #65

fishrockz opened this issue Jan 22, 2023 · 1 comment

Comments

@fishrockz
Copy link

The readme points to using the cam util for basic testing of if the lib is working https://github.com/kbingham/libcamera/tree/master#basic-testing-with-cam-utility

By following this i can create the following frame-cam0-stream0-000007.bin it seems to do something sensible

[will@localhost ROOT]$ ls frame-cam0-stream0-000007.bin -lh
-rw-r--r--. 1 root root 704K Jan  1  1970 frame-cam0-stream0-000007.bin
[will@localhost ROOT]$ file frame-cam0-stream0-000007.bin 
frame-cam0-stream0-000007.bin: International EBCDIC text, with very long lines (65536), with no line terminators

It looks like a fairly standard binary file, however i am at a loss as to how to view it as a image, i am quite happy to load it manually into something ie write a bit of code to load it but I don't know what format to use to being interpreting the bits.

I even tried to look at the first few lines as ASCII to see if it had a human readable header but no luck.

Any hints appreciated :D

I was wondering if this is just what ever the underlying camera spits out, if that is the case is there a way to find that out with cam and some option?

looking at stderr i get

[0:02:32.266143692] [380]  INFO Camera camera_manager.cpp:299 libcamera v0.0.3
[0:02:32.322247858] [381]  WARN RPI raspberrypi.cpp:1270 Mismatch between Unicam and CamHelper for embedded data usage!
[0:02:32.325754941] [381]  INFO RPI raspberrypi.cpp:1387 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media3 and ISP device /dev/media2
[0:02:32.328819837] [380]  INFO Camera camera.cpp:1026 configuring streams: (0) 800x600-NV12
[0:02:32.330040931] [381]  INFO RPI raspberrypi.cpp:767 Sensor: /base/soc/i2c0mux/i2c@1/imx219@10 - Selected sensor format: 1640x1232-SBGGR10_1X10 - Selected unicam format: 1640x1232-pBAA

I presume 1640x1232-pBAA should tell me the format but i have not found a description for it?

https://www.linuxtv.org/downloads/v4l-dvb-apis-old/pixfmt-srggb10p.html

I presume the one i am after is V4L2_PIX_FMT_SBGGR10P

I will see if i can fine a way to open this cv2 looks like the best bet for now but does anyone have the answer already or make some suggestions as to add to the README to help future travels of my road lol

@kbingham
Copy link
Owner

There is no header. The format isn't defined either. It's simply the pure data exactly as captured for the stream.

So if the image stream is configured as NV12 - then this is NV12 data. If it was configured as MJPEG, it would be mjpeg encoded. If you save the RAW Bayer stream (V4L2_PIX_FMT_SBGGR10P) - then it would be that data.
You can use a tool such as raw2rgbpnm (https://git.retiisi.eu/?p=~sailus/raw2rgbpnm.git;a=summary) to decode the images into pnm, which could then be converted to png or otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants