6 Star 21 Fork 28

zoro/v4l2-learn

 / 详情

Question

已完成
创建于  
2021-09-11 07:52

Hello,

Were you able to get the imx291 to "work" on rv1126 ?
E.g. optain frames pre or after isp ?

If so, which adapter board were you using (or which rv1126 board & cam module) ?

Best regards,
Constantin

评论 (14)

Consti 创建了任务 4年前
Consti 关联仓库设置为zoro/v4l2-learn 4年前
展开全部操作日志
356171 ldl17 1578921264 zoro 拥有者 4年前

hi:
optain frames pre or after isp,all of these are fine.
My rv1126 board is the official development board RV1126_RV1109_EVB_DDR3P216SD6_V13
https://www.donews.com/news/detail/4/3138575.html
The camera module is the sensor of imx291 plus the lens we bought

Congratulations !
Do you have a link to the camera module you are using (e.g. manufacturer) ?

Also, which "iqfile" were you using ? As far as I know, rockchip doesn't provide an iqfile for imx291, at least not for camera_engine_rkaiq.

A more general question, regarding "v4l2learn/loopback/*" - do you know why v4l2 doesn't output raw bayer when using the

v4l2-ctl -d /dev/video20 \
		--set-fmt-video=width=640,height=512,pixelformat=YU12 \
		--stream-mmap=4 \
		--stream-count=1 \
		--stream-to=/data/cif_dvp.yuv \
		--stream-poll

command ? Because in this mode I don't think the ISP is active, so what hw does the debayering (since the camera outputs raw bayer via csi) ?

Btw, I am also "learning" or trying to understand the rv1126 v4l2 / hw pipeline in general, our code/ some investigations are here: https://github.com/Consti10/merged/tree/master/zconsti_file

356171 ldl17 1578921264 zoro 拥有者 4年前

hi:
I think the video node you are using is wrong.
Take my board as an example:
There is a mipi camera and a bt656 infrared camera.
There are 4 media nodes

[root@RV1126_RV1109:/]# ls /dev/media
media0  media1  media2  media3

media0 is related to the infrared camera of bt656
media1 is related to mipi camera
media2 is related to isp
media3 is related to ispp
So if you want to get the raw bayer of the camera, you should go to the media1 node.

[root@RV1126_RV1109:/]# media-ctl -pd /dev/media1
Media controller API version 4.19.111

Media device information
------------------------
driver          rkcif
model           rkcif_mipi_lvds
serial          
bus info        
hw revision     0x0
driver version  4.19.111

Device topology
- entity 1: stream_cif_mipi_id0 (1 pad, 4 links)
            type Node subtype V4L flags 0
            device node name /dev/video5
	pad0: Sink
		<- "rockchip-mipi-csi2":1 [ENABLED]
		<- "rockchip-mipi-csi2":2 []
		<- "rockchip-mipi-csi2":3 []
		<- "rockchip-mipi-csi2":4 []

- entity 5: stream_cif_mipi_id1 (1 pad, 4 links)
            type Node subtype V4L flags 0
            device node name /dev/video6
	pad0: Sink
		<- "rockchip-mipi-csi2":1 []
		<- "rockchip-mipi-csi2":2 [ENABLED]
		<- "rockchip-mipi-csi2":3 []
		<- "rockchip-mipi-csi2":4 []

- entity 9: stream_cif_mipi_id2 (1 pad, 4 links)
            type Node subtype V4L flags 0
            device node name /dev/video7
	pad0: Sink
		<- "rockchip-mipi-csi2":1 []
		<- "rockchip-mipi-csi2":2 []
		<- "rockchip-mipi-csi2":3 [ENABLED]
		<- "rockchip-mipi-csi2":4 []

- entity 13: stream_cif_mipi_id3 (1 pad, 4 links)
             type Node subtype V4L flags 0
             device node name /dev/video8
	pad0: Sink
		<- "rockchip-mipi-csi2":1 []
		<- "rockchip-mipi-csi2":2 []
		<- "rockchip-mipi-csi2":3 []
		<- "rockchip-mipi-csi2":4 [ENABLED]

