How to retrieve the metadata of CSI camera frame

I am trying to get basic metadata of captured frame. I am using raspberry v2 NOIR camera (IMX219) through gstreamer-1.0 with nvarguscamerasrc and opencv videocapture object.

I want the exposure time, ISO, digital/analog gain, exposure compensation, white balance, etc.
I tried using the opencv videocapture properties, but it gave a not supported error.

What is the syntax to read these values in gstreamer pipeline?

I don’t think nvarguscamerasrc can do it. You may need to implement argus APP for it.
Below are the argus API for referecing.

I’ll give it a try and let you know if I am able to use it.

Although, the gst-inspect of nvarguscamerasrc specifies that these properties are readable and writable, that is why I want to try and figure it out

You can check the nvgstcapture-1.0 for read/write them.
Also you can download the source code for reference.

1 Like

Can you send me one example command where the exposure time is read? I am not clear on the syntax and I can’t find the examples online.

You can just run the nvgstcapture-1.0 --help for more information.
And the source code can download from below link.

I have already tried out nvgstcapture-1.0

In the help, setting properties syntax is explained, getting properties syntax is not:

" --exposuretimerange Property to adjust exposure time range in nanoseconds e.g., --exposuretimerange=“34000 358733000” "

If I try without giving an empty range " ", nothing happens and if I don’t give the double quotes, it results in an error. Same with nvarguscamerasrc

nvgstcapture-1.0 -A --image-res=2 --mode=1 --cap-dev-node=0 --capture-auto=1 --exposuretimerange
Encoder null, cannot set bitrate!
Encoder Profile = High

** (nvgstcapture-1.0:29784): ERROR **: 19:22:59.054: main:4537 option parsing failed: Missing argument for --exposuretimerange
Trace/breakpoint trap (core dumped)

If I remove the --exposuretimerange or add --exposuretimerange=“min max”, this code perfectly works. captures an image with an automatic name generated. I tried understanding if the name means anything (eg: nvcamtest_29683_s00_00000.jpg). Seems like it is some kind of timestamp since it is always increasing.

I’ll go through the source code that you shared for better understanding.

I have one more issue. I followed the instructions on the git for the argus_camera but I am facing an error:

fatal error: Argus/Argus.h: No such file or directory

What library should I install?

After launch the nvgstcapture-1.0 you should be able set the gain/exposure… from below instruction.

  Set Gain Range:
      gr:<val><space><val> e.g., gr:1 16
  Get Gain Range:
  Set Exposure Time Range:
      etr:<val><space><val> e.g., etr:34000 35000
  Get Exposure Time Range:
  Set ISP Digital Gain Range:
      dgr:<val><space><val> e.g., dgr:2 152
  Get ISP Digital Gain Range:

etr:35000 35500
 Setting Exposure Time Range = 35000 35500
GST_ARGUS: NvArgusCameraSrc: Setting Exposure Time Range : 35000 35500
Exposure Time Range = 35000 35500
1 Like

@ShaneCCC This seems to be giving back the exposure time range right?

Not the exposure time at which image was captured… which would be a single value. I misunderstood when I read the properties are readable. I’ll continue to work on getting the libargus API up

You can set the min and max as same value to limit the exposure in a point like etr:34000 34000
then the exposure will be set as 34000

Hi Shane,

My problem statement is a bit different. I am trying to read the value set by auto exposure (not manual). I am using this value for my algorithm and also to add to exif when saving it

Sorry to tell current didn’t have API to get the exposure.

Even using argus_camera?

For argus you can get it by this API