Greyscaled MIPI camera

Hi, I’m trying to bring up a one lane MIPI camera that support 8- and 10-bit RAW format. I have patched the OV08a10 driver to successfully communicate with my camera and got it to output frame data.

The tools:
guvcview -d /dev/video0 -x 400x400
and
gst-launch-1.0 v4l2src name=vsrc device=/dev/video0 num-buffers=1 ! video/x-raw,width=400,height=400,framerate=5/1,format=GRAY8 ! filesink location=/tmp/test.rgb
both gives me frame data in correct size but I get only blurish noisy pictures. I suspect that the isp is actually doing some Bayer decoding and destroys my picture. But I’m not sure.

I’m running the camera in 10-bit format which is coding 4 pixels in 5 bytes. I believe this is called Y10B coding in v4l2.
I realize the format=GRAY8 is probably wrong but I can’t find any closer.

Has anybody any idea how to proceed?

Hello @henrik

How about this? It works on OS08A10.

$ gst-launch-1.0 v4l2src name=vsrc device=/dev/video0 ! video/x-raw,width=1920,height=1080,framerate=60/1,format=RGB ! filesink location=.//test.rgb
2 Likes

I have tested that but still no sensible picture information.

Hi @numbqq
Thanks for you reply.
I discovered how to enable the test pattern generator in the ISP. So with the commands:

$ v4l2-ctl -c isp_test_pattern=1
$ gst-launch-1.0 v4l2src name=vsrc device=/dev/video0 num-buffers=1 ! video/x-raw,width=400,height=400,framerate=5/1,format=RGB ! filesink location=/tmp/test.rgb

And following Python on my host:

import numpy as np
import matplotlib.pyplot as plt
i = np.fromfile('test.rgb', dtype='uint8')
plt.imshow(np.reshape(i[0:400*400*3],(400,400,3)))
plt.show()

I get the picture:
image

I notice that there are some image processing going on. Is it possible to turn off all processing to get a as raw image as possible?
Thanks!

/Henrik

You can try the raw16 format (it’s a padding raw which 16bytes-align)
I don’t know the specifics, but the format is called raw16.

After browsing around in the source code I found that BYR2 will set the isp DMA in the RAW16 base mode. So following command gives me what I need:

v4l2-ctl --device /dev/video0 --set-fmt-video=width=400,height=400,pixelformat=BYR2 --stream-mmap --stream-to=frame.raw --stream-count=4 --stream-skip=1

Thanks!