- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to get the brigtness and also set the brightness
#include <librealsense2/rs.hpp>
// include OpenCV header file
#include <opencv2/opencv.hpp>
using namespace std;
using namespace cv;
const int D435RGB_WIDTH = 640;
const int D435RGB_HEIGHT = 480;
const int DEPTH_WIDTH = 640;
const int DEPTH_HEIGHT = 480;
int main()
{
//Contruct a pipeline which abstracts the device
rs2::pipeline pipe;
//Create a configuration for configuring the pipeline with a non default profile
rs2::config cfg;
rs2::sensor ss;
cfg.enable_stream(RS2_STREAM_COLOR, D435RGB_WIDTH, D435RGB_HEIGHT, RS2_FORMAT_BGR8, 30); // RGB
cfg.enable_stream(RS2_STREAM_DEPTH, DEPTH_WIDTH, DEPTH_HEIGHT, RS2_FORMAT_Z16, 30); // Depth
rs2::pipeline_profile selection = pipe.start();
rs2::device selected_device = selection.get_device();
auto depth_sensor = selected_device.first<rs2::depth_sensor>();
// auto depth_sensor = selected_device.first();
// auto depth_sensor = selected_device.second<rs2::depth_sensor>();
// auto depth_sensor = selected_device.first<rs2::color_camera>();
int o = depth_sensor.get_option(RS2_OPTION_BRIGHTNESS);
//int i = ss.get_option(rs2_option::RS2_OPTION_BRIGHTNESS);
int i = 1000;
// rs2_set_option((const rs2_options*)sen, RS2_OPTION_BRIGHTNESS,i);
//Add desired streams to configuration
cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_BGR8, 30);
//Instruct pipeline to start streaming with the requested configuration
pipe.start(cfg);
rs2::frameset frames;
for(int i = 0; i < 30; i++)
{
//Wait for all configured streams to produce a frame
frames = pipe.wait_for_frames();
}
//Get each frame
rs2::frame color_frame = frames.get_color_frame();
// Creating OpenCV Matrix from a color image
Mat color(Size(640, 480), CV_8UC3, (void*)color_frame.get_data(), Mat::AUTO_STEP);
// Display in a GUI
namedWindow("Display Image", WINDOW_AUTOSIZE );
imshow("Display Image", color);
waitKey(0);
return 0;
}
- Tags:
- Include
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe the means of getting the color sensor brightness value from the RGB sensor is to read it from the frame metadata using the instruction RS2_FRAME_METADATA_BRIGHTNESS
There are practically no references for using this instruction though, except in the SDK file called frame.h 0n line 49.
https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense2/h/rs_frame.h#L49
In another case where someone wanted to change the brightness of the color image, Dorodnic the RealSense SDK Manager told them that "you can control exposure, gain, brightness and contrast via set_option API".
The scripting in the links below may be of use to you in working out how to use set_option to set brightness.
https://github.com/IntelRealSense/librealsense/issues/1542#issuecomment-381363473
https://github.com/IntelRealSense/librealsense/issues/2199#issuecomment-410650972
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page