[libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.

tetsuya.nomura at soho-enterprise.com tetsuya.nomura at soho-enterprise.com
Mon Oct 5 09:38:59 CEST 2020


Dear David-san

y_target modification worked well.

And I modified the agc.cpp as attached, but I see compile error.
Message says RPI_LOGGING_ENABLE is redefined. It is already defined in logging.hpp.
So I modified it.

The log is below.

Thank you very much for your help in advance.

Best Regards,

NOMURA
---
Read: Controller starting
Read: rpi.black_level
Read: rpi.lux
Read: rpi.noise
Read: AwbConfig
Read: Agc
Read: AgcConfig
Read: Alsc
read_calibrations: Read calibrations_Cr calibration for ct 3000
read_calibrations: Read calibrations_Cr calibration for ct 3850
read_calibrations: Read calibrations_Cr calibration for ct 6000
read_calibrations: Read calibrations_Cb calibration for ct 3000
read_calibrations: Read calibrations_Cb calibration for ct 3850
read_calibrations: Read calibrations_Cb calibration for ct 6000
Read: rpi.sharpen
Read: Controller finished
Initialise: Controller starting
Initialise: Alsc
Initialise: Controller finished
SwitchMode: Controller starting
get_cal_table: Alsc: ct is 4500, interpolating between 3850 and 6000
get_cal_table: Alsc: ct is 4500, interpolating between 3850 and 6000
SwitchMode: Controller finished
Prepare: Controller::Prepare starting
Prepare: Dpc: strength 1
Prepare: rpi.noise: constant 0 slope 3.67
Prepare: Geq: offset 204 slope 0.01633 (analogue gain 1 lux 400)
Prepare: Noise profile: constant 0 slope 3.67
Prepare: Sdn: programmed constant 0 slope 11.744 strength 0.75
Prepare: Awb: frame_count 1 speed 1
Prepare: Using AWB gains r 1.41939 g 1 b 1.70608
Prepare: Alsc: frame_count 1 speed 1
Prepare: CCM: colour temperature 4000K
Prepare: CCM: 1.69673 -0.588266 -0.108473     -0.454852 1.93008 -0.47523     -0.0799713 -0.767153 1.84712
Prepare: Dpc: strength 1
Prepare: Controller::Prepare finished
Prepare: Controller::Prepare starting
Prepare: Dpc: strength 1
Prepare: rpi.noise: constant 0 slope 3.67
Prepare: Geq: offset 204 slope 0.01633 (analogue gain 1 lux 400)
Prepare: Noise profile: constant 0 slope 3.67
Prepare: Sdn: programmed constant 0 slope 11.744 strength 0.75
Prepare: Awb: frame_count 2 speed 1
Prepare: Using AWB gains r 1.41939 g 1 b 1.70608
Prepare: Alsc: frame_count 2 speed 1
Prepare: CCM: colour temperature 4000K
Prepare: CCM: 1.69673 -0.588266 -0.108473     -0.454852 1.93008 -0.47523     -0.0799713 -0.767153 1.84712
Prepare: Dpc: strength 1
Prepare: Controller::Prepare finished
Process: Controller::Process starting
Process: rpi.lux: estimated lux 135.594
Process: Awb: frame_phase 1
Process: Awb lux value is 135.594
Process: AWB thread starting
restartAsync: Starting AWB thread
housekeepConfig: ev 1 fixed_shutter 0 fixed_analogue_gain 0
housekeepConfig: exposure_mode normal constraint_mode normal metering_mode centre-weighted
computeGain: Initially Y 0.0372334 target 0.321356 gives gain 8.40511
computeGain: Constraint has target_Y 0.5 giving gain 1.7214
computeGain: Final gain 8.40511 (target_Y 0.321356 ev 1 base_ev 1)
computeTargetExposure: Target total_exposure 168102
applyDigitalGain: after AWB, target dg 1 gain 8.40511 target_Y 0.321356
applyDigitalGain: Digital gain 1 desaturate? 0
applyDigitalGain: Target total_exposure_no_dg 168102
filterExposure: After filtering, total_exposure 168102 no dg 168102
divvyupExposure: Divided up shutter and gain are 42025.4 and 4
writeAndFinish: Output written, total exposure requested is 168102
writeAndFinish: Camera exposure update: shutter time 42025.4 analogue gain 4
Process: Alsc: frame_phase 12
Process: ALSC thread starting
restartAsync: Starting ALSC thread
get_ct: Alsc: AWB results found, using 4000
doAwb: Valid zones: 192
operator(): (2000,0.830507)
operator(): (compute_stretch_curve: 3000Move histogram point ,0.0847464)
operator(): (8.9911 to 6000,983.040.338986)

compute_stretch_curveoperator(): : (Final values 13000,983.04 -> 0.338986)
983.04
compute_stretch_curve: Move histogram point 4522.58 to 62259.2
compute_stretch_curve: Final values 60259.2get_cal_table -> : Alsc: ct is 62259.2
4000, interpolating between 3850 and 6000
coarseSearch: t: 2500 gain_r 1.07458 gain_b 2.77599 delta2_sum 38.4 prior 0.457627 final 37.9424
get_cal_table: Alsc: ct is 4000, interpolating between 3850 and 6000
coarseSearch: t: 2550 gain_r 1.08342 gain_b 2.71362 delta2_sum 38.4 prior 0.420339 final 37.9797
coarseSearch: t: 2601 gain_r 1.09258 gain_b 2.65281 delta2_sum 38.4 prior 0.382305 final 38.0177
coarseSearch: t: 2653.02 gain_r 1.10209 gain_b 2.59354 delta2_sum 38.4 prior 0.34351 final 38.0565
coarseSearch: t: 2706.08 gain_r 1.11196 gain_b 2.53574 delta2_sum 38.4 prior 0.30394 final 38.0961
Process: Controller::Process finished
coarseSearch: t: 2760.2 gain_r 1.12222 gain_b 2.47939 delta2_sum 38.4 prior 0.263578 final 38.1364
coarseSearch: t: 2815.41 gain_r 1.13287 gain_b 2.42443 delta2_sum 38.4 prior 0.222409 final 38.1776
coarseSearch: t: 2871.71 gain_r 1.14395 gain_b 2.37083 delta2_sum 38.4 prior 0.180417 final 38.2196
coarseSearch: t: 2929.15 gain_r 1.19792 gain_b 2.1593 delta2_sum 38.4 prior 0.137585 final 38.2624
run_matrix_iterations: Stop after 3 iterations
coarseSearch: t: 2987.73 gain_r 1.20644 gain_b 2.13241 delta2_sum 38.4 prior 0.0938958 final 38.3061
coarseSearch: t: 3047.49 gain_r 1.21525 gain_b 2.10565 delta2_sum 38.4 prior 0.0887707 final 38.3112
coarseSearch: t: run_matrix_iterations3108.44: Stop after  gain_r 3 iterations
1.22437 gain_b 2.07905 delta2_sum 38.4 prior 0.0939359 final 38.3061
coarseSearch: t: 3170.6 gain_r 1.23381 gain_b 2.05259 delta2_sum 38.397 prior 0.0992045 final 38.2978
coarseSearch: t: 3234.02 gain_r 1.24359 gain_b 2.02629 delta2_sum 38.3839 prior 0.104578 final 38.2793
coarseSearch: t: 3298.7 gain_r 1.25374 gain_b 2.00015 delta2_sum 38.3623 prior 0.11006 final 38.2522
coarseSearch: t: 3364.67 gain_r 1.26425 gain_b 1.97417 delta2_sum 38.3333 prior 0.115651 final 38.2176
coarseSearch: t: 3431.96 gain_r 1.27516 gain_b 1.94836 delta2_sum 38.2726 prior 0.121354 final 38.1513
coarseSearch: t: 3500.6 gain_r 1.28649 gain_b 1.92272 delta2_sum 38.1688 prior 0.127171 final 38.0416
coarseSearch: t: 3570.62 gain_r 1.29825 gain_b 1.89725 delta2_sum 38.0138 prior 0.133104 final 37.8807
coarseSearch: t: 3642.03 gain_r 1.31203 gain_b 1.86967 delta2_sum 37.8079 prior 0.139156 final 37.6687
coarseSearch: t: 3714.87 gain_r 1.33254 gain_b 1.83389 delta2_sum 37.5717 prior 0.145329 final 37.4264
coarseSearch: t: 3789.17 gain_r 1.35413 gain_b 1.79878 delta2_sum 37.395 prior 0.151625 final 37.2434
coarseSearch: t: 3864.95 gain_r 1.37688 gain_b 1.76432 delta2_sum 37.3006 prior 0.158048 final 37.1425
coarseSearch: t: 3942.25 gain_r 1.40089 gain_b 1.73051 delta2_sum 37.2845 prior 0.164599 final 37.1199
coarseSearch: t: 4021.09 gain_r 1.42627 gain_b 1.69733 delta2_sum 37.333 prior 0.17128 final 37.1618
coarseSearch: t: 4101.51 gain_r 1.45311 gain_b 1.66477 delta2_sum 37.462 prior 0.178096 final 37.284
coarseSearch: t: 4183.55 gain_r 1.48155 gain_b 1.63283 delta2_sum 37.6052 prior 0.185048 final 37.4202
coarseSearch: t: 4267.22 gain_r 1.51173 gain_b 1.60148 delta2_sum 37.7611 prior 0.192138 final 37.569
coarseSearch: t: 4352.56 gain_r 1.54381 gain_b 1.57072 delta2_sum 37.9333 prior 0.199371 final 37.7339
coarseSearch: t: 4439.61 gain_r 1.57796 gain_b 1.54054 delta2_sum 38.1086 prior 0.206748 final 37.9018
coarseSearch: t: 4528.4 gain_r 1.61439 gain_b 1.51093 delta2_sum 38.2369 prior 0.214273 final 38.0226
coarseSearch: t: 4618.97 gain_r 1.6467 gain_b 1.48676 delta2_sum 38.3341 prior 0.221948 final 38.1122
coarseSearch: t: 4711.35 gain_r 1.65498 gain_b 1.48136 delta2_sum 38.3444 prior 0.229777 final 38.1147
coarseSearch: t: 4805.58 gain_r 1.66351 gain_b 1.4759 delta2_sum 38.3525 prior 0.237763 final 38.1148
coarseSearch: t: 4901.69 gain_r 1.6723 gain_b 1.47037 delta2_sum 38.3612 prior 0.245908 final 38.1153
coarseSearch: t: 4999.72 gain_r 1.68136 gain_b 1.46477 delta2_sum 38.3658 prior 0.254216 final 38.1116
coarseSearch: t: 5099.72 gain_r 1.69071 gain_b 1.4591 delta2_sum 38.3704 prior 0.26269 final 38.1077
coarseSearch: t: 5201.71 gain_r 1.70035 gain_b 1.45336 delta2_sum 38.3753 prior 0.271334 final 38.1039
coarseSearch: t: 5305.75 gain_r 1.7103 gain_b 1.44756 delta2_sum 38.3805 prior 0.28015 final 38.1003
coarseSearch: t: 5411.86 gain_r 1.72057 gain_b 1.44168 delta2_sum 38.3861 prior 0.289143 final 38.0969
coarseSearch: t: 5520.1 gain_r 1.73118 gain_b 1.43574 delta2_sum 38.3921 prior 0.298316 final 38.0938
coarseSearch: t: 5630.5 gain_r 1.74212 gain_b 1.42973 delta2_sum 38.3985 prior 0.307672 final 38.0908
coarseSearch: t: 5743.11 gain_r 1.75472 gain_b 1.42315 delta2_sum 38.4 prior 0.317215 final 38.0828
coarseSearch: t: 5857.97 gain_r 1.77197 gain_b 1.4149 delta2_sum 38.4 prior 0.326949 final 38.0731
coarseSearch: t: 5975.13 gain_r 1.78992 gain_b 1.40658 delta2_sum 38.4 prior 0.336878 final 38.0631
coarseSearch: t: 6094.64 gain_r 1.80861 gain_b 1.39819 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6216.53 gain_r 1.82808 gain_b 1.38974 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6340.86 gain_r 1.84837 gain_b 1.38123 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6467.68 gain_r 1.86954 gain_b 1.37265 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6597.03 gain_r 1.89164 gain_b 1.36401 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6728.97 gain_r 1.91472 gain_b 1.35531 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 6863.55 gain_r 1.93885 gain_b 1.34655 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7000.82 gain_r 1.9641 gain_b 1.33772 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7140.84 gain_r 1.99054 gain_b 1.32884 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7283.65 gain_r 2.01826 gain_b 1.31991 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7429.33 gain_r 2.04733 gain_b 1.31091 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7577.91 gain_r 2.07787 gain_b 1.30187 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7729.47 gain_r 2.10996 gain_b 1.29277 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 7884.06 gain_r 2.14374 gain_b 1.28362 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: t: 8000 gain_r 2.16979 gain_b 1.27684 delta2_sum 38.4 prior 0.338986 final 38.061
coarseSearch: Coarse search found CT 3942.25
coarseSearch: After quadratic refinement, coarse search has CT 3931.35
awbBayes: After coarse search: r 0.715584 b 0.576304 (gains r 1.39746 b 1.73519)
fineSearch: At t 3805.55 r 0.703403 b 0.521812: 38.247
fineSearch: At t 3805.55 r 0.709831 b 0.529039: 38.2316
fineSearch: At t 3805.55 r 0.71626 b 0.536265: 38.1858
fineSearch: At t 3805.55 r 0.722688 b 0.543492: 38.0159
fineSearch: At t 3805.55 r 0.729117 b 0.550718: 37.7233
fineSearch: At t 3805.55 r 0.735546 b 0.557944: 37.2397
fineSearch: At t 3805.55 r 0.741974 b 0.565171: 36.6008
fineSearch: At t 3805.55 r 0.748403 b 0.572397: 35.7669
fineSearch: At t 3805.55 r 0.754831 b 0.579624: 34.87
fineSearch: At t 3805.55 r 0.76126 b 0.58685: 33.9697
fineSearch: At t 3805.55 r 0.767688 b 0.594076: 33.097
fineSearch: Finally 3805.55 r 0.767688 b 0.594076: 33.097
fineSearch: At t 3813.41 r 0.702136 b 0.522939: 38.2463
fineSearch: At t 3813.41 r 0.708565 b 0.530165: 38.2306
fineSearch: At t 3813.41 r 0.714994 b 0.537392: 38.1798
fineSearch: At t 3813.41 r 0.721422 b 0.544618: 38.008
fineSearch: At t 3813.41 r 0.727851 b 0.551845: 37.7097
fineSearch: At t 3813.41 r 0.734279 b 0.559071: 37.2269
fineSearch: At t 3813.41 r 0.740708 b 0.566297: 36.5889
fineSearch: At t 3813.41 r 0.747136 b 0.573524: 35.758
fineSearch: At t 3813.41 r 0.753565 b 0.58075: 34.8629
fineSearch: At t 3813.41 r 0.759994 b 0.587977: 33.9651
fineSearch: At t 3813.41 r 0.766422 b 0.595203: 33.0964
fineSearch: Finally 3813.41 r 0.766422 b 0.595203: 33.0964 BEST
fineSearch: At t 3821.28 r 0.70087 b 0.524065: 38.2457
fineSearch: At t 3821.28 r 0.707299 b 0.531292: 38.2297
fineSearch: At t 3821.28 r 0.713727 b 0.538518: 38.174
fineSearch: At t 3821.28 r 0.720156 b 0.545745: 38.0004
fineSearch: At t 3821.28 r 0.726584 b 0.552971: 37.697
fineSearch: At t 3821.28 r 0.733013 b 0.560197: 37.2153
fineSearch: At t 3821.28 r 0.739442 b 0.567424: 36.5778
fineSearch: At t 3821.28 r 0.74587 b 0.57465: 35.751
fineSearch: At t 3821.28 r 0.752299 b 0.581877: 34.8577
fineSearch: At t 3821.28 r 0.758727 b 0.589103: 33.9623
fineSearch: At t 3821.28 r 0.765156 b 0.596329: 33.0976
fineSearch: Finally 3821.28 r 0.765156 b 0.596329: 33.0976
fineSearch: At t 3829.14 r 0.699604 b 0.525192: 38.245
fineSearch: At t 3829.14 r 0.706032 b 0.532418: 38.2287
fineSearch: At t 3829.14 r 0.712461 b 0.539645: 38.1684
fineSearch: At t 3829.14 r 0.71889 b 0.546871: 37.9923
fineSearch: At t 3829.14 r 0.725318 b 0.554098: 37.685
fineSearch: At t 3829.14 r 0.731747 b 0.561324: 37.2049
fineSearch: At t 3829.14 r 0.738175 b 0.56855: 36.5669
fineSearch: At t 3829.14 r 0.744604 b 0.575777: 35.7458
fineSearch: At t 3829.14 r 0.751032 b 0.583003: 34.8535
fineSearch: At t 3829.14 r 0.757461 b 0.59023: 33.9615
fineSearch: At t 3829.14 r 0.76389 b 0.597456: 33.1007
fineSearch: Finally 3829.14 r 0.76389 b 0.597456: 33.1007
fineSearch: At t 3837 r 0.698338 b 0.526318: 38.2443
fineSearch: At t 3837 r 0.704766 b 0.533545: 38.2279
fineSearch: At t 3837 r 0.711195 b 0.540771: 38.1626
fineSearch: At t 3837 r 0.717623 b 0.547998: 37.9845
fineSearch: At t 3837 r 0.724052 b 0.555224: 37.6738
fineSearch: At t 3837 r 0.73048 b 0.56245: 37.1957
fineSearch: At t 3837 r 0.736909 b 0.569677: 36.5558
fineSearch: At t 3837 r 0.743338 b 0.576903: 35.7423
fineSearch: At t 3837 r 0.749766 b 0.58413: 34.8504
fineSearch: At t 3837 r 0.756195 b 0.591356: 33.9622
fineSearch: At t 3837 r 0.762623 b 0.598582: 33.1058
fineSearch: Finally 3837 r 0.762623 b 0.598582: 33.1058
fineSearch: At t 3844.86 r 0.697071 b 0.527445: 38.2437
fineSearch: At t 3844.86 r 0.7035 b 0.534671: 38.227
fineSearch: At t 3844.86 r 0.709928 b 0.541898: 38.1558
fineSearch: At t 3844.86 r 0.716357 b 0.549124: 37.9771
fineSearch: At t 3844.86 r 0.722786 b 0.55635: 37.6635
fineSearch: At t 3844.86 r 0.729214 b 0.563577: 37.1866
fineSearch: At t 3844.86 r 0.735643 b 0.570803: 36.5459
fineSearch: At t 3844.86 r 0.742071 b 0.57803: 35.7404
fineSearch: At t 3844.86 r 0.7485 b 0.585256: 34.8491
fineSearch: At t 3844.86 r 0.754929 b 0.592482: 33.9642
fineSearch: At t 3844.86 r 0.761357 b 0.599709: 33.1127
fineSearch: Finally 3844.86 r 0.761357 b 0.599709: 33.1127
fineSearch: At t 3852.73 r 0.695805 b 0.528571: 38.243
fineSearch: At t 3852.73 r 0.702234 b 0.535798: 38.2262
fineSearch: At t 3852.73 r 0.708662 b 0.543024: 38.1489
fineSearch: At t 3852.73 r 0.715091 b 0.550251: 37.9694
fineSearch: At t 3852.73 r 0.721519 b 0.557477: 37.654
fineSearch: At t 3852.73 r 0.727948 b 0.564703: 37.1786
fineSearch: At t 3852.73 r 0.734376 b 0.57193: 36.5374
fineSearch: At t 3852.73 r 0.740805 b 0.579156: 35.7401
fineSearch: At t 3852.73 r 0.747234 b 0.586383: 34.8498
fineSearch: At t 3852.73 r 0.753662 b 0.593609: 33.9679
fineSearch: At t 3852.73 r 0.760091 b 0.600835: 33.1212
fineSearch: Finally 3852.73 r 0.760091 b 0.600835: 33.1212
fineSearch: At t 3860.59 r 0.694539 b 0.529698: 38.2423
fineSearch: At t 3860.59 r 0.700967 b 0.536924: 38.2254
fineSearch: At t 3860.59 r 0.707396 b 0.544151: 38.1424
fineSearch: At t 3860.59 r 0.713824 b 0.551377: 37.9622
fineSearch: At t 3860.59 r 0.720253 b 0.558603: 37.6452
fineSearch: At t 3860.59 r 0.726682 b 0.56583: 37.1713
fineSearch: At t 3860.59 r 0.73311 b 0.573056: 36.5305
fineSearch: At t 3860.59 r 0.739539 b 0.580283: 35.741
fineSearch: At t 3860.59 r 0.745967 b 0.587509: 34.8525
fineSearch: At t 3860.59 r 0.752396 b 0.594735: 33.9736
fineSearch: At t 3860.59 r 0.758825 b 0.601962: 33.1307
fineSearch: Finally 3860.59 r 0.758825 b 0.601962: 33.1307
fineSearch: At t 3868.45 r 0.693272 b 0.530824: 38.2417
fineSearch: At t 3868.45 r 0.699701 b 0.538051: 38.2247
fineSearch: At t 3868.45 r 0.70613 b 0.545277: 38.1362
fineSearch: At t 3868.45 r 0.712558 b 0.552504: 37.9554
fineSearch: At t 3868.45 r 0.718987 b 0.55973: 37.6362
fineSearch: At t 3868.45 r 0.725415 b 0.566956: 37.1649
fineSearch: At t 3868.45 r 0.731844 b 0.574183: 36.525
fineSearch: At t 3868.45 r 0.738273 b 0.581409: 35.7429
fineSearch: At t 3868.45 r 0.744701 b 0.588635: 34.8568
fineSearch: At t 3868.45 r 0.75113 b 0.595862: 33.9811
fineSearch: At t 3868.45 r 0.757558 b 0.603088: 33.142
fineSearch: Finally 3868.45 r 0.757558 b 0.603088: 33.142
fineSearch: At t 3876.32 r 0.692006 b 0.531951: 38.241
fineSearch: At t 3876.32 r 0.698435 b 0.539177: 38.224
fineSearch: At t 3876.32 r 0.704863 b 0.546404: 38.1302
fineSearch: At t 3876.32 r 0.711292 b 0.55363: 37.9477
fineSearch: At t 3876.32 r 0.71772 b 0.560856: 37.6275
fineSearch: At t 3876.32 r 0.724149 b 0.568083: 37.1593
fineSearch: At t 3876.32 r 0.730578 b 0.575309: 36.5205
fineSearch: At t 3876.32 r 0.737006 b 0.582536: 35.7465
fineSearch: At t 3876.32 r 0.743435 b 0.589762: 34.863
fineSearch: At t 3876.32 r 0.749863 b 0.596988: 33.9905
fineSearch: At t 3876.32 r 0.756292 b 0.604215: 33.1551
fineSearch: Finally 3876.32 r 0.756292 b 0.604215: 33.1551
fineSearch: At t 3884.18 r 0.69074 b 0.533077: 38.2403
fineSearch: At t 3884.18 r 0.697168 b 0.540304: 38.2234
fineSearch: At t 3884.18 r 0.703597 b 0.54753: 38.1246
fineSearch: At t 3884.18 r 0.710026 b 0.554756: 37.9401
fineSearch: At t 3884.18 r 0.716454 b 0.561983: 37.6197
fineSearch: At t 3884.18 r 0.722883 b 0.569209: 37.1549
fineSearch: At t 3884.18 r 0.729311 b 0.576436: 36.5172
fineSearch: At t 3884.18 r 0.73574 b 0.583662: 35.7514
fineSearch: At t 3884.18 r 0.742169 b 0.590888: 34.8712
fineSearch: At t 3884.18 r 0.748597 b 0.598115: 34.0017
fineSearch: At t 3884.18 r 0.755026 b 0.605341: 33.1691
fineSearch: Finally 3884.18 r 0.755026 b 0.605341: 33.1691
fineSearch: At t 3892.04 r 0.689474 b 0.534204: 38.2397
fineSearch: At t 3892.04 r 0.695902 b 0.54143: 38.2225
fineSearch: At t 3892.04 r 0.702331 b 0.548657: 38.1192
fineSearch: At t 3892.04 r 0.708759 b 0.555883: 37.933
fineSearch: At t 3892.04 r 0.715188 b 0.563109: 37.6126
fineSearch: At t 3892.04 r 0.721617 b 0.570336: 37.1515
fineSearch: At t 3892.04 r 0.728045 b 0.577562: 36.5153
fineSearch: At t 3892.04 r 0.734474 b 0.584789: 35.757
fineSearch: At t 3892.04 r 0.740902 b 0.592015: 34.8811
fineSearch: At t 3892.04 r 0.747331 b 0.599241: 34.0147
fineSearch: At t 3892.04 r 0.753759 b 0.606468: 33.1849
fineSearch: Finally 3892.04 r 0.753759 b 0.606468: 33.1849
fineSearch: At t 3899.9 r 0.688207 b 0.53533: 38.239
fineSearch: At t 3899.9 r 0.694636 b 0.542557: 38.2214
fineSearch: At t 3899.9 r 0.701064 b 0.549783: 38.1142
fineSearch: At t 3899.9 r 0.707493 b 0.557009: 37.9265
fineSearch: At t 3899.9 r 0.713922 b 0.564236: 37.6064
fineSearch: At t 3899.9 r 0.72035 b 0.571462: 37.1493
fineSearch: At t 3899.9 r 0.726779 b 0.578689: 36.5148
fineSearch: At t 3899.9 r 0.733207 b 0.585915: 35.7644
fineSearch: At t 3899.9 r 0.739636 b 0.593141: 34.893
fineSearch: At t 3899.9 r 0.746065 b 0.600368: 34.0297
fineSearch: At t 3899.9 r 0.752493 b 0.607594: 33.2026
fineSearch: Finally 3899.9 r 0.752493 b 0.607594: 33.2026
fineSearch: At t 3907.77 r 0.686941 b 0.536457: 38.2383
fineSearch: At t 3907.77 r 0.69337 b 0.543683: 38.2204
fineSearch: At t 3907.77 r 0.699798 b 0.550909: 38.1095
fineSearch: At t 3907.77 r 0.706227 b 0.558136: 37.9204
fineSearch: At t 3907.77 r 0.712655 b 0.565362: 37.6011
fineSearch: At t 3907.77 r 0.719084 b 0.572589: 37.1479
fineSearch: At t 3907.77 r 0.725513 b 0.579815: 36.5158
fineSearch: At t 3907.77 r 0.731941 b 0.587041: 35.7728
fineSearch: At t 3907.77 r 0.73837 b 0.594268: 34.9068
fineSearch: At t 3907.77 r 0.744798 b 0.601494: 34.0464
fineSearch: At t 3907.77 r 0.751227 b 0.608721: 33.222
fineSearch: Finally 3907.77 r 0.751227 b 0.608721: 33.222
fineSearch: At t 3915.63 r 0.685675 b 0.537583: 38.2377
fineSearch: At t 3915.63 r 0.692103 b 0.54481: 38.2195
fineSearch: At t 3915.63 r 0.698532 b 0.552036: 38.105
fineSearch: At t 3915.63 r 0.704961 b 0.559262: 37.9148
fineSearch: At t 3915.63 r 0.711389 b 0.566489: 37.5965
fineSearch: At t 3915.63 r 0.717818 b 0.573715: 37.147
fineSearch: At t 3915.63 r 0.724246 b 0.580942: 36.5182
fineSearch: At t 3915.63 r 0.730675 b 0.588168: 35.7802
fineSearch: At t 3915.63 r 0.737103 b 0.595394: 34.9215
fineSearch: At t 3915.63 r 0.743532 b 0.602621: 34.0651
fineSearch: At t 3915.63 r 0.749961 b 0.609847: 33.2433
fineSearch: Finally 3915.63 r 0.749961 b 0.609847: 33.2433
fineSearch: At t 3923.49 r 0.684408 b 0.53871: 38.237
fineSearch: At t 3923.49 r 0.690837 b 0.545936: 38.2187
fineSearch: At t 3923.49 r 0.697266 b 0.553162: 38.1009
fineSearch: At t 3923.49 r 0.703694 b 0.560389: 37.9098
fineSearch: At t 3923.49 r 0.710123 b 0.567615: 37.5928
fineSearch: At t 3923.49 r 0.716551 b 0.574842: 37.1455
fineSearch: At t 3923.49 r 0.72298 b 0.582068: 36.522
fineSearch: At t 3923.49 r 0.729409 b 0.589294: 35.7891
fineSearch: At t 3923.49 r 0.735837 b 0.596521: 34.9377
fineSearch: At t 3923.49 r 0.742266 b 0.603747: 34.0849
fineSearch: At t 3923.49 r 0.748694 b 0.610974: 33.2664
fineSearch: Finally 3923.49 r 0.748694 b 0.610974: 33.2664
fineSearch: At t 3931.35 r 0.683142 b 0.539836: 38.2363
fineSearch: At t 3931.35 r 0.689571 b 0.547063: 38.2179
fineSearch: At t 3931.35 r 0.695999 b 0.554289: 38.097
fineSearch: At t 3931.35 r 0.702428 b 0.561515: 37.9052
fineSearch: At t 3931.35 r 0.708857 b 0.568742: 37.5899
fineSearch: At t 3931.35 r 0.715285 b 0.575968: 37.1442
fineSearch: At t 3931.35 r 0.721714 b 0.583195: 36.5273
fineSearch: At t 3931.35 r 0.728142 b 0.590421: 35.7998
fineSearch: At t 3931.35 r 0.734571 b 0.597647: 34.9557
fineSearch: At t 3931.35 r 0.740999 b 0.604874: 34.106
fineSearch: At t 3931.35 r 0.747428 b 0.6121: 33.2913
fineSearch: Finally 3931.35 r 0.747428 b 0.6121: 33.2913
fineSearch: At t 3939.22 r 0.681876 b 0.540963: 38.2357
fineSearch: At t 3939.22 r 0.688305 b 0.548189: 38.2168
fineSearch: At t 3939.22 r 0.694733 b 0.555415: 38.0935
fineSearch: At t 3939.22 r 0.701162 b 0.562642: 37.9011
fineSearch: At t 3939.22 r 0.70759 b 0.569868: 37.5877
fineSearch: At t 3939.22 r 0.714019 b 0.577095: 37.1432
fineSearch: At t 3939.22 r 0.720447 b 0.584321: 36.5333
fineSearch: At t 3939.22 r 0.726876 b 0.591547: 35.8117
fineSearch: At t 3939.22 r 0.733305 b 0.598774: 34.9751
fineSearch: At t 3939.22 r 0.739733 b 0.606: 34.1289
fineSearch: At t 3939.22 r 0.746162 b 0.613227: 33.3167
fineSearch: Finally 3939.22 r 0.746162 b 0.613227: 33.3167
fineSearch: At t 3947.08 r 0.68061 b 0.542089: 38.235
fineSearch: At t 3947.08 r 0.687038 b 0.549315: 38.2147
fineSearch: At t 3947.08 r 0.693467 b 0.556542: 38.0902
fineSearch: At t 3947.08 r 0.699895 b 0.563768: 37.8975
fineSearch: At t 3947.08 r 0.706324 b 0.570995: 37.5854
fineSearch: At t 3947.08 r 0.712753 b 0.578221: 37.1431
fineSearch: At t 3947.08 r 0.719181 b 0.585447: 36.5404 

-----Original Message-----
From: David Plowman <david.plowman at raspberrypi.com> 
Sent: Monday, October 5, 2020 3:32 PM
To: tetsuya.nomura at soho-enterprise.com
Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>; Kieran Bingham <kieran.bingham at ideasonboard.com>; libcamera-devel at lists.libcamera.org
Subject: Re: [libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.

Hello Nomura-san

Thank you for your message.

It sounds likely that the AGC is running at its maximum values, that is, the exposure time has reached its maximum, and the gain has reached its limit too. Under these conditions changing the y_target will not have any effect.

In normal circumstances I would expect that you could replace the y_target in the json file by (for example)

        "y_target":
        [
            0, 0.32, 1000, 0.33, 10000, 0.34
        ]

and this would double the exposure (as I have doubled all the target values). However, when the AGC has reached its limits this will not make any difference, and I would guess this is what's happening in your case.

We could confirm this by collecting some debug. I'm intending to do some maintenance on the AGC in the coming days, part of which will replace the debug messages by libcamera debug which can be enabled without recompiling. For the moment, unfortunately, you would have to edit the code (add "#define RPI_LOGGING_ENABLE 1" to the top of
agc.cpp) and recompile. If you were able to capture the last ~50 lines of this debug it would probably clarify the situation for us.

Best regards
David


On Mon, 5 Oct 2020 at 05:36, <tetsuya.nomura at soho-enterprise.com> wrote:
>
> Dear David-san
>
> According to your instruction, I could confirm the AGC is working, and 
> I could get brighter image under dark condition by changing the "gain" parameter From "1.0, 2.0, 4.0, 6.0, 6.0" to "1.0, 2.0, 4.0, 8.0, 16.0"
>
> However, when changing the y_target value, I could not see the significant change.
> It would be great if you show me the example how to change the y_target parameter to get the brighter image under dark condition, if possible.
> I'd like to understand how to modify the .json file for fine tuning.
>
> Best Regards,
>
> NOMURA
>
> -----Original Message-----
> From: tetsuya.nomura at soho-enterprise.com 
> <tetsuya.nomura at soho-enterprise.com>
> Sent: Tuesday, September 29, 2020 6:33 PM
> To: 'David Plowman' <david.plowman at raspberrypi.com>
> Cc: 'Laurent Pinchart' <laurent.pinchart at ideasonboard.com>; 'Kieran 
> Bingham' <kieran.bingham at ideasonboard.com>; 
> 'libcamera-devel at lists.libcamera.org' 
> <libcamera-devel at lists.libcamera.org>
> Subject: RE: [libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.
>
> Dear David-san
>
> I appreciate your valuable advice.
> I'll try it!
>
> Please wait for my report.
>
> Best Regards,
>
> NOMURA
> -----Original Message-----
> From: David Plowman <david.plowman at raspberrypi.com>
> Sent: Tuesday, September 29, 2020 6:21 PM
> To: tetsuya.nomura at soho-enterprise.com
> Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>; Kieran 
> Bingham <kieran.bingham at ideasonboard.com>; 
> libcamera-devel at lists.libcamera.org
> Subject: Re: [libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.
>
> Hi Nomura-san
>
> Thanks for your reply. If you want to change the AEC/AGC target 
> brightness go to the file
>
> libcamera/src/ipa/raspberrypi/data/imx219.json
>
> Look for the string "y_target". The numbers there are pairs of values 
> <brightness>, <target>. <brightness> is the estimated actual 
> brightness of the scene, in lux, and <target> is the basic target 
> value for the AEC/AGC. It's given pre-gamma and as a proportion of the 
> full dynamic range of the pixels. (Note: you may need to re-install 
> libcamera to be sure it's reading the updated file.)
>
> Further documentation is of course available here:
> https://www.raspberrypi.org/documentation/linux/software/libcamera/rpi
> _SOFT_libcamera_1p0.pdf
> (section 5.8)
>
> Bear in mind that you may in some circumstances reach the limit of the exposure time and analogue gain. Search again for the string "exposure_modes"; you'll be using the one named "normal" (unless you have changed it). These parameters are also documented in the same place.
>
> Best regards
> David
>
> On Tue, 29 Sep 2020 at 10:01, <tetsuya.nomura at soho-enterprise.com> wrote:
> >
> > Dear David-san
> >
> > I'll investigate the DNG file how the AGC working.
> > And if possible, could you tell me how to change AEC/AGC target brighter?
> >
> > Best Regards,
> >
> > NOMURA
> >
> > #2020.7.1本社移転いたしました。
> > = = = = = = = = = = = = = = = = = = = = =
> > 双峰エンタープライズ株式会社 野村 哲哉
> > 〒243-0014 神奈川県厚木市旭町四丁目11番26号 ジェントビル2F
> > URL: https://soho-enterprise.com
> > Email: tetsuya.nomura at soho-enterprise.com
> > Phone: 090-1839-1135
> > = = = = = = = = = = = = = = = = = = = = =
> >
> > -----Original Message-----
> > From: David Plowman <david.plowman at raspberrypi.com>
> > Sent: Tuesday, September 29, 2020 4:03 PM
> > To: tetsuya.nomura at soho-enterprise.com
> > Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>; Kieran 
> > Bingham <kieran.bingham at ideasonboard.com>;
> > libcamera-devel at lists.libcamera.org
> > Subject: Re: [libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.
> >
> > Hello again
> >
> > Thanks to everyone for trying to sort this out! Let me try and explain what I've understood so far.
> >
> > 1. AGC and AEC are not separate in the AGC/AEC algorithm that runs on the Pi under libcamera.
> >
> > 2. When qcam saves a jpeg it does *not* record exposure time and analogue gain in the exif data (I've checked this since I last posted).
> >
> > 3. However, when you save a DNG file ("qcam -s role=viewfinder -s
> > role=stillraw") you should find both in the exif data. It doesn't 
> > actually record analogue gain directly, I think it multiplies it by
> > 100 and saves it as the "ISO".
> >
> > 4. I can't explain why you're not finding the saved jpeg files. The default folder is I think ~/Pictures, but I don't know why you don't see a file.
> >
> > 5. The log you've posted just above looks fine, though I think it is stopping before you click to save the jpeg file?
> >
> > 6. Given that you are able to save DNG files, can you share the exposure time and ISO values from the exif data for images captured in both bright and dark conditions? This would tell us what the AGC is doing.
> >
> > 7. Testing with the old Raspberry Pi "raspi-cam" apps doesn't really show anything. It's a completely different stack and the control algorithms are all different.
> >
> > Thanks, and sorry that this all seems to be so confusing!
> >
> > Best regards
> > David
> >
> > On Tue, 29 Sep 2020 at 01:41, <tetsuya.nomura at soho-enterprise.com> wrote:
> > >
> > > Dear Laurent-san
> > >
> > > I don't see the error message.
> > >
> > > Here is the message log.
> > > ---
> > > pi at raspberrypi:~/libcamera/build/src/qcam $ qcam
> > > qt5ct: using qt5ct plugin
> > > [1:02:58.663793968] [1179]  INFO Camera camera_manager.cpp:287 
> > > libcamera v0.0.0+1805-f999ee85 [1:02:58.837343652] [1179]  INFO 
> > > Camera
> > > camera.cpp:797 configuring streams: (0) 800x600-BGR888 
> > > [1:02:58.838269394] [1181]  INFO RPI raspberrypi.cpp:116 Mode:
> > > 3280x2464 fmt BG10 Score: 2592.49 (best 2592.49) 
> > > [1:02:58.838444061] [1181]  INFO RPI raspberrypi.cpp:116 Mode: 1920x1080 fmt BG10 Score:
> > > 2066.67 (best 2066.67) [1:02:58.838541969] [1181]  INFO RPI
> > > raspberrypi.cpp:116 Mode: 1640x1232 fmt BG10 Score: 1874.49 (best
> > > 1874.49) [1:02:58.838635765] [1181]  INFO RPI raspberrypi.cpp:116
> > > Mode: 640x480 fmt BG10 Score: 2060 (best 1874.49) 
> > > [1:02:58.838741525] [1181]  INFO RPI raspberrypi.cpp:116 Mode: 3280x2464 fmt BA81 Score:
> > > 3592.49 (best 1874.49) [1:02:58.838833525] [1181]  INFO RPI
> > > raspberrypi.cpp:116 Mode: 1920x1080 fmt BA81 Score: 3066.67 (best
> > > 1874.49) [1:02:58.838924155] [1181]  INFO RPI raspberrypi.cpp:116
> > > Mode: 1640x1232 fmt BA81 Score: 2874.49 (best 1874.49) 
> > > [1:02:58.839013414] [1181]  INFO RPI raspberrypi.cpp:116 Mode:
> > > 640x480 fmt BA81 Score: 3060 (best 1874.49) [1:02:58.839107303] 
> > > [1181]  INFO RPI raspberrypi.cpp:116 Mode: 3280x2464 fmt pBAA Score:
> > > 2092.49 (best
> > > 1874.49) [1:02:58.839198377] [1181]  INFO RPI raspberrypi.cpp:116
> > > Mode: 1920x1080 fmt pBAA Score: 1566.67 (best 1566.67) 
> > > [1:02:58.839310914] [1181]  INFO RPI raspberrypi.cpp:116 Mode:
> > > 1640x1232 fmt pBAA Score: 1374.49 (best 1374.49) 
> > > [1:02:58.839454229] [1181]  INFO RPI raspberrypi.cpp:116 Mode: 640x480 fmt pBAA Score:
> > > 1560 (best 1374.49) [1:02:58.839612156] [1181]  INFO RPI
> > > raspberrypi.cpp:496 Sensor: /base/soc/i2c0mux/i2c at 1/imx219 at 10 - 
> > > Selected mode: 1640x1232-pBAA [1:02:58.957246497] [1181]  INFO 
> > > RPI_S_W
> > > staggered_ctrl.cpp:36 Init ctrl 0x00980911 with delay 2 
> > > [1:02:58.957479609] [1181]  INFO RPI_S_W staggered_ctrl.cpp:36 
> > > Init ctrl 0x009e0903 with delay 1 Zero-copy enabled 
> > > [1:02:58.993835570] [1181]  INFO RPISTREAM rpi_stream.cpp:120 No 
> > > buffers available for ISP
> > > Output0 [1:02:58.993962033] [1181]  INFO RPISTREAM
> > > rpi_stream.cpp:120 No buffers available for ISP Output0 
> > > [1:02:59.100047413] [1181]  INFO RPI raspberrypi.cpp:1397 Dropping 
> > > frame at the request of the IPA (5
> > > left) [1:02:59.147212816] [1181]  INFO RPI raspberrypi.cpp:1397 
> > > Dropping frame at the request of the IPA (4 left) 
> > > [1:02:59.164827176] [1181]  INFO RPI raspberrypi.cpp:1397 Dropping 
> > > frame at the request of the IPA (3 left) [1:02:59.199072801] 
> > > [1181] INFO RPI
> > > raspberrypi.cpp:1397 Dropping frame at the request of the IPA (2
> > > left) libpng warning: iCCP: known incorrect sRGB profile 
> > > [1:02:59.229348050] [1181]  INFO RPI raspberrypi.cpp:1397 Dropping 
> > > frame at the request of the IPA (1 left) [1:02:59.262649340] 
> > > [1181] INFO RPI
> > > raspberrypi.cpp:1397 Dropping frame at the request of the IPA (0
> > > left)
> > > seq: 000006 bytesused: 1440000 timestamp: 3779256059000 fps: 0.00
> > > seq: 000007 bytesused: 1440000 timestamp: 3779289386000 fps: 30.01
> > > seq: 000008 bytesused: 1440000 timestamp: 3779322716000 fps: 30.00
> > > seq: 000009 bytesused: 1440000 timestamp: 3779356040000 fps: 30.01
> > > seq: 000010 bytesused: 1440000 timestamp: 3779389368000 fps: 30.00
> > > seq: 000011 bytesused: 1440000 timestamp: 3779422699000 fps: 30.00
> > >
> > > ---
> > >
> > > Best Regards,
> > >
> > > NOMURA
> > >
> > > -----Original Message-----
> > > From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > Sent: Tuesday, September 29, 2020 9:20 AM
> > > To: tetsuya.nomura at soho-enterprise.com
> > > Cc: 'David Plowman' <david.plowman at raspberrypi.com>; 'Kieran Bingham'
> > > <kieran.bingham at ideasonboard.com>;
> > > libcamera-devel at lists.libcamera.org
> > > Subject: Re: [libcamera-devel] How to activate AGC control in libcamera, or set the GAIN/EXPOSURE parameter by v4l2 command.
> > >
> > > Hello Nomura-san,
> > >
> > > On Tue, Sep 29, 2020 at 08:55:28AM +0900, tetsuya.nomura at soho-enterprise.com wrote:
> > > > Dear Laurent-san
> > > >
> > > > Thank you for your advice.
> > > >
> > > > I've tried the "Save As" button, specify the file name, and saved, but I cannot find it there.
> > >
> > > I'm surprised. If you run qcam in a console, does it print an error message when it fails to save ?
> > >
> > > > On the other hand, I could store the raw data starting with " qcam -s role=viewfinder -s role=stillraw".
> > >
> > > --
> > > Regards,
> > >
> > > Laurent Pinchart
> > >
> >
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: agc.cpp
Type: application/octet-stream
Size: 22933 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20201005/2325b5f8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log.log
Type: application/octet-stream
Size: 686736 bytes
Desc: not available
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20201005/2325b5f8/attachment-0003.obj>


More information about the libcamera-devel mailing list