Board: Nvidia Jetson Xavier NX
L4T version: 32.5.1
Hello, I have saved a raw image with the following command:
v4l2-ctl -d /dev/video2 --set-fmt-video=width=1920,height=1080,pixelformat=RG12 --stream-count=1 --stream-mmap --stream-to=dev2 --verbose
Here is the ouput:
--stream-to=dev2 --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
Width/Height : 1920/1080
Pixel Format : 'RG12'
Field : None
Bytes per Line : 3840
Size Image : 4147200
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Full Range)
Flags :
VIDIOC_REQBUFS: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_QUERYBUF: ok
VIDIOC_QBUF: ok
VIDIOC_STREAMON: ok
Index : 1
Type : Video Capture
Flags : mapped
Field : None
Sequence : 1
Length : 4147200
Bytesused: 4147200
Timestamp: 39203.709475s (Monotonic, End-of-Frame)
VIDIOC_STREAMOFF: ok
I also checked the format that v4l outputs like so:
$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'RG12'
Name : 12-bit Bayer RGRG/GBGB
Size: Discrete 1920x1080
Interval: Discrete 0.033s (30.000 fps)
And here is the beginning (lsb) of the first line (3840 bytes) of the raw image:
00000001 00010001
10000001 00010001
10000001 00010000
10000001 00010001 <- 16 bits word
10000001 00010000
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
00000001 00010001
Said file : dev1.raw (4.0 MB)
I thought that this format was only 12 bits, so I expected to see every 16 bits words to be padded by 4 zeroes, but as you can see some words are clearly 16 bits.
I saw the following answer : V4l2 returning 14-bit raw instead of 12-bit. What is going on? and it doesn’t help me because in this case they are 16 bits words.
Can you help me to understand what is going on here, so I can debayer the image ?
Thanks for your help!