Official V4L2 driver


481 posts   Page 17 of 20   1 ... 14, 15, 16, 17, 18, 19, 20
by byterg » Tue Aug 11, 2015 8:27 am
Hello!
I use V4L2 API for get images from sensor, linux-3.18.16.
Unfortunately white balance parameters not apply.
Follow my debug output from drivers/media/platforms/bcm2835/controls.c:
[ 72.883893] ctrl_set_awb_mode: awb mode 0, result 0
[ 72.889083] ctrl_set_awb_gains: red gain 2500, blue gain 1000, result 0
[ 72.896049] ctrl_set_awb_gains: red gain 2500, blue gain 1750, result 0
This very strange because another controls work, I check rotate and image saturation.
Posts: 56
Joined: Tue Jul 15, 2014 8:16 am
by Racer » Sat Aug 15, 2015 7:55 am
I noticed the same. I was using YUV420 and figured that it must be the RAW format. What kind of output are you using? Maybe colour balance is digitally applied in the post processing of the RAW image.
Posts: 2
Joined: Tue Apr 14, 2015 5:37 pm
by Racer » Fri Sep 04, 2015 2:31 pm
I Am experiencing a severe AWB issue with the Raspberry Pi camera and the V4L2 driver

I have set the AWB like this

v4l2-ctl --set-ctrl=white_balance_auto_preset=0

Red & Blue are both set to their Default values (1000).

As soon as I take a picture of a blue object on a white background I get yellow pictures.....

I have been able to reproduce this effect with 16 different cameras.

I suspect that the white balance doesn't go into manual mode.

By the way, the output files that I use are in the YUV420 format.

Is this maybe a firmware bug?

Regards,
R4C3R
Posts: 2
Joined: Tue Apr 14, 2015 5:37 pm
by 6by9 » Fri Sep 04, 2015 3:54 pm
Racer wrote:I Am experiencing a severe AWB issue with the Raspberry Pi camera and the V4L2 driver

I have set the AWB like this

v4l2-ctl --set-ctrl=white_balance_auto_preset=0

Red & Blue are both set to their Default values (1000).

As soon as I take a picture of a blue object on a white background I get yellow pictures.....

I have been able to reproduce this effect with 16 different cameras.

I suspect that the white balance doesn't go into manual mode.

By the way, the output files that I use are in the YUV420 format.

Is this maybe a firmware bug?

