Setting exposure for Webcam doesn’t work with DeepStream 5.0

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting exposure for Webcam doesn’t work with DeepStream 5.0

Aswin
Hi ,

I am building a G streamer pipeline for YOLO on Nvidia Jetson Nano.

This pipeline uses live feed captured through USB WEBCAM as input.

I need to operate the feed at a specific exposure setting.

I have changed the exposure settings as follows :

FROM :

*caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
framerate=30/1”))
caps_vidconvsrc.set_property(‘caps’,
Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))
*

TO :

*caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
framerate=(fraction)30/1, auto-exposure=(int)1,
exposure-time=(double)166.66999999999999, width=(int)640, height=(int)480”))
caps_vidconvsrc.set_property(‘caps’,
Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))*

I have verified this change in the pipeline in the following way :

*print(“Exposure Mode :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘auto-exposure’))
print(“Exposure Time :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘exposure-time’))
print(“Frame Width :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘width’))
print(“Frame Height :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘height’))
print(“Frame Rate :”,
caps.get_property(‘caps’).get_structure(0).get_fraction(‘framerate’))*

This results as follows :

*Exposure Mode : 1
Exposure Time : 166.67
Frame Width : 640
Frame Height : 480
Frame Rate : (True, value_numerator=30, value_denominator=1)*


The pipeline produces 29 FPS with lights turned on.

When the lights are turned off or camera is covered in such a way to block
lights, FPS reduces to 15.

/This indicates that EXPOSURE change/setting has not happened in the
gstreamer./

/But i am able to successfully set the exposure setting using opencv in
python on the same camera./

Any possible guide on how to control the EXPOSURE, WIDTH, HEIGHT in the
pipeline ?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure for Webcam doesn’t work with DeepStream 5.0

Olivier Crête-3
Hello,

This is specific to NVidia's proprietary elements, so you should contact them about this.

Olivier

On Mon, 2021-02-01 at 22:16 -0600, Aswin wrote:
Hi ,

I am building a G streamer pipeline for YOLO on Nvidia Jetson Nano.

This pipeline uses live feed captured through USB WEBCAM as input.

I need to operate the feed at a specific exposure setting.

I have changed the exposure settings as follows :

FROM :

*caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
framerate=30/1”))
caps_vidconvsrc.set_property(‘caps’,
Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))
*

TO :

*caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
framerate=(fraction)30/1, auto-exposure=(int)1,
exposure-time=(double)166.66999999999999, width=(int)640, height=(int)480”))
caps_vidconvsrc.set_property(‘caps’,
Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))*

I have verified this change in the pipeline in the following way :

*print(“Exposure Mode :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘auto-exposure’))
print(“Exposure Time :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘exposure-time’))
print(“Frame Width :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘width’))
print(“Frame Height :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘height’))
print(“Frame Rate :”,
caps.get_property(‘caps’).get_structure(0).get_fraction(‘framerate’))*

This results as follows :

*Exposure Mode : 1
Exposure Time : 166.67
Frame Width : 640
Frame Height : 480
Frame Rate : (True, value_numerator=30, value_denominator=1)*


The pipeline produces 29 FPS with lights turned on.

When the lights are turned off or camera is covered in such a way to block
lights, FPS reduces to 15.

/This indicates that EXPOSURE change/setting has not happened in the
gstreamer./

/But i am able to successfully set the exposure setting using opencv in
python on the same camera./

Any possible guide on how to control the EXPOSURE, WIDTH, HEIGHT in the
pipeline ?



--
_______________________________________________
gstreamer-devel mailing list

-- 
Olivier Crête


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting exposure for Webcam doesn’t work with DeepStream 5.0

Nicolas Dufresne-5
In reply to this post by Aswin
Le lundi 01 février 2021 à 22:16 -0600, Aswin a écrit :

> Hi ,
>
> I am building a G streamer pipeline for YOLO on Nvidia Jetson Nano.
>
> This pipeline uses live feed captured through USB WEBCAM as input.
>
> I need to operate the feed at a specific exposure setting.
>
> I have changed the exposure settings as follows :
>
> FROM :
>
> *caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
> framerate=30/1”))
> caps_vidconvsrc.set_property(‘caps’,
> Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))
> *
>
> TO :
>
> *caps_v4l2src.set_property(‘caps’, Gst.Caps.from_string(“video/x-raw,
> framerate=(fraction)30/1, auto-exposure=(int)1,
> exposure-time=(double)166.66999999999999, width=(int)640, height=(int)480”))
> caps_vidconvsrc.set_property(‘caps’,
> Gst.Caps.from_string(“video/x-raw(memory:NVMM)”))*
>
> I have verified this change in the pipeline in the following way :
>
> *print(“Exposure Mode :”,
> caps.get_property(‘caps’).get_structure(0).get_value(‘auto-exposure’))
> print(“Exposure Time :”,
> caps.get_property(‘caps’).get_structure(0).get_value(‘exposure-time’))

These two caps field have no meaning (at least in the upstream version of
GStreamer). For UVC drivers, these are often found as v4l2 controls. Here's en
example of controls list on my laptop webcam:

  v4l2-ctl -d /dev/video0 -L
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=64 value=64
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=90 max=150 step=1 default=120 value=120
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=2
                                0: Disabled
                                1: 50 Hz
                                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4000 value=4000 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=7 step=1 default=2 value=2
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=1 value=1
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
                                1: Manual Mode
                                3: Aperture Priority Mode
              exposure_absolute 0x009a0902 (int)    : min=4 max=1250 step=1 default=156 value=156 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1

In GStreamer we allow changing these value usign the same control name mangling
as v4l2-ctl uses. This is done through a special property called extra-controls.
It is special since GStreamer is not aware of the specific controls supported by
your hardware (not all UVC camera have the same controls). You can configure the
expose like this:

  v4l2src extra-controls=s,exposure_auto=1,exposure_absolute=167 ! ...

Hope this is useful, I'm not aware of what the exposure_absolute units are.
Perhaps this is in V4L2 or UVC documentation.


print(“Frame Width :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘width’))
print(“Frame Height :”,
caps.get_property(‘caps’).get_structure(0).get_value(‘height’))
print(“Frame Rate :”,
caps.get_property(‘caps’).get_structure(0).get_fraction(‘framerate’))*

This results as follows :

*Exposure Mode : 1
Exposure Time : 166.67
Frame Width : 640
Frame Height : 480
Frame Rate : (True, value_numerator=30, value_denominator=1)*


The pipeline produces 29 FPS with lights turned on.

When the lights are turned off or camera is covered in such a way to block
lights, FPS reduces to 15.

/This indicates that EXPOSURE change/setting has not happened in the
gstreamer./

/But i am able to successfully set the exposure setting using opencv in
python on the same camera./

Any possible guide on how to control the EXPOSURE, WIDTH, HEIGHT in the
pipeline ?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel