mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 12:07:46 +08:00
feat: add depth downscale parameter for Gemini 305 support
This commit is contained in:
@@ -711,6 +711,7 @@ class OBCameraNode {
|
||||
|
||||
bool ordered_pc_ = false;
|
||||
bool enable_depth_scale_ = true;
|
||||
int depth_downscale_ = 1;
|
||||
std::string device_preset_ = "Default";
|
||||
// filter switch
|
||||
bool enable_decimation_filter_ = false;
|
||||
|
||||
@@ -122,6 +122,7 @@ def generate_launch_description():
|
||||
|
||||
DeclareLaunchArgument('depth_width', default_value='0'),
|
||||
DeclareLaunchArgument('depth_height', default_value='0'),
|
||||
DeclareLaunchArgument('depth_downscale', default_value='1'),
|
||||
DeclareLaunchArgument('depth_fps', default_value='0'),
|
||||
DeclareLaunchArgument('depth_format', default_value='ANY'),
|
||||
DeclareLaunchArgument('enable_depth', default_value='true'),
|
||||
|
||||
@@ -1268,8 +1268,18 @@ void OBCameraNode::setupProfiles() {
|
||||
format_[elem] == OB_FORMAT_UNKNOWN) {
|
||||
selected_profile = profiles->getProfile(0)->as<ob::VideoStreamProfile>();
|
||||
} else {
|
||||
selected_profile = profiles->getVideoStreamProfile(width_[elem], height_[elem],
|
||||
format_[elem], fps_[elem]);
|
||||
auto pid = device_->getDeviceInfo()->getPid();
|
||||
if (pid == 0x0840 && 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 {
|
||||
selected_profile = profiles->getVideoStreamProfile(width_[elem], height_[elem],
|
||||
format_[elem], fps_[elem]);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (const ob::Error &ex) {
|
||||
@@ -1912,6 +1922,7 @@ void OBCameraNode::getParameters() {
|
||||
setAndGetNodeParameter<bool>(ordered_pc_, "ordered_pc", false);
|
||||
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<std::string>(device_preset_, "device_preset", "");
|
||||
setAndGetNodeParameter<bool>(enable_decimation_filter_, "enable_decimation_filter", false);
|
||||
setAndGetNodeParameter<bool>(enable_hdr_merge_, "enable_hdr_merge", false);
|
||||
|
||||
@@ -18,14 +18,24 @@ std::shared_ptr<ob::Device> initializeDevice(std::shared_ptr<ob::Pipeline> pipel
|
||||
|
||||
void listSensorProfiles(const std::shared_ptr<ob::Device>& device) {
|
||||
auto sensor_list = device->getSensorList();
|
||||
auto pid = device->getDeviceInfo()->getPid();
|
||||
for (size_t i = 0; i < sensor_list->getCount(); i++) {
|
||||
auto sensor = sensor_list->getSensor(i);
|
||||
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_COLOR || sensor->getType() == OB_SENSOR_DEPTH ||
|
||||
sensor->getType() == OB_SENSOR_IR || sensor->getType() == OB_SENSOR_IR_LEFT ||
|
||||
sensor->getType() == OB_SENSOR_IR_RIGHT) {
|
||||
if (sensor->getType() == OB_SENSOR_DEPTH && pid == 0x0840) {
|
||||
// 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
|
||||
<< " Height: " << profile->getDownSampleConfig().originHeight
|
||||
<< " downscale:" << profile->getDownSampleConfig().scaleFactor << std::endl;
|
||||
} else if (sensor->getType() == OB_SENSOR_COLOR || sensor->getType() == OB_SENSOR_DEPTH ||
|
||||
sensor->getType() == OB_SENSOR_IR || sensor->getType() == OB_SENSOR_IR_LEFT ||
|
||||
sensor->getType() == OB_SENSOR_IR_RIGHT) {
|
||||
auto profile = origin_profile->as<ob::VideoStreamProfile>();
|
||||
std::cout << magic_enum::enum_name(sensor->getType()) << " profile: " << profile->getWidth()
|
||||
<< "x" << profile->getHeight() << " " << profile->getFps() << "fps "
|
||||
@@ -43,7 +53,8 @@ void listSensorProfiles(const std::shared_ptr<ob::Device>& device) {
|
||||
} else if (sensor->getType() == OB_SENSOR_LIDAR) {
|
||||
auto profile = origin_profile->as<ob::LiDARStreamProfile>();
|
||||
std::cout << magic_enum::enum_name(sensor->getType())
|
||||
<< " scan rate: " << magic_enum::enum_name(profile->getScanRate()) << " format:"<<magic_enum::enum_name(profile->getFormat())<< std::endl;
|
||||
<< " scan rate: " << magic_enum::enum_name(profile->getScanRate())
|
||||
<< " format:" << magic_enum::enum_name(profile->getFormat()) << std::endl;
|
||||
} else {
|
||||
std::cout << "Unknown profile: " << magic_enum::enum_name(sensor->getType()) << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user