Giter VIP home page Giter VIP logo

Comments (10)

ddiakopoulos avatar ddiakopoulos commented on May 10, 2024

Hmm. We already have an inline comment for this as well https://github.com/IntelRealSense/librealsense/blob/master/src/uvc-v4l2.cpp#L459

It works for F200, R200, and SR300 on our Windows backend, so we'll look into it more deeply.

from librealsense.

taketwo avatar taketwo commented on May 10, 2024

I'll also give it a try on my Arch laptop this weekend and let you know about the results.

from librealsense.

digitologist avatar digitologist commented on May 10, 2024

Confirming this works fine on Windows but throws an error on Ubuntu 14.04.

from librealsense.

ddiakopoulos avatar ddiakopoulos commented on May 10, 2024

UVC controls across the backends have slightly inconsistent interfaces when it comes to exposure. There is some additional logic that will need to be added to the V4L2 backend. Just noting here that we acknowledge color exposure is broken on Linux but at the moment it's lower priority to fix.

from librealsense.

zhengye1995 avatar zhengye1995 commented on May 10, 2024

I aslo can not set this option in Windows10,but I can get it,I used:
dev->set_option(rs::option::color_exposure, 100);
but it is not worked

from librealsense.

peci1 avatar peci1 commented on May 10, 2024

I confirm this happens on 14.04 when using the Realsense ROS package and setting R200_LR_AUTO_EXPOSURE_ENABLED to 1. That makes the IR and depth images stall until I reconnect the device.

What's also interesting: the cpp-enumerate-devices example shows the following:

COLOR_ENABLE_AUTO_EXPOSURE : 0 .. 0, 1

Which I understand as the color auto exposure having range 0-0. That's strange.

from librealsense.

taketwo avatar taketwo commented on May 10, 2024

As I noted before, it is possible to toggle auto exposure and adjust exposure time using v4l2-ctl command-line tool. I had a look inside the source code, and it turns out they use different control IDs. For auto exposure it is V4L2_CID_EXPOSURE_AUTO, and for exposure time it is V4L2_CID_EXPOSURE_ABSOLUTE.

So this patch fixes the issue for me:

diff --git a/src/uvc-v4l2.cpp b/src/uvc-v4l2.cpp
index 9c1b01b..05a94f5 100644
--- a/src/uvc-v4l2.cpp
+++ b/src/uvc-v4l2.cpp
@@ -462,14 +462,14 @@ namespace rsimpl
             case RS_OPTION_COLOR_BACKLIGHT_COMPENSATION: return V4L2_CID_BACKLIGHT_COMPENSATION;
             case RS_OPTION_COLOR_BRIGHTNESS: return V4L2_CID_BRIGHTNESS;
             case RS_OPTION_COLOR_CONTRAST: return V4L2_CID_CONTRAST;
-            case RS_OPTION_COLOR_EXPOSURE: return V4L2_CID_EXPOSURE; // Is this actually valid? I'm getting a lot of VIDIOC error 22s...
+            case RS_OPTION_COLOR_EXPOSURE: return V4L2_CID_EXPOSURE_ABSOLUTE;
             case RS_OPTION_COLOR_GAIN: return V4L2_CID_GAIN;
             case RS_OPTION_COLOR_GAMMA: return V4L2_CID_GAMMA;
             case RS_OPTION_COLOR_HUE: return V4L2_CID_HUE;
             case RS_OPTION_COLOR_SATURATION: return V4L2_CID_SATURATION;
             case RS_OPTION_COLOR_SHARPNESS: return V4L2_CID_SHARPNESS;
             case RS_OPTION_COLOR_WHITE_BALANCE: return V4L2_CID_WHITE_BALANCE_TEMPERATURE;
-            case RS_OPTION_COLOR_ENABLE_AUTO_EXPOSURE: return V4L2_CID_AUTOGAIN; // Automatic gain/exposure control
+            case RS_OPTION_COLOR_ENABLE_AUTO_EXPOSURE: return V4L2_CID_EXPOSURE_AUTO;
             case RS_OPTION_COLOR_ENABLE_AUTO_WHITE_BALANCE: return V4L2_CID_AUTO_WHITE_BALANCE;
             default: throw std::runtime_error(to_string() << "no v4l2 cid for option " << option);
             }

Tested with all (R200, F200, SR300) cameras. Note that V4L2_CID_EXPOSURE_AUTO encodes modes with enum, where 1 is manual mode, and 3 is aperture priority. This means that to disable auto exposure one needs to call device->set_option(rs::options::color_enable_auto_exposure, 1), and to enable it device->set_option(rs::options::color_enable_auto_exposure, 3).

from librealsense.

taketwo avatar taketwo commented on May 10, 2024

I've been using librealsense with this patch for over a month now on Ubuntu 14.04 and 16.04 without any problems. Should I submit a pull request?

from librealsense.

dorodnic avatar dorodnic commented on May 10, 2024

Thank you, this does seem to solve the problem.
This fix is also available on the development branch and will be merged to master.

from librealsense.

dorodnic avatar dorodnic commented on May 10, 2024

Auto exposure should be functional now on all platforms

from librealsense.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.