Power & Source of Big Ideas

MCAM400 : AEC/AGC

Moderators: chensy, FATechsupport

Hi,

I use the MCAM400 with a nanoPi M4 (image rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201027).
Image is very dark when there is not much light so I think there is no AEC or AGC.

Do you know how I can enable it if there is ? Or do you know how I can access to registers to set gain by myself ?

Thanks for your help.
[quote="GoblE"]Hi,

I use the MCAM400 with a nanoPi M4 (image rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201027).
Image is very dark when there is not much light so I think there is no AEC or AGC.

Do you know how I can enable it if there is ? Or do you know how I can access to registers to set gain by myself ?

Thanks for your help.[/quote]

I have been experimenting with the cameras on NanoPi M4.
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success. Auto mode works. You can take a look at the code and figure out how to do it with the current engine in FE images.
@lex wrote:
I have been experimenting with the cameras on NanoPi M4.
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success. Auto mode works. You can take a look at the code and figure out how to do it with the current engine in FE images.


Thank you very much for your feedback, I'll see If I can use this. If I find a way I'll put solution here ;)
@lex wrote:
The new rkisp engine has a demo application where you can pass the GAIN and EXPOSURE although I was not able to find how to use it with success.


Unfortunately, I didn't find this rkisp demo. Do you know where can I find it ? (I searched on github and friendly wiki but I didn't find :cry: )

@lex wrote:
Auto mode works.

I changed the lens to have more angle and with current image (rk3399-sd-friendlydesktop-bionic-4.4-arm64-20201226.img.zip), camera output is very dark (photo in attachment).

Attachments

Here you find it:
https://github.com/rockchip-linux/camer ... p_demo.cpp

Changing the lens will not help. You need the 3A and set Exposure / Gain somehow. 3A is a closed source, Maybe contacting Rockchip or FE would help.

Libcamera has evolved and there are some tricks to get a descent Image but far from what you get in 4.4. If you master how to pass the correct EXPOSURE / GAIN in the rkisp demo engine, please post here.

You may find these interesting: https://github.com/avafinger/nanopi-m4- ... a-mainline

There are a few tricks you may find useful.
Due to bug in RkISP(fixed in April 2019) manual Exposure can't be set - so no manual mode. In fact - it's affect all linux images with kernel 4.4. And it's fixed in 4.19/FriendlyCore - so try to use it
I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.

How did you test it and what parameters?
@lex wrote:
I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.

How did you test it and what parameters?


It's fixed in RkISP driver repo, not a Kernel itself https://github.com/rockchip-linux/camera_engine_rkisp/commit/0d549652bccf21b2710f595c93ac119df5147dde

and few fixes before - try to find with keyword "expos" and/or "gain" (sometime they use wrong spelling of work "exposure" )

I use RkISP demo, which use driver directly
https://github.com/rockchip-linux/camer ... rkisp_demo

upd: it's a 4.19.111 kernel in FriendlyElec distro - https://github.com/friendlyarm/kernel-r ... i4-v4.19.y
[quote="ayaromenok"][quote="@lex"]I can't find any reference to this supposed fix in their kernel. Can you provide a link to that fix?
I have tested with kernel 4.19.161 and could not get it to work.

How did you test it and what parameters?[/quote]

It's fixed in RkISP driver repo, not a Kernel itself [url]https://github.com/rockchip-linux/camera_engine_rkisp/commit/0d549652bccf21b2710f595c93ac119df5147dde[/url]

and few fixes before - try to find with keyword "expos" and/or "gain" (sometime they use wrong spelling of work "exposure" )

I use RkISP demo, which use driver directly
https://github.com/rockchip-linux/camer ... rkisp_demo

upd: it's a 4.19.111 kernel in FriendlyElec distro - https://github.com/friendlyarm/kernel-r ... i4-v4.19.y[/quote]

You missed my answer in the previous post.
I am using the latest rkisp (the same link you posted) with kernel 4.19.161 and it does not work.

Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?

If the fix is in the rkisp "driver" it should work since I have the latest code.
@lex wrote:
You missed my answer in the previous post.
I am using the latest rkisp (the same link you posted) with kernel 4.19.161 and it does not work.

Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?

If the fix is in the rkisp "driver" it should work since I have the latest code.


I didin't miss your answer - plz, use 4.19.111 to be sure, that it works(or make sure, that's nothing broken between 111 and 161 version in RkISP(kernel part) and OV4689 driver(it's 2 places in repo)).

I will upload images later today or tomorrow
@lex wrote:
Can you please, provide the parameters you tested to improve the image and some images with the auto mode on and with your parameters to compare with?

Sorry for really delayed answer - just manage to get to hardware - please find follow examples:

- auto(gstreamer)
- manual: exposure 0.01sec, gain(analogue) 8
- manual: exposure 0.01sec, gain(analogue) 16
- manual: exposure 0.029sec, gain(analogue) 8

Looks like I can'ts add link to images from google drive - so link to folder with them - parameters coded in file name
https://drive.google.com/drive/folders/ ... CUS-jLJs0B

Ubuntu Focal build from 202103xx(I had same result starting from 202012xx with same kernel versions)
uname-a Linux cam5 4.19.111 #162 SMP PREEMPT Fri Mar 19 17:14:48 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
Right, still dark and a lot of noise. Anyway, we know now the FE distro works but I was expecting to have a bit more exposure.
Can you print your command line and the output of the command? For the record. There are two MCAM400 cameras (w/IR and without), which one do you have?
@lex wrote:
Right, still dark and a lot of noise.

Sorry, forget to mention - picture was taking early in the morning - around a time of sunrise in the city or even early ;)

command line should something like

Code: Select all

rkisp_demo --device=/dev/video0 --width=2688 --height=1520 --iqfile=/etc/iqfile/ov4689....xml --count=10 --expo=0.029 --gain=8  --output=image.yuv 

than convert from NV12 to JPEG.

V4L2 also works(and use different values for expo/gain), but without AWB (i.e. "green" image)
Thanks, i am able to pass the correct params with kernel 4.19.161 and have a bright image, really bright :).
Just need a better denoise filter, just as the FE 4.4 has.

./rkisp_demo --device /dev/video0 --count 15 --width 2688 --height 1520 --format YU12 --gain 2 --expo 0.031 --output test_gain2_ov4689_2688x1520.yu12

Unfortunately, I can't make the camera with IR cut works with 4.19.161 and the mainline kernel.
That's why I asked you which camera you tested with. the Camera w/IR cut filter worked fine with FE 4.4, maybe I have damaged the sensor removing and inserting it many times.
I get this error:

[ 72.944191] rkisp1: MIPI mis error: 0x0000000e
@lex wrote:
Unfortunately, I can't make the camera with IR cut works with 4.19.161 and the mainline kernel.
That's why I asked you which camera you tested with. the Camera w/IR cut filter worked fine with FE 4.4, maybe I have damaged the sensor removing and inserting it many times.
I get this error:
[ 72.944191] rkisp1: MIPI mis error: 0x0000000e

Looks like I have a camera with IR cut (normal colors, price 12.99$).

Maybe your IR-cut camera is really damaged - IR filter affect colors result, but have very little effect on brightness (10% from F2.2 vs F2.0 for this camera).
Just for the record, i just received a new sensor and found out the error reported here is due to a short on the last track of the FPC, luckily the sensor was not damaged. Changing the FPC was the fix.

[ 72.944191] rkisp1: MIPI mis error: 0x0000000e[/quote]

Attachments

Who is online

In total there are 47 users online :: 0 registered, 0 hidden and 47 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 47 guests