I haven't checked for a while, but I haven't had complaints from those using manual white balance via raspi[still|vid].
...
I've just run qv4l2 (X version of v4l2-ctl), selected YU12, manual white balance (camera controls tab), and then slid the red and blue balance sliders (user controls tab) around, and I get changing red and blue gains as expected. To me that says that everything is OK, and I'll need a fair amount more detail of what you're selecting and how to help further.
(I'm on a custom built 4.0.9.v7+ build, but no mods to the V4L2 driver)
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Sat Sep 05, 2015 8:26 am
These are the commands that I use:

Code: Select all
sudo modprobe bcm2835-v4l2 max_video_width=2592 max_video_height=1944
v4l2-ctl -v width=2592,height=1944,pixelformat=I420
v4l2-ctl --set-ctrl white_balance_auto_preset=0,red_balance=1000,blue_balance=1000
v4l2-ctl --set-ctrl brightness=50,contrast=15,saturation=0,horizontal_flip=1,vertical_flip=1,power_line_frequency=1,sharpness=0,color_effects=0,rotate=0,color_effects_cbcr=32896
v4l2-ctl --set-ctrl auto_exposure=1,exposure_time_absolute=300,auto_exposure_bias=12,iso_sensitivity=1
v4l2-ctl -p 10
v4l2-ctl --stream-mmap=3 --stream-skip=2 --stream-to=/home/pi/test.yuv  --stream-count=4



This is the output from v4l2-ctl -l is:

Code: Select all
User Controls

                     brightness (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast (int)    : min=-100 max=100 step=1 default=0 value=15 flags=slider
                     saturation (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                    red_balance (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip (bool)   : default=0 value=1
                  vertical_flip (bool)   : default=0 value=1
           power_line_frequency (menu)   : min=0 max=3 default=1 value=1
            0: Disabled
            1: 50 Hz
            2: 60 Hz
            3: Auto
                      sharpness (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                  color_effects (menu)   : min=0 max=15 default=0 value=0
            0: None
            1: Black & White
            2: Sepia
            3: Negative
            4: Emboss
            5: Sketch
            6: Sky Blue
            7: Grass Green
            8: Skin Whiten
            9: Vivid
            10: Aqua
            11: Art Freeze
            12: Silhouette
            13: Solarization
            14: Antique
            15: Set Cb/Cr
                         rotate (int)    : min=0 max=360 step=90 default=0 value=0
             color_effects_cbcr (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode (menu)   : min=0 max=1 default=0 value=0 flags=update
            0: Variable Bitrate
            1: Constant Bitrate
                  video_bitrate (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
         repeat_sequence_header (bool)   : default=0 value=0
            h264_i_frame_period (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level (menu)   : min=0 max=11 default=11 value=11
            0: 1
            1: 1b
            2: 1.1
            3: 1.2
            4: 1.3
            5: 2
            6: 2.1
            7: 2.2
            8: 3
            9: 3.1
            10: 3.2
            11: 4
                   h264_profile (menu)   : min=0 max=4 default=4 value=4
            0: Baseline
            1: Constrained Baseline
            2: Main
            4: High

Camera Controls

                  auto_exposure (menu)   : min=0 max=3 default=0 value=1
            0: Auto Mode
            1: Manual Mode
         exposure_time_absolute (int)    : min=1 max=10000 step=1 default=1000 value=200
     exposure_dynamic_framerate (bool)   : default=0 value=0
             auto_exposure_bias (intmenu): min=0 max=24 default=12 value=12
            0: -4000 (0xfffffffffffff060)
            1: -3667 (0xfffffffffffff1ad)
            2: -3333 (0xfffffffffffff2fb)
            3: -3000 (0xfffffffffffff448)
            4: -2667 (0xfffffffffffff595)
            5: -2333 (0xfffffffffffff6e3)
            6: -2000 (0xfffffffffffff830)
            7: -1667 (0xfffffffffffff97d)
            8: -1333 (0xfffffffffffffacb)
            9: -1000 (0xfffffffffffffc18)
            10: -667 (0xfffffffffffffd65)
            11: -333 (0xfffffffffffffeb3)
            12: 0 (0x0)
            13: 333 (0x14d)
            14: 667 (0x29b)
            15: 1000 (0x3e8)
            16: 1333 (0x535)
            17: 1667 (0x683)
            18: 2000 (0x7d0)
            19: 2333 (0x91d)
            20: 2667 (0xa6b)
            21: 3000 (0xbb8)
            22: 3333 (0xd05)
            23: 3667 (0xe53)
            24: 4000 (0xfa0)
      white_balance_auto_preset (menu)   : min=0 max=9 default=1 value=0
            0: Manual
            1: Auto
            2: Incandescent
            3: Fluorescent
            4: Fluorescent H
            5: Horizon
            6: Daylight
            7: Flash
            8: Cloudy
            9: Shade
            image_stabilization (bool)   : default=0 value=0
                iso_sensitivity (intmenu): min=0 max=4 default=0 value=1
            0: 0 (0x0)
            1: 100 (0x64)
            2: 200 (0xc8)
            3: 400 (0x190)
            4: 800 (0x320)
         exposure_metering_mode (menu)   : min=0 max=2 default=0 value=0
            0: Average
            1: Center Weighted
            2: Spot
                     scene_mode (menu)   : min=0 max=13 default=0 value=0
            0: None
            8: Night
            11: Sports

JPEG Compression Controls

            compression_quality (int)    : min=1 max=100 step=1 default=30 value=30


Firmware version:

Linux raspberrypi 4.0.8-v7+ #805 SMP PREEMPT Thu Jul 16 18:46:20 BST 2015 armv7l GNU/Linux

GPU Firmware:

Jul 16 2015 19:12:56
Copyright (c) 2012 Broadcom
version bc619b5e5aa64f2b5fdd24f6b6a4e61907027a35 (clean) (release)

example of yellow picture (where the yellow should actually be white):

example.jpg
Example picture where yellow should be white
example.jpg (46.2 KiB) Viewed 2987 times

If there is any other information required, please let me know.

Kind regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Sat Sep 05, 2015 7:20 pm
OK, I'll look at that when I next have a Pi set up.

You do realise that red/blue gains of x1.0 (1000) is not expected to give "normal" colours. The auto algo will typically end up gains between about x1.3 and x1.8 - a bundle of values including red and blue gains are actually stored in the JPEG Makernote as ASCII text, so try capturing your scene with raspistill to see what would be sensible values.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Sat Sep 05, 2015 9:44 pm
I have continued with testing the driver and I can confirm the following:

When I enter the following commands:

Code: Select all
sudo modprobe bcm2835-v4l2 max_video_width=2592 max_video_height=1944
v4l2-ctl -v width=2592,height=1944,pixelformat=I420
v4l2-ctl --set-ctrl=white_balance_auto_preset=0,red_balance=1000,blue_balance=1500
v4l2-ctl --set-ctrl=brightness=50,contrast=15,saturation=0,horizontal_flip=1,vertical_flip=1,power_line_frequency=1,sharpness=0,color_effects=0,rotate=0,color_effects_cbcr=32896
v4l2-ctl --set-ctrl=auto_exposure=1,exposure_time_absolute=300,auto_exposure_bias=12,iso_sensitivity=1
v4l2-ctl -p 10
v4l2-ctl --overlay=1


I am able to adjust the red and blue gain on the fly. I can see the effect in the overlay, so this works.

However, when I take a picture using the following command:

Code: Select all
v4l2-ctl --stream-mmap=3 --stream-skip=2 --stream-to=/home/pi/test.yuv  --stream-count=4


The camera / overlay doesn't respond in an expected matter, (pictures and overlay suddenly all become very dark). It seems that the "contrast" reacts differently after taking a picture.

if I turn the contrast way down to -40 via the following command, the overlay image gets better (looks like it did before taking a picture).

Code: Select all
v4l2-ctl -c contrast=-40


The pictures look similar (taken with the command above) all look like the distorted (dark) overlay picture after taking the pictures.
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by racer993 » Wed Sep 09, 2015 12:04 pm
After a couple of days of intensive testing with the v4l2 driver I think I might have found the driver / firmware bug regarding the AWB:

The problem was that despite setting AWB to manual and red & blue gains at a specific value, the images I took seemed to ignore those settings.

Now I have found the following:

The AWB settings are correct if preview mode (overlay=1) is enabled when pictures are taken.

If preview mode (overlay=0) is disabled when pictures are taken the AWB mode defaults to "auto" it seems like.
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Wed Sep 09, 2015 5:14 pm
racer993 wrote:Now I have found the following:

The AWB settings are correct if preview mode (overlay=1) is enabled when pictures are taken.

If preview mode (overlay=0) is disabled when pictures are taken the AWB mode defaults to "auto" it seems like.

That sounds plausible. I'll try to find time to have a look. There's no reason why it shouldn't be setting AWB mode under those circumstances, but it drop through a different state machine path on the GPU side.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by byterg » Mon Sep 21, 2015 7:31 am
I confirm, AWB management work only with active overlay.
Code: Select all
~ # cat /proc/version
Linux version 3.18.16+ (kirill@kirill) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #23 PREEMPT Thu Aug 27 16:56:11 MSK 2015
Posts: 56
Joined: Tue Jul 15, 2014 8:16 am
by 6by9 » Mon Sep 21, 2015 8:57 am
byterg wrote:I confirm, AWB management work only with active overlay.
Code: Select all
~ # cat /proc/version
Linux version 3.18.16+ (kirill@kirill) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #23 PREEMPT Thu Aug 27 16:56:11 MSK 2015

I suspect that it will also work if the command is sent AFTER you have started streaming. It's going to be a state machine issue in the firmware where on enabling just the video capture port (output[1], which is what the V4L2 driver uses for all image captures), it doesn't prod the hardware with the manual AWB settings. If it already streaming for overlay, then the hardware is prodded immediately.

If you fancied trying it, recompile the driver with a call at the end of start_sttreaming that sets the AWB mode again. Otherwise I'll get around to looking at the firmware when I get a chance (this issue is on the list of things to fix already).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Mon Sep 21, 2015 2:12 pm
Hi 6x9,

just saw your post above regarding the AWB settings, but I'm afraid it is far above my head, changing the firmware and recompiling it (how do I do that?)

If there is some less advanced work that I could do (like testing) I would be happy to help out.

Just let me know how I can help.

Regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Mon Sep 21, 2015 3:40 pm
racer993 wrote:just saw your post above regarding the AWB settings, but I'm afraid it is far above my head, changing the firmware and recompiling it (how do I do that?)

If there is some less advanced work that I could do (like testing) I would be happy to help out.

Sorry, missed out a critical word
6by9 wrote:If you fancied trying it, recompile the V4L2 driver with a call at the end of start_streaming that sets the AWB mode again

You can't recompile the firmware, but you can recompile the kernel and hence the V4L2 driver.
The V4L2 driver lives in https://github.com/raspberrypi/linux/tr ... rm/bcm2835 and can be built by following the instructions on https://www.raspberrypi.org/documentati ... uilding.md
In bcm2835-camera.c you'll find a function called start_streaming which prods the GPU to start producing frames. In controls.c you'll find a function that sets the AWB mode (ctrl_set_awb_mode), and one to set the manual AWB gains (ctrl_set_awb_gains). A call from the first to both of the other two should trigger the desired result.

I will try to get around to fixing it properly when I get a chance, but my Pi time is limited.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Mon Sep 21, 2015 4:59 pm
Hi 6by9,

Your help is very much appreciated. I will give a it try tomorrow and let you know how it went.

Thank you for your support!

Regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by racer993 » Wed Sep 23, 2015 7:14 am
Hi 6x9,

I've looked at the bcm2835-camera.c and also found the functions ctrl_set_awb_gains and ctrl_set_awb_mode in controls.c

By looking at the code I reckon the calls could be inserted in row 510 where the process is waiting for the AWB to settle in case the preview is not enabled.

I'm not a programmer but more of an enthusiast end-user and I am stuck at writing the call to ctrl_set_awb_gains and ctrl_set_awb_mode from line 510 in bcm2835-camera.c .

I know Google is my friend, but I can't seem to work it out.

Maybe you could help me with the syntax of the call?

Kind regards,
R4C4R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Wed Sep 23, 2015 10:58 am
racer993 wrote:I've looked at the bcm2835-camera.c and also found the functions ctrl_set_awb_gains and ctrl_set_awb_mode in controls.c

By looking at the code I reckon the calls could be inserted in row 510 where the process is waiting for the AWB to settle in case the preview is not enabled.

I'm not a programmer but more of an enthusiast end-user and I am stuck at writing the call to ctrl_set_awb_gains and ctrl_set_awb_mode from line 510 in bcm2835-camera.c .

I know Google is my friend, but I can't seem to work it out.

Maybe you could help me with the syntax of the call?

I hadn't looked in detail but suspected it wasn't quite as easy as all that due to the split of structures and data between bcm2835-camera.c, controls.c, and the V4L2 framework.

Probably the easiest way is to create a new function in controls.c that is a copy of bm2835_mmal_set_all_camera_controls, but amend to read:
Code: Select all
   for (c = 0; c < V4L2_CTRL_COUNT; c++) {
      if ((dev->ctrls[c]) && (v4l2_ctrls[c].setter) && (v4l2_ctrls[c].id == V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE || v4l2_ctrls[c].id==V4L2_CID_RED_BALANCE || v4l2_ctrls[c].id==V4L2_CID_BLUE_BALANCE) {

Call that from the end of start_streaming() (you'll need to add a function prototype to bcm2835-camera.h too).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Wed Sep 23, 2015 3:58 pm
Hi 6x9,

Thank you for the input. I have amended the files in the following way.

1) created a new function in controls.c called bm2835_mmal_set_all_camera_controls2

Code: Select all

int bm2835_mmal_set_all_camera_controls2(struct bm2835_mmal_dev *dev)
{
   int c;
   int ret = 0;

   for (c = 0; c < V4L2_CTRL_COUNT; c++) {
      if ((dev->ctrls[c]) && (v4l2_ctrls[c].setter) && (v4l2_ctrls[c].id == V4L2_CID_AUTO_N_PRESET_WHITE_BALANCE || v4l2_ctrls[c].id==V4L2_CID_RED_BALANCE || v4l2_ctrls[c].id==V4L2_CID_BLUE_BALANCE) {
            ret = v4l2_ctrls[c].setter(dev, dev->ctrls[c],
                     &v4l2_ctrls[c]);
         if (!v4l2_ctrls[c].ignore_errors && ret) {
            v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
               "Failed when setting default values for ctrl %d\n",
               c);
            break;
         }
      }
   }
   return ret;
}


2) created a prototype in bcm2835-camera.h

Code: Select all
int bm2835_mmal_set_all_camera_controls2(struct bm2835_mmal_dev *dev);


3) made a call from the end of start_streaming() in bcm2835-camera.c

Code: Select all
/* set AWB & gains */
ret = bm2835_mmal_set_all_camera_controls2(dev);


At the moment I'm compiling on the Raspberry Pi

I am not sure whether I did this right, I'm not a programmer, did I make the correct changes?

Regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Wed Sep 23, 2015 4:38 pm
racer993 wrote:I am not sure whether I did this right, I'm not a programmer, did I make the correct changes?

If I were code reviewing it I'd object at the function name bm2835_mmal_set_all_camera_controls2 because it isn't accurate, but otherwise that should do the trick.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Thu Sep 24, 2015 8:15 am
Hi 6by9,

Just to keep you updated on the progress.

Last night I made a first compilation but it exited due to a typo in the code. I restarted last night and it finished needly.

This morning I took some tests, but for the test I needed some additional software and performed an apt-get update, apt-get upgrade and did the tests.

The results were unchanged from before. When overlay is used the AWB settings are applied, when I turn the overlay off, the AWB seems to default to "auto".

I'm afraid that doing the apt-get update / apt-get upgrade after the compilation maybe messed up the test. So I just started recompiling again (which takes a couple of hours on the Pi). I know cross compilation is an option, but I haven't tried that yet. For now, I just want to make sure I'm doing the right things right.

Here are some examples from the test that I took:

v4l2-ctl --overlay=1, the picture looks as expected

test2.jpg
Picture taken with overlay on
test2.jpg (51.6 KiB) Viewed 2159 times


v4l2-ctl --overlay=0, the white in the picture turned yellow due to automatic AWB, despite setting being manual

test4.jpg
Picture taken with overlay off
test4.jpg (55.86 KiB) Viewed 2159 times


in both cases, these were the settings that were used:

Status Log:
Code: Select all
Status Log:

   [ 3959.597384] bcm2835-v4l2: =================  START STATUS  =================
   [ 3959.597415] bcm2835-v4l2: Saturation: 0
   [ 3959.597433] bcm2835-v4l2: Sharpness: 0
   [ 3959.597445] bcm2835-v4l2: Contrast: 15
   [ 3959.597457] bcm2835-v4l2: Brightness: 50
   [ 3959.597468] bcm2835-v4l2: ISO Sensitivity: 100
   [ 3959.597480] bcm2835-v4l2: Image Stabilization: false
   [ 3959.597491] bcm2835-v4l2: Auto Exposure: Manual Mode
   [ 3959.597503] bcm2835-v4l2: Exposure Time, Absolute: 250
   [ 3959.597515] bcm2835-v4l2: Auto Exposure, Bias: 0
   [ 3959.597526] bcm2835-v4l2: Exposure, Dynamic Framerate: false
   [ 3959.597538] bcm2835-v4l2: Exposure, Metering Mode: Average
   [ 3959.597550] bcm2835-v4l2: White Balance, Auto & Preset: Manual
   [ 3959.597562] bcm2835-v4l2: Red Balance: 1320
   [ 3959.597574] bcm2835-v4l2: Blue Balance: 1400
   [ 3959.597585] bcm2835-v4l2: Color Effects: None
   [ 3959.597597] bcm2835-v4l2: Color Effects, CbCr: 32896
   [ 3959.597609] bcm2835-v4l2: Rotate: 0
   [ 3959.597620] bcm2835-v4l2: Horizontal Flip: true
   [ 3959.597631] bcm2835-v4l2: Vertical Flip: true
   [ 3959.597643] bcm2835-v4l2: Video Bitrate Mode: Variable Bitrate
   [ 3959.597655] bcm2835-v4l2: Video Bitrate: 10000000
   [ 3959.597667] bcm2835-v4l2: Compression Quality: 30
   [ 3959.597679] bcm2835-v4l2: Power Line Frequency: 50 Hz
   [ 3959.597690] bcm2835-v4l2: Repeat Sequence Header: false
   [ 3959.597703] bcm2835-v4l2: H264 Profile: High
   [ 3959.597714] bcm2835-v4l2: H264 Level: 4
   [ 3959.597726] bcm2835-v4l2: Scene Mode: None
   [ 3959.597738] bcm2835-v4l2: H264 I-Frame Period: 60
   [ 3959.597751] bcm2835-v4l2: ==================  END STATUS  ==================
Last edited by racer993 on Fri Oct 02, 2015 4:54 pm, edited 1 time in total.
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by racer993 » Thu Sep 24, 2015 12:55 pm
Hi 6by9,

Just finished compiling again and conducted some tests, but unfortunately the results haven't changed :(

What else can I do?

Regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by racer993 » Mon Oct 05, 2015 9:31 am
Just for anyone that might be interested: I downloaded and installed the new Raspbian Image based on Jessie (and was secretly hoping the AWB bug was fixed). Although the AWB bug still persists, the AWB algorithm seems to have changed in a positive way.

The pictures I took today of the blue & white test image didn't turn yellow anymore.

Previously the pictures looked like this

OLD.jpg
OLD.jpg (62.43 KiB) Viewed 1963 times


Now, with the same settings it looks like this

NEW.jpg
NEW.jpg (36.99 KiB) Viewed 1963 times


Code: Select all
   [ 8081.920467] bcm2835-v4l2: =================  START STATUS  =================
   [ 8081.920491] bcm2835-v4l2: Saturation: 0
   [ 8081.920506] bcm2835-v4l2: Sharpness: 0
   [ 8081.920518] bcm2835-v4l2: Contrast: 15
   [ 8081.920529] bcm2835-v4l2: Brightness: 50
   [ 8081.920540] bcm2835-v4l2: ISO Sensitivity: 100
   [ 8081.920552] bcm2835-v4l2: Image Stabilization: false
   [ 8081.920563] bcm2835-v4l2: Auto Exposure: Manual Mode
   [ 8081.920575] bcm2835-v4l2: Exposure Time, Absolute: 250
   [ 8081.920587] bcm2835-v4l2: Auto Exposure, Bias: 0
   [ 8081.920598] bcm2835-v4l2: Exposure, Dynamic Framerate: false
   [ 8081.920609] bcm2835-v4l2: Exposure, Metering Mode: Average
   [ 8081.920621] bcm2835-v4l2: White Balance, Auto & Preset: Manual
   [ 8081.920632] bcm2835-v4l2: Red Balance: 1320
   [ 8081.920643] bcm2835-v4l2: Blue Balance: 1400
   [ 8081.920655] bcm2835-v4l2: Color Effects: None
   [ 8081.920666] bcm2835-v4l2: Color Effects, CbCr: 32896
   [ 8081.920677] bcm2835-v4l2: Rotate: 0
   [ 8081.920688] bcm2835-v4l2: Horizontal Flip: true
   [ 8081.920699] bcm2835-v4l2: Vertical Flip: true
   [ 8081.920710] bcm2835-v4l2: Video Bitrate Mode: Variable Bitrate
   [ 8081.920722] bcm2835-v4l2: Video Bitrate: 10000000
   [ 8081.920734] bcm2835-v4l2: Compression Quality: 30
   [ 8081.920745] bcm2835-v4l2: Power Line Frequency: 50 Hz
   [ 8081.920756] bcm2835-v4l2: Repeat Sequence Header: false
   [ 8081.920767] bcm2835-v4l2: H264 Profile: High
   [ 8081.920778] bcm2835-v4l2: H264 Level: 4
   [ 8081.920790] bcm2835-v4l2: Scene Mode: None
   [ 8081.920801] bcm2835-v4l2: H264 I-Frame Period: 60
   [ 8081.920813] bcm2835-v4l2: ==================  END STATUS  ==================


How do I know the AWB bug still exists? If I set e.g. the red_gain to 4000 the picture still looks like the one above but I would expect it to look like the one below

RED.jpg
RED.jpg (32.14 KiB) Viewed 1963 times


Code: Select all
.....
   [ 9616.410784] bcm2835-v4l2: White Balance, Auto & Preset: Manual
   [ 9616.410795] bcm2835-v4l2: Red Balance: 4000
   [ 9616.410807] bcm2835-v4l2: Blue Balance: 1400
.....
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by 6by9 » Mon Oct 05, 2015 10:19 am
racer993 wrote:Just for anyone that might be interested: I downloaded and installed the new Raspbian Image based on Jessie (and was secretly hoping the AWB bug was fixed). Although the AWB bug still persists, the AWB algorithm seems to have changed in a positive way.

Wheezy and Jessie are just variants of the distro (ie application packages). They both use the same kernel and the same GPU firmware.
There have been no changes to the AWB algorithm or the tuning, so I suspect the sensor is seeing a slightly different scene and making a different guess on AWB settings. I know it is frustrating it not being fixed, but I can't magic up spare time.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.
by racer993 » Mon Oct 05, 2015 3:03 pm
Hello 6by9,

Thank you for your comment, I am sorry if I came across a bit pushy, it was not my intention. I just wanted to share the results from the test that I did and in my enthousiasm I've probably jumped too quickly to conclusions in the experiment. I have just repeated the experiment and the "yellow" pictures are back again. The difference with this morning (very sunny) is that there is very little sunlight in the room now (overcast weather) and my guess is that that might have played a significant role.

Regards,
R4C3R
Posts: 41
Joined: Mon Feb 18, 2013 7:27 pm
by FHF » Tue Oct 20, 2015 10:18 pm
Hi, so when I try to run the viewfinder commands I get a very blurry image. Is this an indication that the driver didn't install correctly or what?

Also, when I try to run a basic opencv c++ program that just captures video, I get this error

VIDIOC_QUERYMENU: Invalid argument

So what's going on?

Thanks!
Posts: 1
Joined: Tue Oct 20, 2015 10:08 pm
by 6by9 » Wed Oct 21, 2015 9:22 pm
FHF wrote:Hi, so when I try to run the viewfinder commands I get a very blurry image. Is this an indication that the driver didn't install correctly or what?

Is the image the same as when you run raspistill or raspivd? Eliminate it being a hardware fault before looking for software issues.
FHF wrote:Also, when I try to run a basic opencv c++ program that just captures video, I get this error

VIDIOC_QUERYMENU: Invalid argument

So what's going on?

Please try the little search box at the top of the main forum page saying "Search this forum" before posting. Putting VIDIOC_QUERYMENU in there - you get 10 hits (11 now including this post), all related to OpenCV and this error.
Follow https://www.raspberrypi.org/forums/view ... 43&t=65026 and you'll find that updates were already made to OpenCV to fix the issue as it is incorrect behaviour by OpenCV - you don't say what version of OpenCV you're using, but I'd guess it is just out of date.

I also made comment at https://www.raspberrypi.org/forums/view ... 70#p479127 that it was selecting a resolution of 64x32 - that will look very pixelated and potentially blurry as it is a stupidly low resolution. I haven't seen any update on that, but I'm assuming someone has fixed it.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4002
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.