6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Tue Jun 23, 2015 6:19 pm

Patch just released that corrects the digital gain initialisation.
sudo rpi-update to get it for those wanting to test.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ethanol100
Posts: 663
Joined: Wed Oct 02, 2013 12:28 pm

Re: Remove metering

Wed Jul 01, 2015 9:27 am

6by9 wrote:Patch just released that corrects the digital gain initialisation.
sudo rpi-update to get it for those wanting to test.
Thanks for the patch! Now the gains are both set to 1 if exposure mode is initial set to MMAL_PARAM_EXPOSUREMODE_OFF. And the exposure time is set to ~10ms if not specified. It works for both raspistill and raspivid. I think it is now a really useful feature.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Wed Jul 01, 2015 10:54 am

I know ISO doesn't work though. I don't want to have to duplicate lots of code to compute A & D gains from ISO values, but also getting it to run the once on a change of ISO isn't simple.
What I might look at doing is exposing the default digital gain value that will be set if we hit this condition of needing to set defaults. I might be able to expose analogue gain too, but other things are occupying my time at present.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Pidestrian
Posts: 3
Joined: Mon Mar 30, 2015 10:43 am

Re: Remove metering

Thu Jul 02, 2015 11:49 am

Hi, I updated the firmware and tried to run

raspivid -k -t 0 -ex off -ss 10000 -set

however the exposure mode "off" is not found.

"RaspiVid: Unknown exposure mode: off"

Have i missed something?
The patch is applied to the firmware itself? So in case that I use my own code to interface with the camera and set the exposure mode with :
mmal_port_parameter_set (...)
the camera will now have fixed analog /digital gains?

Is it possible to set those gains manually?
Are these gain values related to AWB gains?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Thu Jul 02, 2015 12:36 pm

-ex off was removed (or never added) due to this bug existing in the first place. Someone needs to create a patch and make a pull request for it to get merged into the main userland repo now that the bug is (hopefully) fixed).
I think it should be as simple as

Code: Select all

diff --git a/host_applications/linux/apps/raspicam/RaspiCamControl.c b/host_applications/linux/apps/raspicam/RaspiCamControl.c
index 1f4e8b7..3d0157c 100755
--- a/host_applications/linux/apps/raspicam/RaspiCamControl.c
+++ b/host_applications/linux/apps/raspicam/RaspiCamControl.c
@@ -55,7 +55,8 @@ static XREF_T  exposure_map[] =
    {"verylong",      MMAL_PARAM_EXPOSUREMODE_VERYLONG},
    {"fixedfps",      MMAL_PARAM_EXPOSUREMODE_FIXEDFPS},
    {"antishake",     MMAL_PARAM_EXPOSUREMODE_ANTISHAKE},
-   {"fireworks",     MMAL_PARAM_EXPOSUREMODE_FIREWORKS}
+   {"fireworks",     MMAL_PARAM_EXPOSUREMODE_FIREWORKS},
+   {"off",           MMAL_PARAM_EXPOSUREMODE_OFF}
 };
and then use "-ex off" on the command line, but I'm not in a place to test it at the moment. ethanol100 appears to have tested it, so I guess he already has a patch that he could push.

This is purely setting analogue and overall digital gains for AE/AGC control. Set exposure mode off at start, and you will get both set to x1.0. At present it is not possible to get user specified values - that is my comment about ISO not working.

AWB gains can already be specified by setting awb mode to off, and using -awbg to set the desired red and blue gains. Covered originally under viewtopic.php?f=43&t=58803&start=75#p525733
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

ethanol100
Posts: 663
Joined: Wed Oct 02, 2013 12:28 pm

Re: Remove metering

Thu Jul 02, 2015 12:59 pm

6by9 wrote:ethanol100 appears to have tested it, so I guess he already has a patch that he could push.
Yes it is only the one additional entry and there is still the pull request https://github.com/raspberrypi/userland/pull/171 which could now be accepted.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Thu Jul 02, 2015 1:23 pm

ethanol100 wrote:
6by9 wrote:ethanol100 appears to have tested it, so I guess he already has a patch that he could push.
Yes it is only the one additional entry and there is still the pull request https://github.com/raspberrypi/userland/pull/171 which could now be accepted.
Thanks. I've just commented on that PR and pinged popcornmix and Jamesh.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
waveform80
Posts: 360
Joined: Mon Sep 23, 2013 1:28 pm
Location: Manchester, UK
Contact: Website Twitter

Re: Remove metering

Tue Jul 28, 2015 7:24 am