- entity 17: rockchip-mipi-csi2 (5 pads, 17 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev1
	pad0: Sink
		[fmt:SGRBG12_1X12/1280x1024 field:none
		 crop.bounds:(0,0)/1280x1024
		 crop:(0,0)/1280x1024]
		<- "rockchip-mipi-dphy-rx":1 [ENABLED]
	pad1: Source
		[fmt:SGRBG12_1X12/1280x1024 field:none
		 crop.bounds:(0,0)/1280x1024
		 crop:(0,0)/1280x1024]
		-> "stream_cif_mipi_id0":0 [ENABLED]
		-> "stream_cif_mipi_id1":0 []
		-> "stream_cif_mipi_id2":0 []
		-> "stream_cif_mipi_id3":0 []
	pad2: Source
		[fmt:SGRBG12_1X12/1280x1024 field:none
		 crop.bounds:(0,0)/1280x1024
		 crop:(0,0)/1280x1024]
		-> "stream_cif_mipi_id0":0 []
		-> "stream_cif_mipi_id1":0 [ENABLED]
		-> "stream_cif_mipi_id2":0 []
		-> "stream_cif_mipi_id3":0 []
	pad3: Source
		[fmt:SGRBG12_1X12/1280x1024 field:none
		 crop.bounds:(0,0)/1280x1024
		 crop:(0,0)/1280x1024]
		-> "stream_cif_mipi_id0":0 []
		-> "stream_cif_mipi_id1":0 []
		-> "stream_cif_mipi_id2":0 [ENABLED]
		-> "stream_cif_mipi_id3":0 []
	pad4: Source
		[fmt:SGRBG12_1X12/1280x1024 field:none
		 crop.bounds:(0,0)/1280x1024
		 crop:(0,0)/1280x1024]
		-> "stream_cif_mipi_id0":0 []
		-> "stream_cif_mipi_id1":0 []
		-> "stream_cif_mipi_id2":0 []
		-> "stream_cif_mipi_id3":0 [ENABLED]

- entity 23: rockchip-mipi-dphy-rx (2 pads, 2 links)
             type V4L2 subdev subtype Unknown flags 0
             device node name /dev/v4l-subdev2
	pad0: Sink
		[fmt:SGRBG12_1X12/1280x1024@10000/500000 field:none]
		<- "m01_f_bg5001 1-0032":0 [ENABLED]
	pad1: Source
		[fmt:SGRBG12_1X12/1280x1024@10000/500000 field:none]
		-> "rockchip-mipi-csi2":0 [ENABLED]

- entity 28: rkcif-mipi-luma (0 pad, 0 link)
             type Node subtype V4L flags 0
             device node name /dev/video9

- entity 31: m01_f_bg5001 1-0032 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev3
	pad0: Source
		[fmt:SGRBG12_1X12/1280x1024@10000/500000 field:none]
		-> "rockchip-mipi-dphy-rx":0 [ENABLED]

You can see "entity 1: stream_cif_mipi_id0", which corresponds to video5.
So you should use the following command to get raw bayer:

v4l2-ctl -d /dev/video5 \
		--set-fmt-video=width=1280,height=1024,pixelformat=BG12 \
		--stream-mmap=4 \
		--stream-count=1 \
		--stream-to=/data/raw.data \
		--stream-poll

Okay, let's assume the setup is as you described above. (media-ctl).

  1. One wants to obtain the original camera data (bayer), you can do that with the above command ? Do you know a way to then play back the bayer data ?

  2. What happens when you select a different format with v4l2-ctl than what the sensor outputs ? "What" does the conversion then ?

I am able to capture and play back yuv420 after ISP with v4l2-ctl & gstreamer/ ffplay but so far had no success in capturing & playing back frames before they go through the ISP/ISPP.

I think you are definitely right regarding the media nodes btw. I just don't understand how the hardware works pre-isp. E.g. raw bayer from media1 is feed into the isp/ispp (media2/media3) and comes out processed as yuv420 - that is well documented.

But for some reason I just don't get raw bayer or anything usable out of media1 (mipi-csi) camera node.

356171 ldl17 1578921264 zoro 拥有者 4年前

https://gitee.com/ldl17/v4l2-learn/blob/master/normal/v4l2_test_mplane.c
You can use this test program to get raw bayer from media1 (mipi-csi) camera node.
rv1126 mipi-csi captures the compressed format by default, first change it to 16bit storage:
echo 0 > /sys/devices/platform/rkcif_mipi_lvds/compact_test

Is there a difference between using your (c) test program:
https://gitee.com/ldl17/v4l2-learn/blob/master/normal/v4l2_test_mplane.c

Or v4l2-ctl ?

356171 ldl17 1578921264 zoro 拥有者 4年前

Personally think the difference is
v4l2-ctl for testing
C code can be used in actual projects

Hm, asking because I am still unable to then read the raw file.
What version of cif driver are you using ? I am using v0.1.9

356171 ldl17 1578921264 zoro 拥有者
回复 Consti
4年前

My SDK version is v2.1.x.
What problems are you encountering with obtaining raw data now? Isn't it possible to use v4l2-ctl?
You can use media-ctl -pd /dev/mediaX to see your topology.

Do you know if cif itself supports the conversion from raw sensor bayer to any format( for example NV12) or does it only support bayer to bayer conversions ?

CIF, not ISP.

356171 ldl17 1578921264 zoro 拥有者
回复 Consti
4年前

It seems that it is not supported at present.
You need to write your own program conversion or use opencv.

Okay, thanks. Yeah, it's weird, because no error message or something is thrown by cif. But it makes sense that cif doesn't support bayer to yuv conversion.

Did you have success converting bayer from the sensor to something resembling an image ? E.g. playable by ffplay or similar.

Since you managed to get a new sensor working, I'd guess that took a lot of debugging.

356171 ldl17 1578921264 zoro 拥有者 4年前

My method of testing cif is to obtain a frame of data through v4l2-ctl, and then view the picture after saving the frame data as a picture.
Can you use v4l2-ctl to get data now?

The method to view bayer data is as follows:

cat> /tmp/raw.pgm << EOF
P5
1920
1080
65535
EOF

Notice:
1920 1080 is the resolution of the picture
If it is 16bit it is 65535, if it is 12bit it is 4095

Append bayer raw data to raw.pgm
cat raw.out >> /tmp/raw.pgm
In this way, you can use ubuntu to directly open raw.pgm to view

zoro 任务状态待办的 修改为已完成 3年前

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(2)
356171 ldl17 1578921264 Consti-Consti
1
https://gitee.com/ldl17/v4l2-learn.git
git@gitee.com:ldl17/v4l2-learn.git
ldl17
v4l2-learn
v4l2-learn

搜索帮助