mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-12 19:20:20 +08:00
feat: add left and right IR downscale parameters to OBCameraNode and launch configuration
This commit is contained in:
@@ -751,6 +751,8 @@ class OBCameraNode {
|
||||
bool ordered_pc_ = false;
|
||||
bool enable_depth_scale_ = true;
|
||||
int depth_downscale_ = 1;
|
||||
int left_ir_downscale_ = 1;
|
||||
int right_ir_downscale_ = 1;
|
||||
std::string device_preset_ = "Default";
|
||||
// filter switch
|
||||
bool enable_decimation_filter_ = false;
|
||||
|
||||
@@ -166,6 +166,7 @@ def generate_launch_description():
|
||||
DeclareLaunchArgument('mean_intensity_set_point', default_value='-1'),
|
||||
DeclareLaunchArgument('left_ir_width', default_value='0'),
|
||||
DeclareLaunchArgument('left_ir_height', default_value='0'),
|
||||
DeclareLaunchArgument('left_ir_downscale', default_value='1'),
|
||||
DeclareLaunchArgument('left_ir_fps', default_value='0'),
|
||||
DeclareLaunchArgument('left_ir_format', default_value='ANY'),
|
||||
DeclareLaunchArgument('enable_left_ir', default_value='false'),
|
||||
@@ -178,6 +179,7 @@ def generate_launch_description():
|
||||
DeclareLaunchArgument('left_ir_sequence_id_filter_id', default_value='-1'),
|
||||
DeclareLaunchArgument('right_ir_width', default_value='0'),
|
||||
DeclareLaunchArgument('right_ir_height', default_value='0'),
|
||||
DeclareLaunchArgument('right_ir_downscale', default_value='1'),
|
||||
DeclareLaunchArgument('right_ir_fps', default_value='0'),
|
||||
DeclareLaunchArgument('right_ir_format', default_value='ANY'),
|
||||
DeclareLaunchArgument('enable_right_ir', default_value='false'),
|
||||
|
||||
@@ -1354,6 +1354,7 @@ void OBCameraNode::printSensorProfiles(const std::shared_ptr<ob::Sensor> &sensor
|
||||
|
||||
void OBCameraNode::setupProfiles() {
|
||||
// Image stream
|
||||
auto pid = device_->getDeviceInfo()->getPid();
|
||||
for (const auto &elem : IMAGE_STREAMS) {
|
||||
if (enable_stream_[elem]) {
|
||||
const auto &sensor = sensors_[elem];
|
||||
@@ -1384,14 +1385,24 @@ void OBCameraNode::setupProfiles() {
|
||||
format_[elem] == OB_FORMAT_UNKNOWN) {
|
||||
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
||||
} else {
|
||||
auto pid = device_->getDeviceInfo()->getPid();
|
||||
if (pid == GEMINI_305_PID && elem == DEPTH) {
|
||||
// Gemini 305
|
||||
OBDownSampleConfig conf;
|
||||
conf.originWidth = width_[elem];
|
||||
conf.originHeight = height_[elem];
|
||||
conf.scaleFactor = depth_downscale_;
|
||||
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
||||
} else if (pid == GEMINI_305_PID && elem == INFRA1) {
|
||||
OBDownSampleConfig conf;
|
||||
conf.originWidth = width_[elem];
|
||||
conf.originHeight = height_[elem];
|
||||
conf.scaleFactor = left_ir_downscale_;
|
||||
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
||||
} else if (pid == GEMINI_305_PID && elem == INFRA2) {
|
||||
OBDownSampleConfig conf;
|
||||
conf.originWidth = width_[elem];
|
||||
conf.originHeight = height_[elem];
|
||||
conf.scaleFactor = right_ir_downscale_;
|
||||
selected_profile = profiles->getVideoStreamProfile(conf, format_[elem], fps_[elem]);
|
||||
} else {
|
||||
selected_profile = profiles->getVideoStreamProfile(width_[elem], height_[elem],
|
||||
format_[elem], fps_[elem]);
|
||||
@@ -2048,6 +2059,8 @@ void OBCameraNode::getParameters() {
|
||||
setAndGetNodeParameter<int>(max_save_images_count_, "max_save_images_count", 10);
|
||||
setAndGetNodeParameter<bool>(enable_depth_scale_, "enable_depth_scale", true);
|
||||
setAndGetNodeParameter<int>(depth_downscale_, "depth_downscale", 1);
|
||||
setAndGetNodeParameter<int>(left_ir_downscale_, "left_ir_downscale", 1);
|
||||
setAndGetNodeParameter<int>(right_ir_downscale_, "right_ir_downscale", 1);
|
||||
setAndGetNodeParameter<std::string>(device_preset_, "device_preset", "");
|
||||
setAndGetNodeParameter<bool>(enable_decimation_filter_, "enable_decimation_filter", false);
|
||||
setAndGetNodeParameter<bool>(enable_hdr_merge_, "enable_hdr_merge", false);
|
||||
|
||||
@@ -24,13 +24,15 @@ void listSensorProfiles(const std::shared_ptr<ob::Device>& device) {
|
||||
auto profile_list = sensor->getStreamProfileList();
|
||||
for (size_t j = 0; j < profile_list->getCount(); j++) {
|
||||
auto origin_profile = profile_list->getProfile(j);
|
||||
if (sensor->getType() == OB_SENSOR_DEPTH && pid == GEMINI_305_PID) {
|
||||
if ((sensor->getType() == OB_SENSOR_DEPTH || sensor->getType() == OB_SENSOR_IR_LEFT ||
|
||||
sensor->getType() == OB_SENSOR_IR_RIGHT) &&
|
||||
pid == GEMINI_305_PID) {
|
||||
// Gemini 305
|
||||
auto profile = origin_profile->as<ob::VideoStreamProfile>();
|
||||
std::cout << magic_enum::enum_name(sensor->getType()) << " profile: " << profile->getWidth()
|
||||
<< "x" << profile->getHeight() << " " << profile->getFps() << "fps "
|
||||
<< magic_enum::enum_name(profile->getFormat())
|
||||
<< " Weight: " << profile->getDownSampleConfig().originWidth
|
||||
<< " | Weight: " << profile->getDownSampleConfig().originWidth
|
||||
<< " Height: " << profile->getDownSampleConfig().originHeight
|
||||
<< " downscale:" << profile->getDownSampleConfig().scaleFactor << std::endl;
|
||||
} else if (sensor->getType() == OB_SENSOR_COLOR || sensor->getType() == OB_SENSOR_DEPTH ||
|
||||
|
||||
Reference in New Issue
Block a user