ethanol100 wrote:
6by9 wrote:Patch just released that corrects the digital gain initialisation.
sudo rpi-update to get it for those wanting to test.
Thanks for the patch! Now the gains are both set to 1 if exposure mode is initial set to MMAL_PARAM_EXPOSUREMODE_OFF. And the exposure time is set to ~10ms if not specified. It works for both raspistill and raspivid. I think it is now a really useful feature.
Fantastic news! Only just saw this, but many thanks to everyone involved - this'll come in very handy in future :)


Dave.
Author of / contributor to a few pi related things (picamera, Sense HAT emulator, gpio-zero, piwheels, etc.), and currently a software engineer at Canonical responsible for Ubuntu Server and Core on the Raspberry Pi.

Joan Carles
Posts: 23
Joined: Fri Jun 13, 2014 10:22 am

Re: Remove metering

Fri Oct 16, 2015 5:21 pm

I did it, it's working fantastic!!!

Thank you so much!!!!

User avatar
jbeale
Posts: 3755
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Remove metering

Fri Oct 16, 2015 7:49 pm

I look forward to trying this- true fixed gain makes the difference between "useful" and "not useful" in a lot of measurement applications.

namorK
Posts: 16
Joined: Wed Dec 02, 2015 9:34 am

Re: Remove metering

Wed Dec 02, 2015 11:12 am

dear all. i'm also trying to get rid off auto exposure and i'm confused if "-ex off" is now implemented in the official raspbian wheezy mai 2015, of if i need to do the patch described in the thread. thanks for any help.

(raspivid -o b-h264 -w 1920 -h 1080 -ex off -awb sun -fps 25 -ISO 100 -ss 2500 -sh -100 -b 750000 -t 21600000)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Wed Dec 02, 2015 11:52 am

namorK wrote:dear all. i'm also trying to get rid off auto exposure and i'm confused if "-ex off" is now implemented in the official raspbian wheezy mai 2015, of if i need to do the patch described in the thread. thanks for any help.

(raspivid -o b-h264 -w 1920 -h 1080 -ex off -awb sun -fps 25 -ISO 100 -ss 2500 -sh -100 -b 750000 -t 21600000)
https://github.com/raspberrypi/userland/pull/171 (referenced earlier) was merged 2 July, so as long as your Pi is running a more recent release then yes it is there.
Add -set to your command and it will print out shutter speed and gains used.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

namorK
Posts: 16
Joined: Wed Dec 02, 2015 9:34 am

Re: Remove metering

Wed Dec 02, 2015 12:22 pm

thank you very much!

namorK
Posts: 16
Joined: Wed Dec 02, 2015 9:34 am

Re: Remove metering

Thu Dec 03, 2015 6:12 pm

Add -set to your command and it will print out shutter speed and gains used.
dear 6by9. thanks a lot. i couldn't find out where the -set command is documented and how to get it to work. could you elaborate a little how to see the gain used while video capturing?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 10580
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Remove metering

Thu Dec 03, 2015 8:20 pm

namorK wrote:
Add -set to your command and it will print out shutter speed and gains used.
dear 6by9. thanks a lot. i couldn't find out where the -set command is documented and how to get it to work. could you elaborate a little how to see the gain used while video capturing?
Er, literally add "-set" to the end of your command, so based on what you quoted it'll end up as

Code: Select all

raspivid -o b-h264 -w 1920 -h 1080 -ex off -awb sun -fps 25 -ISO 100 -ss 2500 -sh -100 -b 750000 -t 21600000 -set
For me, I get

Code: Select all

pi@raspberrypi ~ $ raspivid -o b-h264 -w 1920 -h 1080 -ex off -awb sun -fps 25 -ISO 100 -ss 2500 -sh -100 -b 750000 -t 21600000 -set
RaspiVid: Unknown exposure mode: off
mmal: Exposure now 9985, analog gain 256/256, digital gain 0/256
mmal: AWB R=0/256, B=0/256
mmal: Exposure now 2500, analog gain 304/256, digital gain 601/256
mmal: AWB R=428/256, B=284/256
mmal: Exposure now 2500, analog gain 304/256, digital gain 429/256
mmal: AWB R=428/256, B=284/256
...
Ignore the error on unknown exposure mode - I'm on an old raspivid as I was working on something else.

Documentation: run "raspivid --help"

Code: Select all

pi@raspberrypi ~ $ raspivid --help
Display camera output to display, and optionally saves an H264 capture at requested bitrate
usage: raspivid [options]

Image parameter commands
-?, --help      : This help information
...
-cs, --camselect        : Select camera <number>. Default 0
-set, --settings        : Retrieve camera settings and write to stdout
-md, --mode     : Force sensor mode. 0=auto. See docs for other modes available
...
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”