Setting Manual Exposure in GStreamer pipeline

Could someone review my pipeline string that I’m using in python and opencv with an IMX219 camera? I am attempting to adjust exposure using analog gain, but it doesn’t seem that the gain will affect the actual exposure of the image. When I set gain to 1 1 and 10.625 10.625 (The max value for this sensor) there seems to be a difference in the amount of noise in the image but the exposure is the same.

gst-launch-1.0 nvarguscamerasrc sensor-id=0 awblock=true wbmode=0 exposuretimerange="358733008 358733008" ispdigitalgainrange="1 1" gainrange="1 1" aelock=true ! "video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)20/1" ! nvvidconv flip-method=2 ! "video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080" ! nvoverlaysink

and

gst-launch-1.0 nvarguscamerasrc sensor-id=0 awblock=true wbmode=0 exposuretimerange="358733008 358733008" ispdigitalgainrange="1 1" gainrange="10.625 10.625" aelock=true ! "video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)20/1" ! nvvidconv flip-method=2 ! "video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080" ! nvoverlaysink

seem to result in the same exposure, only a different in noise.

Here is the resule of gst-inspect-1.0 nvarguscamerasrc:

Factory Details:
  Rank                     primary (256)
  Long-name                NvArgusCameraSrc
  Klass                    Video/Capture
  Description              nVidia ARGUS Camera Source
  Author                   Viranjan Pagar <vpagar@nvidia.com>, Amit Pandya <apandya@nvidia.com>

