Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Ability to control camera parameters at runtime? #23

Open
NoTuxNoBux opened this issue Mar 9, 2021 · 6 comments
Open

[Question] Ability to control camera parameters at runtime? #23

NoTuxNoBux opened this issue Mar 9, 2021 · 6 comments
Assignees
Labels
feature_request New feature or request

Comments

@NoTuxNoBux
Copy link

Hello

In #12 support was added to control camera parameters such as brightness and contrast through zedsrc. These work fine, but is it possible to control these at runtime?

To elaborate: the properties are writeable, so I'm trying to write to them whilst the zedsrc element is active. At first sight, the brightness and contrast don't appear to change, but if I restart the zedsrc stream (e.g. reconnect to an RTSP stream using it, which appears to shut down temporarily if no one is connected), both parameters are suddenly correctly applied.

I added debug logs to the zedsrc element to confirm that it's receiving the changes in parameters, and it is. I didn't read the source thoroughly, but is it possible that these parameters are just set once during initialization and not updated at runtime afterwards?

FWIW, v4l2src also exposes brightness and contrast parameters, and controlling these at runtime appears to work, though I can't be sure if it's controlling the actual ZED camera or applying some sort of video filter instead.

Thanks!

@NoTuxNoBux NoTuxNoBux added the question Further information is requested label Mar 9, 2021
@NoTuxNoBux NoTuxNoBux changed the title [Question] Ability to set control camera parameters at runtime? [Question] Ability to control camera parameters at runtime? Mar 9, 2021
@Myzhar
Copy link
Member

Myzhar commented Mar 9, 2021

Hi @NoTuxNoBux
runtime controls modification is indeed not handled.
We can add this feature, it is indeed really useful.
How are you trying to change the values runtime? What is the best method?

@NoTuxNoBux
Copy link
Author

Hi @Myzhar and thanks again for the quick response!

I'm currently using the Python GStreamer bindings, spawning a pipeline that uses the zedsrc element programatically, then fetching the element I want from the pipeline ("bin element") using iterate_elements, and then updating the properties at runtime like this:

zedsrc_element.set_property('brightness', new_brightness)
zedsrc_element.set_property('contrast', new_contrast)

In my case, the values of new_brightness and new_contrast are being controlled by a web server accepting a request to update them, but it could of course also be controlled by something else like a GUI slider, CLI input, a file that changed, or a DBus signal for testing purposes.

Of course, C or any other language with GStreamer bindings should also work similarly, only the syntax will differ a little.

@Myzhar Myzhar added feature_request New feature or request and removed question Further information is requested labels Mar 8, 2022
@keli95566
Copy link

@NoTuxNoBux I am trying to do the same thing here. However I am very new to Gstreamer and Python, would you mind sharing your live control solution? Thank you very much!

@NoTuxNoBux
Copy link
Author

@keli95566 We ended up going with v4l2src for the time being since zedsrc doesn't support this yet. I can't share the code because it is a proprietary code base, but the steps are roughly:

  1. On server/API start-up, also start GStreamer pipeline.
  2. Receive API request from client to update camera parameters.
  3. Search v4l2src element in spawned GStreamer pipeline.
  4. Use set_property (or similar in your language) to update the camera parameters; GStreamer handles the rest.

@keli95566
Copy link

Thank you very much for the instruction! :) However, v412src only returns unrectified image streams if I understood correctly. Perhaps I would just wait for the next release.

@bioniwulf
Copy link

Dear @Myzhar,
May I ask about progress with control camera parameters at runtime feature?
It would be really usefull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature_request New feature or request
Development

No branches or pull requests

4 participants