Plugin Details:
  Name                     nvarguscamerasrc
  Description              nVidia ARGUS Source Component
  Filename                 /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvarguscamerasrc.so
  Version                  1.0.0
  License                  Proprietary
  Source module            nvarguscamerasrc
  Binary package           NvARGUSCameraSrc
  Origin URL               http://nvidia.com/

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstNvArgusCameraSrc

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-raw(memory:NVMM)
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
                 format: { (string)NV12, (string)P010_10LE }
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "nvarguscamerasrc0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  blocksize           : Size in bytes to read per buffer (-1 = default)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 4096 
  num-buffers         : Number of buffers to output before sending EOS (-1 = unlimited)
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  typefind            : Run typefind before negotiating (deprecated, non-functional)
                        flags: readable, writable, deprecated
                        Boolean. Default: false
  do-timestamp        : Apply current stream time to buffers
                        flags: readable, writable
                        Boolean. Default: true
  silent              : Produce verbose output ?
                        flags: readable, writable
                        Boolean. Default: true
  timeout             : timeout to capture in seconds (Either specify timeout or num-buffers, not both)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 2147483647 Default: 0 
  wbmode              : White balance affects the color temperature of the photo
                        flags: readable, writable
                        Enum "GstNvArgusCamWBMode" Default: 1, "auto"
                           (0): off              - GST_NVCAM_WB_MODE_OFF
                           (1): auto             - GST_NVCAM_WB_MODE_AUTO
                           (2): incandescent     - GST_NVCAM_WB_MODE_INCANDESCENT
                           (3): fluorescent      - GST_NVCAM_WB_MODE_FLUORESCENT
                           (4): warm-fluorescent - GST_NVCAM_WB_MODE_WARM_FLUORESCENT
                           (5): daylight         - GST_NVCAM_WB_MODE_DAYLIGHT
                           (6): cloudy-daylight  - GST_NVCAM_WB_MODE_CLOUDY_DAYLIGHT
                           (7): twilight         - GST_NVCAM_WB_MODE_TWILIGHT
                           (8): shade            - GST_NVCAM_WB_MODE_SHADE
                           (9): manual           - GST_NVCAM_WB_MODE_MANUAL
  saturation          : Property to adjust saturation value
                        flags: readable, writable
                        Float. Range:               0 -               2 Default:               1 
  sensor-id           : Set the id of camera sensor to use. Default 0.
                        flags: readable, writable
                        Integer. Range: 0 - 255 Default: 0 
  sensor-mode         : Set the camera sensor mode to use. Default -1 (Select the best match)
                        flags: readable, writable
                        Integer. Range: -1 - 255 Default: -1 
  total-sensor-modes  : Query the number of sensor modes available. Default 0
                        flags: readable
                        Integer. Range: 0 - 255 Default: 0 
  exposuretimerange   : Property to adjust exposure time range in nanoseconds
			Use string with values of Exposure Time Range (low, high)
			in that order, to set the property.
			eg: exposuretimerange="34000 358733000"
                        flags: readable, writable
                        String. Default: null
  gainrange           : Property to adjust gain range
			Use string with values of Gain Time Range (low, high)
			in that order, to set the property.
			eg: gainrange="1 16"
                        flags: readable, writable
                        String. Default: null
  ispdigitalgainrange : Property to adjust digital gain range
			Use string with values of ISP Digital Gain Range (low, high)
			in that order, to set the property.
			eg: ispdigitalgainrange="1 8"
                        flags: readable, writable
                        String. Default: null
  tnr-strength        : property to adjust temporal noise reduction strength
                        flags: readable, writable
                        Float. Range:              -1 -               1 Default:              -1 
  tnr-mode            : property to select temporal noise reduction mode
                        flags: readable, writable
                        Enum "GstNvArgusCamTNRMode" Default: 1, "NoiseReduction_Fast"
                           (0): NoiseReduction_Off - GST_NVCAM_NR_OFF
                           (1): NoiseReduction_Fast - GST_NVCAM_NR_FAST
                           (2): NoiseReduction_HighQuality - GST_NVCAM_NR_HIGHQUALITY
  ee-mode             : property to select edge enhnacement mode
                        flags: readable, writable
                        Enum "GstNvArgusCamEEMode" Default: 1, "EdgeEnhancement_Fast"
                           (0): EdgeEnhancement_Off - GST_NVCAM_EE_OFF
                           (1): EdgeEnhancement_Fast - GST_NVCAM_EE_FAST
                           (2): EdgeEnhancement_HighQuality - GST_NVCAM_EE_HIGHQUALITY
  ee-strength         : property to adjust edge enhancement strength
                        flags: readable, writable
                        Float. Range:              -1 -               1 Default:              -1 
  aeantibanding       : property to set the auto exposure antibanding mode
                        flags: readable, writable
                        Enum "GstNvArgusCamAeAntiBandingMode" Default: 1, "AeAntibandingMode_Auto"
                           (0): AeAntibandingMode_Off - GST_NVCAM_AEANTIBANDING_OFF
                           (1): AeAntibandingMode_Auto - GST_NVCAM_AEANTIBANDING_AUTO
                           (2): AeAntibandingMode_50HZ - GST_NVCAM_AEANTIBANDING_50HZ
                           (3): AeAntibandingMode_60HZ - GST_NVCAM_AEANTIBANDING_60HZ
  exposurecompensation: property to adjust exposure compensation
                        flags: readable, writable
                        Float. Range:              -2 -               2 Default:               0 
  aelock              : set or unset the auto exposure lock
                        flags: readable, writable
                        Boolean. Default: false
  aeregion            : Property to set region of interest for auto exposure
			with values of ROI coordinates (left, top, right, bottom)
			and weight (float number) in that order, to set the property
			use for example: aeregion="0 0 256 256 1"
                        flags: readable, writable
                        String. Default: null
  awblock             : set or unset the auto white balance lock
                        flags: readable, writable
                        Boolean. Default: false
  bufapi-version      : set to use new Buffer API
                        flags: readable, writable
                        Boolean. Default: false

Doesn’t see any problem in the command line.
What’s the platform and BSP version?

Please remove aelock=true to verify.

Removing aelock = true seems to make the exposure vary. (I want a fixed exposure time and gain setting).

Using cat /etc/nv_tegra_release I get # R32 (release), REVISION: 7.1, GCID: 29818004, BOARD: t210ref, EABI: aarch64, DATE: Sat Feb 19 17:05:08 UTC 2022.

Here are screenshots using the two different pipelines:

As you can see, there is a noticeable difference in noise (so the gain is changing) but the two images should theoretically be at least 3 stops different with ISO 100 vs 1062.5 (or gain settings 1 to 10.625).

On second test, it seems that the difference is much more apparent with faster exposure times. Is this expected? Is there an easy way to change the max-gain value the camera driver and streamer supports?

That’s could be the sensor gain capability.
Increase the exposure get more brightness is expected.
You can increase exposure/gain combination for better image due to increase gain get more noise is expected.

Yes, I am only looking to increase gain and keep the exposure time the same. Seems that 10.625 is the maximum gain capability of the sensor. I updated gstreamer to use a max gain value of 64 and updated kernel/device-tree to allow for setting gain to 64, but the additional gain does not seem to increase brightness of the image. Interestingly, pushing the sensor beyond it’s capability actually makes the image darker.

gain at 64 and 10.625:

Seems like I just need a sensor with a higher maximum gain. Thank you!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.