From 7c90d72e8794efb6d068447f4afe01b7966a59cc Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Tue, 17 Aug 2021 13:55:52 +0300 Subject: [PATCH 01/13] modified hard-coded presets, and calling functions to relevant presets in advanced_mode.hpp --- src/ds5/advanced_mode/advanced_mode.cpp | 50 +-- src/ds5/advanced_mode/presets.cpp | 430 +++++++----------------- src/ds5/advanced_mode/presets.h | 13 +- 3 files changed, 124 insertions(+), 369 deletions(-) diff --git a/src/ds5/advanced_mode/advanced_mode.cpp b/src/ds5/advanced_mode/advanced_mode.cpp index a15bb78677..76b63a5268 100644 --- a/src/ds5/advanced_mode/advanced_mode.cpp +++ b/src/ds5/advanced_mode/advanced_mode.cpp @@ -67,13 +67,6 @@ namespace librealsense const firmware_version& fw_version) { auto p = get_all(); - res_type res; - - // configuration is empty before first streaming - so set default res - if (configuration.empty()) - res = low_resolution; - else - res = get_res_type(configuration.front().width, configuration.front().height); switch (preset) { @@ -89,9 +82,11 @@ namespace librealsense case ds::RS435_RGB_PID: case ds::RS435I_PID: case ds::RS465_PID: - case ds::RS455_PID: default_430(p); break; + case ds::RS455_PID: + default_450(p); + break; case ds::RS405U_PID: default_405u(p); break; @@ -117,46 +112,13 @@ namespace librealsense p.depth_table.depthUnits = 100; // 0.1mm break; case RS2_RS400_VISUAL_PRESET_HIGH_ACCURACY: - switch (res) - { - case low_resolution: - low_res_high_accuracy(p); - break; - case medium_resolution: - mid_res_high_accuracy(p); - break; - case high_resolution: - high_res_high_accuracy(p); - break; - } + high_accuracy(p); break; case RS2_RS400_VISUAL_PRESET_HIGH_DENSITY: - switch (res) - { - case low_resolution: - low_res_high_density(p); - break; - case medium_resolution: - mid_res_high_density(p); - break; - case high_resolution: - high_res_high_density(p); - break; - } + high_density(p); break; case RS2_RS400_VISUAL_PRESET_MEDIUM_DENSITY: - switch (res) - { - case low_resolution: - low_res_mid_density(p); - break; - case medium_resolution: - mid_res_mid_density(p); - break; - case high_resolution: - high_res_mid_density(p); - break; - } + mid_density(p); break; case RS2_RS400_VISUAL_PRESET_REMOVE_IR_PATTERN: { diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 3ec9c7656a..75b000185b 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -19,7 +19,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 0; p.rsm.diffThresh = 4.f; p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 1; p.rsvc.minNorth = 1; @@ -86,7 +86,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 0; p.rsm.diffThresh = 4.f; p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 1; p.rsvc.minNorth = 1; @@ -155,7 +155,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 0; p.rsm.diffThresh = 4.f; p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; //inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 1; p.rsvc.minNorth = 1; @@ -184,6 +184,7 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; + p.hdad.ignoreSAD = 0; p.cc.colorCorrection1 = -0.0556641f; p.cc.colorCorrection2 = 0.560547f; p.cc.colorCorrection3 = 0.560547f; @@ -196,16 +197,19 @@ namespace librealsense p.cc.colorCorrection10 = -0.194336f; p.cc.colorCorrection11 = -0.194336f; p.cc.colorCorrection12 = -0.589844f; - p.depth_table.depthClampMax = 65536; + p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; p.depth_table.depthUnits = 100; p.depth_table.disparityShift = 0; + p.depth_table.disparityMode = 0; p.ae.meanIntensitySetPoint = 1000; p.census.uDiameter = 9; p.census.vDiameter = 9; - p.depth_exposure.exposure = 33000.f; + p.depth_exposure.exposure = 32000.f p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; + p.amplitude_factor.amplitude = 0.f; + p.depth_auto_white_balance.auto_white_balance = 1; } void default_410(preset& p) @@ -222,7 +226,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 0; p.rsm.diffThresh = 4.f; p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 1; p.rsvc.minNorth = 1; @@ -291,7 +295,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 0; p.rsm.diffThresh = 4.f; p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 1; p.rsvc.minNorth = 1; @@ -387,10 +391,10 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; - p.cc.colorCorrection1 = 0.2989999949932f; - p.cc.colorCorrection2 = 0.2939999997616f; - p.cc.colorCorrection3 = 0.2939999997616f; - p.cc.colorCorrection4 = 0.1140000000596f; + p.cc.colorCorrection1 = 0.298828f; + p.cc.colorCorrection2 = 0.293945f; + p.cc.colorCorrection3 = 0.293945f; + p.cc.colorCorrection4 = 0.114258f; p.cc.colorCorrection5 = 0.f; p.cc.colorCorrection6 = 0.f; p.cc.colorCorrection7 = 0.f; @@ -411,10 +415,84 @@ namespace librealsense p.depth_exposure.exposure = 8500.f; p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; + p.hdad.ignoreSAD = 0; } - void high_res_high_accuracy(preset& p) + void default_450(preset& p) { + p.depth_controls.deepSeaMedianThreshold = 500; + p.depth_controls.deepSeaNeighborThreshold = 7; + p.depth_controls.deepSeaSecondPeakThreshold = 325; + p.depth_controls.lrAgreeThreshold = 24; + p.depth_controls.minusDecrement = 10; + p.depth_controls.plusIncrement = 10; + p.depth_controls.scoreThreshA = 1; + p.depth_controls.scoreThreshB = 2047; + p.depth_controls.textureCountThreshold = 0; + p.depth_controls.textureDifferenceThreshold = 0; + p.rsm.diffThresh = 4.f; + p.rsm.removeThresh = 63; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json + p.rsm.sloRauDiffThresh = 1.f; + p.rsvc.minEast = 1; + p.rsvc.minNorth = 1; + p.rsvc.minNSsum = 3; + p.rsvc.minSouth = 1; + p.rsvc.minWest = 1; + p.rsvc.minWEsum = 3; + p.rsvc.uShrink = 3; + p.rsvc.vShrink = 1; + p.color_control.disableRAUColor = 0; + p.color_control.disableSADColor = 0; + p.color_control.disableSADNormalize = 0; + p.color_control.disableSLOLeftColor = 0; + p.color_control.disableSLORightColor = 0; + p.rctc.rauDiffThresholdBlue = 51; + p.rctc.rauDiffThresholdGreen = 51; + p.rctc.rauDiffThresholdRed = 51; + p.sctc.diffThresholdBlue = 72; + p.sctc.diffThresholdGreen = 72; + p.sctc.diffThresholdRed = 72; + p.spc.sloK1Penalty = 60; + p.spc.sloK1PenaltyMod1 = 105; + p.spc.sloK1PenaltyMod2 = 70; + p.spc.sloK2Penalty = 342; + p.spc.sloK2PenaltyMod1 = 190; + p.spc.sloK2PenaltyMod2 = 130; + p.hdad.lambdaAD = 800.f; + p.hdad.lambdaCensus = 26.f; + p.cc.colorCorrection1 = -0.493164f; + p.cc.colorCorrection2 = 0.831055f; + p.cc.colorCorrection3 = 0.831055f; + p.cc.colorCorrection4 = -0.368164f; + p.cc.colorCorrection5 = -0.133789f; + p.cc.colorCorrection6 = -0.323242f; + p.cc.colorCorrection7 = -0.323242f; + p.cc.colorCorrection8 = 1.19141f; + p.cc.colorCorrection9 = 0.90918f; + p.cc.colorCorrection10 = -0.272461f; + p.cc.colorCorrection11 = -0.272461f; + p.cc.colorCorrection12 = -0.355469f; + p.depth_table.depthClampMax = 65536; + p.depth_table.depthClampMin = 0; + p.depth_table.depthUnits = 1000; + p.depth_table.disparityShift = 0; + p.ae.meanIntensitySetPoint = 1000; + p.census.uDiameter = 9; + p.census.vDiameter = 9; + p.laser_state.laser_state = 1; + p.laser_power.laser_power = 150.f; + p.depth_exposure.exposure = 8500.f; + p.depth_auto_exposure.auto_exposure = 1; + p.depth_gain.gain = 16.f; + p.hdad.ignoreSAD = 0; + + } + + void high_accuracy(preset& p) + { + p.census.uDiameter = 9; + p.census.vDiameter = 9; p.depth_controls.deepSeaMedianThreshold = 796; p.depth_controls.deepSeaNeighborThreshold = 108; p.depth_controls.deepSeaSecondPeakThreshold = 647; @@ -425,10 +503,10 @@ namespace librealsense p.depth_controls.scoreThreshB = 2893; p.depth_controls.textureCountThreshold = 0; p.depth_controls.textureDifferenceThreshold = 1722; - p.rsm.diffThresh = 1.660570025444f; + p.rsm.diffThresh = 1.65625f; p.rsm.removeThresh = 136; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.7269909977913f; + p.rsm.rsmBypass = 0; + p.rsm.sloRauDiffThresh = 0.785714f; p.rsvc.minEast = 6; p.rsvc.minNorth = 3; p.rsvc.minNSsum = 7; @@ -456,24 +534,27 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 493; p.hdad.lambdaAD = 751.f; p.hdad.lambdaCensus = 6.f; + p.hdad.ignoreSAD = 0; } - void high_res_high_density(preset& p) + void high_density(preset& p) { + p.census.uDiameter = 9; + p.census.vDiameter = 9; p.depth_controls.deepSeaMedianThreshold = 789; p.depth_controls.deepSeaNeighborThreshold = 12; p.depth_controls.deepSeaSecondPeakThreshold = 222; p.depth_controls.lrAgreeThreshold = 18; p.depth_controls.minusDecrement = 6; p.depth_controls.plusIncrement = 21; - p.depth_controls.scoreThreshA = 96; - p.depth_controls.scoreThreshB = 1443; + p.depth_controls.scoreThreshA = 96; + p.depth_controls.scoreThreshB = 1443; p.depth_controls.textureCountThreshold = 0; p.depth_controls.textureDifferenceThreshold = 2466; - p.rsm.diffThresh = 1.228299975395f; - p.rsm.removeThresh = 82; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.2664879858494f; + p.rsm.diffThresh = 1.21875f; + p.rsm.removeThresh = 82; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json + p.rsm.sloRauDiffThresh = 0.28125f; p.rsvc.minEast = 2; p.rsvc.minNorth = 1; p.rsvc.minNSsum = 6; @@ -487,9 +568,9 @@ namespace librealsense p.color_control.disableSADNormalize = 0; p.color_control.disableSLOLeftColor = 0; p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 112; + p.rctc.rauDiffThresholdBlue = 112; p.rctc.rauDiffThresholdGreen = 585; - p.rctc.rauDiffThresholdRed = 18; + p.rctc.rauDiffThresholdRed = 18; p.sctc.diffThresholdBlue = 8; p.sctc.diffThresholdGreen = 200; p.sctc.diffThresholdRed = 279; @@ -501,10 +582,13 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 206; p.hdad.lambdaAD = 618.f; p.hdad.lambdaCensus = 15.f; + p.hdad.ignoreSAD = 0; } - void high_res_mid_density(preset& p) + void mid_density(preset& p) { + p.census.uDiameter = 9; + p.census.vDiameter = 9; p.depth_controls.deepSeaMedianThreshold = 1021; p.depth_controls.deepSeaNeighborThreshold = 97; p.depth_controls.deepSeaSecondPeakThreshold = 600; @@ -515,9 +599,9 @@ namespace librealsense p.depth_controls.scoreThreshB = 887; p.depth_controls.textureCountThreshold = 0; p.depth_controls.textureDifferenceThreshold = 0; - p.rsm.diffThresh = 1.816750049591f; + p.rsm.diffThresh = 1.8125f; p.rsm.removeThresh = 81; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; //inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 1.f; p.rsvc.minEast = 3; p.rsvc.minNorth = 1; @@ -537,7 +621,7 @@ namespace librealsense p.rctc.rauDiffThresholdRed = 186; p.sctc.diffThresholdBlue = 16; p.sctc.diffThresholdGreen = 259; - p.sctc.diffThresholdRed = 896; + p.sctc.diffThresholdRed = 896; p.spc.sloK1Penalty = 132; p.spc.sloK1PenaltyMod1 = 77; p.spc.sloK1PenaltyMod2 = 234; @@ -546,288 +630,7 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 151; p.hdad.lambdaAD = 935.f; p.hdad.lambdaCensus = 26.f; - } - - void low_res_high_accuracy(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 871; - p.depth_controls.deepSeaNeighborThreshold = 113; - p.depth_controls.deepSeaSecondPeakThreshold = 310; - p.depth_controls.lrAgreeThreshold = 28; - p.depth_controls.minusDecrement = 1; - p.depth_controls.plusIncrement = 1; - p.depth_controls.scoreThreshA = 70; - p.depth_controls.scoreThreshB = 1890; - p.depth_controls.textureCountThreshold = 8; - p.depth_controls.textureDifferenceThreshold = 0; - p.rsm.diffThresh = 5.206029891968f; - p.rsm.removeThresh = 86; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.7110940217972f; - p.rsvc.minEast = 1; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 5; - p.rsvc.minSouth = 3; - p.rsvc.minWest = 7; - p.rsvc.minWEsum = 7; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 0; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 23; - p.rctc.rauDiffThresholdGreen = 297; - p.rctc.rauDiffThresholdRed = 95; - p.sctc.diffThresholdBlue = 72; - p.sctc.diffThresholdGreen = 72; - p.sctc.diffThresholdRed = 72; - p.spc.sloK1Penalty = 176; - p.spc.sloK1PenaltyMod1 = 196; - p.spc.sloK1PenaltyMod2 = 36; - p.spc.sloK2Penalty = 414; - p.spc.sloK2PenaltyMod1 = 96; - p.spc.sloK2PenaltyMod2 = 57; - p.hdad.lambdaAD = 74.f; - p.hdad.lambdaCensus = 26.f; - p.census.uDiameter = 8; - p.census.vDiameter = 9; - } - - void low_res_high_density(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 973; - p.depth_controls.deepSeaNeighborThreshold = 91; - p.depth_controls.deepSeaSecondPeakThreshold = 463; - p.depth_controls.lrAgreeThreshold = 20; - p.depth_controls.minusDecrement = 2; - p.depth_controls.plusIncrement = 18; - p.depth_controls.scoreThreshA = 90; - p.depth_controls.scoreThreshB = 3440; - p.depth_controls.textureCountThreshold = 0; - p.depth_controls.textureDifferenceThreshold = 3639; - p.rsm.diffThresh = 5.890840053558f; - p.rsm.removeThresh = 68; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.421687990427f; - p.rsvc.minEast = 1; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 5; - p.rsvc.minSouth = 2; - p.rsvc.minWest = 6; - p.rsvc.minWEsum = 4; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 1; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 300; - p.rctc.rauDiffThresholdGreen = 12; - p.rctc.rauDiffThresholdRed = 60; - p.sctc.diffThresholdBlue = 105; - p.sctc.diffThresholdGreen = 60; - p.sctc.diffThresholdRed = 64; - p.spc.sloK1Penalty = 170; - p.spc.sloK1PenaltyMod1 = 67; - p.spc.sloK1PenaltyMod2 = 59; - p.spc.sloK2Penalty = 386; - p.spc.sloK2PenaltyMod1 = 86; - p.spc.sloK2PenaltyMod2 = 60; - p.hdad.lambdaAD = 686.f; - p.hdad.lambdaCensus = 26.f; - p.census.uDiameter = 9; - p.census.vDiameter = 9; - } - - void low_res_mid_density(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 696; - p.depth_controls.deepSeaNeighborThreshold = 43; - p.depth_controls.deepSeaSecondPeakThreshold = 476; - p.depth_controls.lrAgreeThreshold = 30; - p.depth_controls.minusDecrement = 9; - p.depth_controls.plusIncrement = 16; - p.depth_controls.scoreThreshA = 43; - p.depth_controls.scoreThreshB = 1885; - p.depth_controls.textureCountThreshold = 0; - p.depth_controls.textureDifferenceThreshold = 2817; - p.rsm.diffThresh = 6.447229862213f; - p.rsm.removeThresh = 95; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.2744660079479f; - p.rsvc.minEast = 6; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 2; - p.rsvc.minSouth = 3; - p.rsvc.minWest = 7; - p.rsvc.minWEsum = 7; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 51; - p.rctc.rauDiffThresholdGreen = 31; - p.rctc.rauDiffThresholdRed = 424; - p.sctc.diffThresholdBlue = 69; - p.sctc.diffThresholdGreen = 72; - p.sctc.diffThresholdRed = 124; - p.spc.sloK1Penalty = 117; - p.spc.sloK1PenaltyMod1 = 33; - p.spc.sloK1PenaltyMod2 = 64; - p.spc.sloK2Penalty = 410; - p.spc.sloK2PenaltyMod1 = 80; - p.spc.sloK2PenaltyMod2 = 74; - p.hdad.lambdaAD = 183.f; - p.hdad.lambdaCensus = 26.f; - p.census.uDiameter = 9; - p.census.vDiameter = 9; - } - - void mid_res_high_accuracy(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 347; - p.depth_controls.deepSeaNeighborThreshold = 82; - p.depth_controls.deepSeaSecondPeakThreshold = 205; - p.depth_controls.lrAgreeThreshold = 18; - p.depth_controls.minusDecrement = 15; - p.depth_controls.plusIncrement = 5; - p.depth_controls.scoreThreshA = 80; - p.depth_controls.scoreThreshB = 2047; - p.depth_controls.textureCountThreshold = 0; - p.depth_controls.textureDifferenceThreshold = 3474; - p.rsm.diffThresh = 3.329339981079f; - p.rsm.removeThresh = 112; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 0.9618660211563f; - p.rsvc.minEast = 3; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 6; - p.rsvc.minSouth = 2; - p.rsvc.minWest = 2; - p.rsvc.minWEsum = 3; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 26; - p.rctc.rauDiffThresholdGreen = 975; - p.rctc.rauDiffThresholdRed = 29; - p.sctc.diffThresholdBlue = 442; - p.sctc.diffThresholdGreen = 16; - p.sctc.diffThresholdRed = 770; - p.spc.sloK1Penalty = 21; - p.spc.sloK1PenaltyMod1 = 3; - p.spc.sloK1PenaltyMod2 = 27; - p.spc.sloK2Penalty = 182; - p.spc.sloK2PenaltyMod1 = 41; - p.spc.sloK2PenaltyMod2 = 63; - p.hdad.lambdaAD = 630.f; - p.hdad.lambdaCensus = 26.f; - p.census.uDiameter = 6; - p.census.vDiameter = 7; - } - - void mid_res_high_density(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 276; - p.depth_controls.deepSeaNeighborThreshold = 4; - p.depth_controls.deepSeaSecondPeakThreshold = 6; - p.depth_controls.lrAgreeThreshold = 32; - p.depth_controls.minusDecrement = 1; - p.depth_controls.plusIncrement = 4; - p.depth_controls.scoreThreshA = 68; - p.depth_controls.scoreThreshB = 1949; - p.depth_controls.textureCountThreshold = 1; - p.depth_controls.textureDifferenceThreshold = 0; - p.rsm.diffThresh = 5.069789886475f; - p.rsm.removeThresh = 75; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 1.f; - p.rsvc.minEast = 7; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 6; - p.rsvc.minSouth = 3; - p.rsvc.minWest = 6; - p.rsvc.minWEsum = 14; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 1; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 11; - p.rctc.rauDiffThresholdGreen = 660; - p.rctc.rauDiffThresholdRed = 17; - p.sctc.diffThresholdBlue = 4; - p.sctc.diffThresholdGreen = 542; - p.sctc.diffThresholdRed = 982; - p.spc.sloK1Penalty = 479; - p.spc.sloK1PenaltyMod1 = 4; - p.spc.sloK1PenaltyMod2 = 25; - p.spc.sloK2Penalty = 342; - p.spc.sloK2PenaltyMod1 = 69; - p.spc.sloK2PenaltyMod2 = 225; - p.hdad.lambdaAD = 850.f; - p.hdad.lambdaCensus = 19.f; - p.census.uDiameter = 9; - p.census.vDiameter = 3; - } - - void mid_res_mid_density(preset& p) - { - p.depth_controls.deepSeaMedianThreshold = 175; - p.depth_controls.deepSeaNeighborThreshold = 1; - p.depth_controls.deepSeaSecondPeakThreshold = 3; - p.depth_controls.lrAgreeThreshold = 32; - p.depth_controls.minusDecrement = 14; - p.depth_controls.plusIncrement = 22; - p.depth_controls.scoreThreshA = 3; - p.depth_controls.scoreThreshB = 972; - p.depth_controls.textureCountThreshold = 6; - p.depth_controls.textureDifferenceThreshold = 0; - p.rsm.diffThresh = 5.859620094299f; - p.rsm.removeThresh = 70; - p.rsm.rsmBypass = 0; - p.rsm.sloRauDiffThresh = 1.f; - p.rsvc.minEast = 3; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 6; - p.rsvc.minSouth = 2; - p.rsvc.minWest = 1; - p.rsvc.minWEsum = 5; - p.rsvc.uShrink = 4; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 1; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 692; - p.rctc.rauDiffThresholdGreen = 12; - p.rctc.rauDiffThresholdRed = 80; - p.sctc.diffThresholdBlue = 18; - p.sctc.diffThresholdGreen = 493; - p.sctc.diffThresholdRed = 390; - p.spc.sloK1Penalty = 134; - p.spc.sloK1PenaltyMod1 = 10; - p.spc.sloK1PenaltyMod2 = 70; - p.spc.sloK2Penalty = 397; - p.spc.sloK2PenaltyMod1 = 21; - p.spc.sloK2PenaltyMod2 = 226; - p.hdad.lambdaAD = 978.f; - p.hdad.lambdaCensus = 21.f; - p.census.uDiameter = 8; - p.census.vDiameter = 5; + p.hdad.ignoreSAD = 0; } void hand_gesture(preset& p) @@ -844,7 +647,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 783; p.rsm.diffThresh = 3.8125f; p.rsm.removeThresh = 92; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; //inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 0.46875f; p.rsvc.minEast = 3; p.rsvc.minNorth = 1; @@ -874,11 +677,6 @@ namespace librealsense p.hdad.ignoreSAD = 0; p.hdad.lambdaAD = 1001.f; p.hdad.lambdaCensus = 7.f; - p.depth_table.depthClampMax = 65535; - p.depth_table.depthClampMin = 0; - p.depth_table.depthUnits = 1000; - p.depth_table.disparityMode = 0; - p.depth_table.disparityShift = 0; p.census.uDiameter = 9; p.census.vDiameter = 3; } diff --git a/src/ds5/advanced_mode/presets.h b/src/ds5/advanced_mode/presets.h index d3ee072fd7..1248892c9d 100644 --- a/src/ds5/advanced_mode/presets.h +++ b/src/ds5/advanced_mode/presets.h @@ -137,15 +137,10 @@ namespace librealsense void default_410(preset& p); void default_420(preset& p); void default_430(preset& p); - void high_res_high_accuracy(preset& p); - void high_res_high_density(preset& p); - void high_res_mid_density(preset& p); - void low_res_high_accuracy(preset& p); - void low_res_high_density(preset& p); - void low_res_mid_density(preset& p); - void mid_res_high_accuracy(preset& p); - void mid_res_high_density(preset& p); - void mid_res_mid_density(preset& p); + void default_450(preset& p); + void high_accuracy(preset& p); + void high_density(preset& p); + void mid_density(preset& p); void hand_gesture(preset& p); void d415_remove_ir(preset& p); void d460_remove_ir(preset& p); From 50d63d869e073e369d479f440e35fbfa2e52fed7 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Tue, 17 Aug 2021 14:37:33 +0300 Subject: [PATCH 02/13] missing ; --- src/ds5/advanced_mode/presets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 75b000185b..9d013bca08 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -205,7 +205,7 @@ namespace librealsense p.ae.meanIntensitySetPoint = 1000; p.census.uDiameter = 9; p.census.vDiameter = 9; - p.depth_exposure.exposure = 32000.f + p.depth_exposure.exposure = 32000.f; p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; p.amplitude_factor.amplitude = 0.f; From 1f612489b7c2e6b494ffe80a0148342b8f89523a Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Mon, 23 Aug 2021 17:02:08 +0300 Subject: [PATCH 03/13] fixed different floating issue when exporting presets --- src/ds5/advanced_mode/json_loader.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds5/advanced_mode/json_loader.hpp b/src/ds5/advanced_mode/json_loader.hpp index 0c8a267721..9bb826ec96 100644 --- a/src/ds5/advanced_mode/json_loader.hpp +++ b/src/ds5/advanced_mode/json_loader.hpp @@ -135,7 +135,7 @@ namespace librealsense void load(const std::string& str) override { float value = static_cast(::atof(str.c_str())); - strct->vals[0].*field = static_cast(scale * value); + strct->vals[0].*field = static_cast(std::floor(scale * value + 0.5f)); strct->update = true; } From c1f8f7bab9ca7a7583979c30738aefdca3047274 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Tue, 24 Aug 2021 14:37:46 +0300 Subject: [PATCH 04/13] added a comment --- src/ds5/advanced_mode/json_loader.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds5/advanced_mode/json_loader.hpp b/src/ds5/advanced_mode/json_loader.hpp index 9bb826ec96..24998e7172 100644 --- a/src/ds5/advanced_mode/json_loader.hpp +++ b/src/ds5/advanced_mode/json_loader.hpp @@ -135,7 +135,7 @@ namespace librealsense void load(const std::string& str) override { float value = static_cast(::atof(str.c_str())); - strct->vals[0].*field = static_cast(std::floor(scale * value + 0.5f)); + strct->vals[0].*field = static_cast(std::floor(scale * value + 0.5f)); //in order to convert float to int correctly we add 0.5 and then use the floor function strct->update = true; } From 8574769ee9472f3fade042565968e48ef4cdbbd8 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Mon, 30 Aug 2021 12:40:54 +0300 Subject: [PATCH 05/13] reverted the 'fix of floating point' and added preset default set values --- src/ds5/advanced_mode/json_loader.hpp | 2 +- src/ds5/advanced_mode/presets.cpp | 71 +++++++++++++++++++++------ 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/src/ds5/advanced_mode/json_loader.hpp b/src/ds5/advanced_mode/json_loader.hpp index 24998e7172..0c8a267721 100644 --- a/src/ds5/advanced_mode/json_loader.hpp +++ b/src/ds5/advanced_mode/json_loader.hpp @@ -135,7 +135,7 @@ namespace librealsense void load(const std::string& str) override { float value = static_cast(::atof(str.c_str())); - strct->vals[0].*field = static_cast(std::floor(scale * value + 0.5f)); //in order to convert float to int correctly we add 0.5 and then use the floor function + strct->vals[0].*field = static_cast(scale * value); strct->update = true; } diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 9d013bca08..08c3999072 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -197,7 +197,7 @@ namespace librealsense p.cc.colorCorrection10 = -0.194336f; p.cc.colorCorrection11 = -0.194336f; p.cc.colorCorrection12 = -0.589844f; - p.depth_table.depthClampMax = 65536; + p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; p.depth_table.depthUnits = 100; p.depth_table.disparityShift = 0; @@ -255,18 +255,18 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; - p.cc.colorCorrection1 = 0.4620000123978f; - p.cc.colorCorrection2 = 0.5400000214577f; - p.cc.colorCorrection3 = 0.5400000214577f; - p.cc.colorCorrection4 = 0.2080000042915f; - p.cc.colorCorrection5 = -0.3319999873638f; - p.cc.colorCorrection6 = -0.2129999995232f; - p.cc.colorCorrection7 = -0.2129999995232f; - p.cc.colorCorrection8 = 0.6850000023842f; - p.cc.colorCorrection9 = 0.930999994278f; - p.cc.colorCorrection10 = -0.5540000200272f; - p.cc.colorCorrection11 = -0.5540000200272f; - p.cc.colorCorrection12 = 0.04600000008941f; + p.cc.colorCorrection1 = 0.461914; + p.cc.colorCorrection2 = 0.540039; + p.cc.colorCorrection3 = 0.540039; + p.cc.colorCorrection4 = 0.208008; + p.cc.colorCorrection5 = -0.332031; + p.cc.colorCorrection6 = -0.212891f; + p.cc.colorCorrection7 = -0.212891f; + p.cc.colorCorrection8 = 0.68457f; + p.cc.colorCorrection9 = 0.930664f; + p.cc.colorCorrection10 = -0.553711; + p.cc.colorCorrection11 = -0.553711; + p.cc.colorCorrection12 = 0.0458984; p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; p.depth_table.depthUnits = 1000; @@ -276,6 +276,19 @@ namespace librealsense p.census.vDiameter = 9; p.laser_state.laser_state = 1; p.laser_power.laser_power = 150.f; + p.color_auto_exposure.auto_exposure = 1; + p.color_exposure.exposure = 156; + p.color_backlight_compensation.backlight_compensation = 0; + p.color_brightness.brightness = 0; + p.color_contrast.contrast = 50; + p.color_gain.gain = 64; + p.color_gamma.gamma = 300; + p.color_hue.hue = 0; + p.color_power_line_frequency.power_line_frequency = 3; + p.color_saturation.saturation = 64; + p.color_sharpness.sharpness = 50; + p.color_auto_white_balance.auto_white_balance = 1; + p.color_white_balance.white_balance = 4600; p.depth_exposure.exposure = 33000.f; p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; @@ -347,8 +360,8 @@ namespace librealsense p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; } - - void default_430(preset& p) + + void default_430(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; p.depth_controls.deepSeaNeighborThreshold = 7; @@ -414,8 +427,22 @@ namespace librealsense p.laser_power.laser_power = 150.f; p.depth_exposure.exposure = 8500.f; p.depth_auto_exposure.auto_exposure = 1; + p.color_auto_exposure.auto_exposure = 1; + p.color_exposure.exposure = 156; + p.color_backlight_compensation.backlight_compensation = 0; + p.color_brightness.brightness = 0; + p.color_contrast.contrast = 50; + p.color_gain.gain = 64; + p.color_gamma.gamma = 300; + p.color_hue.hue = 0; + p.color_power_line_frequency.power_line_frequency = 3; + p.color_saturation.saturation = 64; + p.color_sharpness.sharpness = 50; + p.color_auto_white_balance.auto_white_balance = 1; + p.color_white_balance.white_balance = 4600; p.depth_gain.gain = 16.f; p.hdad.ignoreSAD = 0; + p.amplitude_factor.amplitude = 0.f; } void default_450(preset& p) @@ -484,8 +511,22 @@ namespace librealsense p.laser_power.laser_power = 150.f; p.depth_exposure.exposure = 8500.f; p.depth_auto_exposure.auto_exposure = 1; + p.color_auto_exposure.auto_exposure = 1; + p.color_exposure.exposure = 156; + p.color_backlight_compensation.backlight_compensation = 0; + p.color_brightness.brightness = 0; + p.color_contrast.contrast = 50; + p.color_gain.gain = 64; + p.color_gamma.gamma = 300; + p.color_hue.hue = 0; + p.color_power_line_frequency.power_line_frequency = 3; + p.color_saturation.saturation = 64; + p.color_sharpness.sharpness = 50; + p.color_auto_white_balance.auto_white_balance = 1; + p.color_white_balance.white_balance = 4600; p.depth_gain.gain = 16.f; p.hdad.ignoreSAD = 0; + p.amplitude_factor.amplitude = 0.f; } From 2955e65c27a7308f9fa2d93ae0ef7d45687cd08e Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Mon, 30 Aug 2021 12:45:19 +0300 Subject: [PATCH 06/13] deletion of extra spaces --- src/ds5/advanced_mode/presets.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 08c3999072..c5badc3d8c 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -502,14 +502,14 @@ namespace librealsense p.cc.colorCorrection12 = -0.355469f; p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; - p.depth_table.depthUnits = 1000; - p.depth_table.disparityShift = 0; - p.ae.meanIntensitySetPoint = 1000; - p.census.uDiameter = 9; - p.census.vDiameter = 9; + p.depth_table.depthUnits = 1000; + p.depth_table.disparityShift = 0; + p.ae.meanIntensitySetPoint = 1000; + p.census.uDiameter = 9; + p.census.vDiameter = 9; p.laser_state.laser_state = 1; p.laser_power.laser_power = 150.f; - p.depth_exposure.exposure = 8500.f; + p.depth_exposure.exposure = 8500.f; p.depth_auto_exposure.auto_exposure = 1; p.color_auto_exposure.auto_exposure = 1; p.color_exposure.exposure = 156; @@ -525,7 +525,7 @@ namespace librealsense p.color_auto_white_balance.auto_white_balance = 1; p.color_white_balance.white_balance = 4600; p.depth_gain.gain = 16.f; - p.hdad.ignoreSAD = 0; + p.hdad.ignoreSAD = 0; p.amplitude_factor.amplitude = 0.f; } @@ -546,7 +546,7 @@ namespace librealsense p.depth_controls.textureDifferenceThreshold = 1722; p.rsm.diffThresh = 1.65625f; p.rsm.removeThresh = 136; - p.rsm.rsmBypass = 0; + p.rsm.rsmBypass = 0; p.rsm.sloRauDiffThresh = 0.785714f; p.rsvc.minEast = 6; p.rsvc.minNorth = 3; @@ -588,12 +588,12 @@ namespace librealsense p.depth_controls.lrAgreeThreshold = 18; p.depth_controls.minusDecrement = 6; p.depth_controls.plusIncrement = 21; - p.depth_controls.scoreThreshA = 96; - p.depth_controls.scoreThreshB = 1443; + p.depth_controls.scoreThreshA = 96; + p.depth_controls.scoreThreshB = 1443; p.depth_controls.textureCountThreshold = 0; p.depth_controls.textureDifferenceThreshold = 2466; p.rsm.diffThresh = 1.21875f; - p.rsm.removeThresh = 82; + p.rsm.removeThresh = 82; p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json p.rsm.sloRauDiffThresh = 0.28125f; p.rsvc.minEast = 2; @@ -609,9 +609,9 @@ namespace librealsense p.color_control.disableSADNormalize = 0; p.color_control.disableSLOLeftColor = 0; p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 112; + p.rctc.rauDiffThresholdBlue = 112; p.rctc.rauDiffThresholdGreen = 585; - p.rctc.rauDiffThresholdRed = 18; + p.rctc.rauDiffThresholdRed = 18; p.sctc.diffThresholdBlue = 8; p.sctc.diffThresholdGreen = 200; p.sctc.diffThresholdRed = 279; @@ -662,7 +662,7 @@ namespace librealsense p.rctc.rauDiffThresholdRed = 186; p.sctc.diffThresholdBlue = 16; p.sctc.diffThresholdGreen = 259; - p.sctc.diffThresholdRed = 896; + p.sctc.diffThresholdRed = 896; p.spc.sloK1Penalty = 132; p.spc.sloK1PenaltyMod1 = 77; p.spc.sloK1PenaltyMod2 = 234; From b52b64a5e7291a74bdb8e36d3cda3072151c6e8d Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Tue, 31 Aug 2021 10:22:29 +0300 Subject: [PATCH 07/13] fixed the int field accuracy for json loader --- src/ds5/advanced_mode/json_loader.hpp | 6 +++++- src/ds5/advanced_mode/presets.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ds5/advanced_mode/json_loader.hpp b/src/ds5/advanced_mode/json_loader.hpp index 0c8a267721..40c3568ccb 100644 --- a/src/ds5/advanced_mode/json_loader.hpp +++ b/src/ds5/advanced_mode/json_loader.hpp @@ -135,7 +135,11 @@ namespace librealsense void load(const std::string& str) override { float value = static_cast(::atof(str.c_str())); - strct->vals[0].*field = static_cast(scale * value); + if (std::is_integral_v) //in order to convert float to int correctly we add 0.5 and then use the floor function + value = std::floor(scale * value + 0.5f); + else + value = scale * value; + strct->vals[0].*field = static_cast(value); strct->update = true; } diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index c5badc3d8c..582ce5a357 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -289,7 +289,7 @@ namespace librealsense p.color_sharpness.sharpness = 50; p.color_auto_white_balance.auto_white_balance = 1; p.color_white_balance.white_balance = 4600; - p.depth_exposure.exposure = 33000.f; + p.depth_exposure.exposure = 32000.f; p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; } From ae4856c0db03b1640379351b8d89c9dfe6f40647 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Tue, 31 Aug 2021 18:02:06 +0300 Subject: [PATCH 08/13] changed the is_integral function so it will work in linux --- src/ds5/advanced_mode/json_loader.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ds5/advanced_mode/json_loader.hpp b/src/ds5/advanced_mode/json_loader.hpp index 40c3568ccb..cd573397dd 100644 --- a/src/ds5/advanced_mode/json_loader.hpp +++ b/src/ds5/advanced_mode/json_loader.hpp @@ -135,7 +135,7 @@ namespace librealsense void load(const std::string& str) override { float value = static_cast(::atof(str.c_str())); - if (std::is_integral_v) //in order to convert float to int correctly we add 0.5 and then use the floor function + if (std::is_integral::value) //in order to convert float to int correctly we add 0.5 and then use the floor function value = std::floor(scale * value + 0.5f); else value = scale * value; From 0db52a5e8ec01d6b03ad01b918889d7ebcd9bddd Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Sun, 5 Sep 2021 14:56:22 +0300 Subject: [PATCH 09/13] added two presets for d455 - high_res & mid_low_res --- src/ds5/advanced_mode/advanced_mode.cpp | 23 +++++-- src/ds5/advanced_mode/presets.cpp | 89 ++++++++++++++++++++++++- src/ds5/advanced_mode/presets.h | 3 +- 3 files changed, 108 insertions(+), 7 deletions(-) diff --git a/src/ds5/advanced_mode/advanced_mode.cpp b/src/ds5/advanced_mode/advanced_mode.cpp index 76b63a5268..6e0e60a2fb 100644 --- a/src/ds5/advanced_mode/advanced_mode.cpp +++ b/src/ds5/advanced_mode/advanced_mode.cpp @@ -67,6 +67,12 @@ namespace librealsense const firmware_version& fw_version) { auto p = get_all(); + res_type res; + // configuration is empty before first streaming - so set default res + if (configuration.empty()) + res = low_resolution; + else + res = get_res_type(configuration.front().width, configuration.front().height); switch (preset) { @@ -80,13 +86,22 @@ namespace librealsense case ds::RS430_PID: case ds::RS430I_PID: case ds::RS435_RGB_PID: - case ds::RS435I_PID: case ds::RS465_PID: + //case ds::RS435I_PID: default_430(p); break; - case ds::RS455_PID: - default_450(p); - break; + //case ds::RS455_PID: + case ds::RS435I_PID: + switch (res) + { + case low_resolution: + case medium_resolution: + default_450_mid_low_res(p); + break; + case high_resolution: + default_450_high_res(p); + break; + } case ds::RS405U_PID: default_405u(p); break; diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 582ce5a357..67e9ddd096 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -444,8 +444,8 @@ namespace librealsense p.hdad.ignoreSAD = 0; p.amplitude_factor.amplitude = 0.f; } - - void default_450(preset& p) + // the only different between high res to mid & low is the amplitude_factor value + void default_450_high_res(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; p.depth_controls.deepSeaNeighborThreshold = 7; @@ -530,6 +530,91 @@ namespace librealsense } + void default_450_mid_low_res(preset& p) + { + p.depth_controls.deepSeaMedianThreshold = 500; + p.depth_controls.deepSeaNeighborThreshold = 7; + p.depth_controls.deepSeaSecondPeakThreshold = 325; + p.depth_controls.lrAgreeThreshold = 24; + p.depth_controls.minusDecrement = 10; + p.depth_controls.plusIncrement = 10; + p.depth_controls.scoreThreshA = 1; + p.depth_controls.scoreThreshB = 2047; + p.depth_controls.textureCountThreshold = 0; + p.depth_controls.textureDifferenceThreshold = 0; + p.rsm.diffThresh = 4.f; + p.rsm.removeThresh = 63; + p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json + p.rsm.sloRauDiffThresh = 1.f; + p.rsvc.minEast = 1; + p.rsvc.minNorth = 1; + p.rsvc.minNSsum = 3; + p.rsvc.minSouth = 1; + p.rsvc.minWest = 1; + p.rsvc.minWEsum = 3; + p.rsvc.uShrink = 3; + p.rsvc.vShrink = 1; + p.color_control.disableRAUColor = 0; + p.color_control.disableSADColor = 0; + p.color_control.disableSADNormalize = 0; + p.color_control.disableSLOLeftColor = 0; + p.color_control.disableSLORightColor = 0; + p.rctc.rauDiffThresholdBlue = 51; + p.rctc.rauDiffThresholdGreen = 51; + p.rctc.rauDiffThresholdRed = 51; + p.sctc.diffThresholdBlue = 72; + p.sctc.diffThresholdGreen = 72; + p.sctc.diffThresholdRed = 72; + p.spc.sloK1Penalty = 60; + p.spc.sloK1PenaltyMod1 = 105; + p.spc.sloK1PenaltyMod2 = 70; + p.spc.sloK2Penalty = 342; + p.spc.sloK2PenaltyMod1 = 190; + p.spc.sloK2PenaltyMod2 = 130; + p.hdad.lambdaAD = 800.f; + p.hdad.lambdaCensus = 26.f; + p.cc.colorCorrection1 = -0.493164f; + p.cc.colorCorrection2 = 0.831055f; + p.cc.colorCorrection3 = 0.831055f; + p.cc.colorCorrection4 = -0.368164f; + p.cc.colorCorrection5 = -0.133789f; + p.cc.colorCorrection6 = -0.323242f; + p.cc.colorCorrection7 = -0.323242f; + p.cc.colorCorrection8 = 1.19141f; + p.cc.colorCorrection9 = 0.90918f; + p.cc.colorCorrection10 = -0.272461f; + p.cc.colorCorrection11 = -0.272461f; + p.cc.colorCorrection12 = -0.355469f; + p.depth_table.depthClampMax = 65536; + p.depth_table.depthClampMin = 0; + p.depth_table.depthUnits = 1000; + p.depth_table.disparityShift = 0; + p.ae.meanIntensitySetPoint = 1000; + p.census.uDiameter = 9; + p.census.vDiameter = 9; + p.laser_state.laser_state = 1; + p.laser_power.laser_power = 150.f; + p.depth_exposure.exposure = 8500.f; + p.depth_auto_exposure.auto_exposure = 1; + p.color_auto_exposure.auto_exposure = 1; + p.color_exposure.exposure = 156; + p.color_backlight_compensation.backlight_compensation = 0; + p.color_brightness.brightness = 0; + p.color_contrast.contrast = 50; + p.color_gain.gain = 64; + p.color_gamma.gamma = 300; + p.color_hue.hue = 0; + p.color_power_line_frequency.power_line_frequency = 3; + p.color_saturation.saturation = 64; + p.color_sharpness.sharpness = 50; + p.color_auto_white_balance.auto_white_balance = 1; + p.color_white_balance.white_balance = 4600; + p.depth_gain.gain = 16.f; + p.hdad.ignoreSAD = 0; + p.amplitude_factor.amplitude = 0.08f; + + } + void high_accuracy(preset& p) { p.census.uDiameter = 9; diff --git a/src/ds5/advanced_mode/presets.h b/src/ds5/advanced_mode/presets.h index 1248892c9d..8959e4144c 100644 --- a/src/ds5/advanced_mode/presets.h +++ b/src/ds5/advanced_mode/presets.h @@ -137,7 +137,8 @@ namespace librealsense void default_410(preset& p); void default_420(preset& p); void default_430(preset& p); - void default_450(preset& p); + void default_450_high_res(preset& p); + void default_450_mid_low_res(preset& p); void high_accuracy(preset& p); void high_density(preset& p); void mid_density(preset& p); From 0968b8403b2c9dc90b693adee69e4766ca83d33b Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Sun, 5 Sep 2021 14:59:28 +0300 Subject: [PATCH 10/13] fixed typos --- src/ds5/advanced_mode/advanced_mode.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ds5/advanced_mode/advanced_mode.cpp b/src/ds5/advanced_mode/advanced_mode.cpp index 6e0e60a2fb..629865c180 100644 --- a/src/ds5/advanced_mode/advanced_mode.cpp +++ b/src/ds5/advanced_mode/advanced_mode.cpp @@ -87,11 +87,10 @@ namespace librealsense case ds::RS430I_PID: case ds::RS435_RGB_PID: case ds::RS465_PID: - //case ds::RS435I_PID: + case ds::RS435I_PID: default_430(p); break; - //case ds::RS455_PID: - case ds::RS435I_PID: + case ds::RS455_PID: switch (res) { case low_resolution: From 7e834980906a9a889d34d0f6a9745d0aa41a1bf7 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Thu, 9 Sep 2021 18:54:41 +0300 Subject: [PATCH 11/13] made the d455 preset depends on resolution --- src/ds5/advanced_mode/advanced_mode.cpp | 7 ++- src/ds5/advanced_mode/presets.cpp | 80 ------------------------- 2 files changed, 6 insertions(+), 81 deletions(-) diff --git a/src/ds5/advanced_mode/advanced_mode.cpp b/src/ds5/advanced_mode/advanced_mode.cpp index 629865c180..427b36f896 100644 --- a/src/ds5/advanced_mode/advanced_mode.cpp +++ b/src/ds5/advanced_mode/advanced_mode.cpp @@ -91,15 +91,20 @@ namespace librealsense default_430(p); break; case ds::RS455_PID: + default_450_mid_low_res(p); switch (res) { case low_resolution: case medium_resolution: - default_450_mid_low_res(p); + //applied defaultly break; case high_resolution: default_450_high_res(p); break; + default: + throw invalid_value_exception(to_string() << "apply_preset(...) failed! Given device doesn't support Default Preset (pid=0x" << + std::hex << device_pid << ")"); + break; } case ds::RS405U_PID: default_405u(p); diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 67e9ddd096..f78ecadfa4 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -447,87 +447,7 @@ namespace librealsense // the only different between high res to mid & low is the amplitude_factor value void default_450_high_res(preset& p) { - p.depth_controls.deepSeaMedianThreshold = 500; - p.depth_controls.deepSeaNeighborThreshold = 7; - p.depth_controls.deepSeaSecondPeakThreshold = 325; - p.depth_controls.lrAgreeThreshold = 24; - p.depth_controls.minusDecrement = 10; - p.depth_controls.plusIncrement = 10; - p.depth_controls.scoreThreshA = 1; - p.depth_controls.scoreThreshB = 2047; - p.depth_controls.textureCountThreshold = 0; - p.depth_controls.textureDifferenceThreshold = 0; - p.rsm.diffThresh = 4.f; - p.rsm.removeThresh = 63; - p.rsm.rsmBypass = 0; // inverted field, should be the opposite in the json - p.rsm.sloRauDiffThresh = 1.f; - p.rsvc.minEast = 1; - p.rsvc.minNorth = 1; - p.rsvc.minNSsum = 3; - p.rsvc.minSouth = 1; - p.rsvc.minWest = 1; - p.rsvc.minWEsum = 3; - p.rsvc.uShrink = 3; - p.rsvc.vShrink = 1; - p.color_control.disableRAUColor = 0; - p.color_control.disableSADColor = 0; - p.color_control.disableSADNormalize = 0; - p.color_control.disableSLOLeftColor = 0; - p.color_control.disableSLORightColor = 0; - p.rctc.rauDiffThresholdBlue = 51; - p.rctc.rauDiffThresholdGreen = 51; - p.rctc.rauDiffThresholdRed = 51; - p.sctc.diffThresholdBlue = 72; - p.sctc.diffThresholdGreen = 72; - p.sctc.diffThresholdRed = 72; - p.spc.sloK1Penalty = 60; - p.spc.sloK1PenaltyMod1 = 105; - p.spc.sloK1PenaltyMod2 = 70; - p.spc.sloK2Penalty = 342; - p.spc.sloK2PenaltyMod1 = 190; - p.spc.sloK2PenaltyMod2 = 130; - p.hdad.lambdaAD = 800.f; - p.hdad.lambdaCensus = 26.f; - p.cc.colorCorrection1 = -0.493164f; - p.cc.colorCorrection2 = 0.831055f; - p.cc.colorCorrection3 = 0.831055f; - p.cc.colorCorrection4 = -0.368164f; - p.cc.colorCorrection5 = -0.133789f; - p.cc.colorCorrection6 = -0.323242f; - p.cc.colorCorrection7 = -0.323242f; - p.cc.colorCorrection8 = 1.19141f; - p.cc.colorCorrection9 = 0.90918f; - p.cc.colorCorrection10 = -0.272461f; - p.cc.colorCorrection11 = -0.272461f; - p.cc.colorCorrection12 = -0.355469f; - p.depth_table.depthClampMax = 65536; - p.depth_table.depthClampMin = 0; - p.depth_table.depthUnits = 1000; - p.depth_table.disparityShift = 0; - p.ae.meanIntensitySetPoint = 1000; - p.census.uDiameter = 9; - p.census.vDiameter = 9; - p.laser_state.laser_state = 1; - p.laser_power.laser_power = 150.f; - p.depth_exposure.exposure = 8500.f; - p.depth_auto_exposure.auto_exposure = 1; - p.color_auto_exposure.auto_exposure = 1; - p.color_exposure.exposure = 156; - p.color_backlight_compensation.backlight_compensation = 0; - p.color_brightness.brightness = 0; - p.color_contrast.contrast = 50; - p.color_gain.gain = 64; - p.color_gamma.gamma = 300; - p.color_hue.hue = 0; - p.color_power_line_frequency.power_line_frequency = 3; - p.color_saturation.saturation = 64; - p.color_sharpness.sharpness = 50; - p.color_auto_white_balance.auto_white_balance = 1; - p.color_white_balance.white_balance = 4600; - p.depth_gain.gain = 16.f; - p.hdad.ignoreSAD = 0; p.amplitude_factor.amplitude = 0.f; - } void default_450_mid_low_res(preset& p) From 586a44465441942d2483f608046fbcd90efa5ba9 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Mon, 13 Sep 2021 16:05:00 +0300 Subject: [PATCH 12/13] fix PR notes --- src/ds5/advanced_mode/presets.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index f78ecadfa4..00c33451cb 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -360,8 +360,8 @@ namespace librealsense p.depth_auto_exposure.auto_exposure = 1; p.depth_gain.gain = 16.f; } - - void default_430(preset& p) + + void default_430(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; p.depth_controls.deepSeaNeighborThreshold = 7; @@ -450,6 +450,7 @@ namespace librealsense p.amplitude_factor.amplitude = 0.f; } + //used as base preset for the D450 void default_450_mid_low_res(preset& p) { p.depth_controls.deepSeaMedianThreshold = 500; From e412aa57937ab0bf2bac331445eccf512441f7a9 Mon Sep 17 00:00:00 2001 From: Tomer Ashuach Date: Wed, 22 Sep 2021 08:52:58 +0300 Subject: [PATCH 13/13] fixing warning - explicitly writing float typo --- src/ds5/advanced_mode/presets.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ds5/advanced_mode/presets.cpp b/src/ds5/advanced_mode/presets.cpp index 00c33451cb..46435c8aa3 100644 --- a/src/ds5/advanced_mode/presets.cpp +++ b/src/ds5/advanced_mode/presets.cpp @@ -255,18 +255,18 @@ namespace librealsense p.spc.sloK2PenaltyMod2 = 130; p.hdad.lambdaAD = 800.f; p.hdad.lambdaCensus = 26.f; - p.cc.colorCorrection1 = 0.461914; - p.cc.colorCorrection2 = 0.540039; - p.cc.colorCorrection3 = 0.540039; - p.cc.colorCorrection4 = 0.208008; - p.cc.colorCorrection5 = -0.332031; + p.cc.colorCorrection1 = 0.461914f; + p.cc.colorCorrection2 = 0.540039f; + p.cc.colorCorrection3 = 0.540039f; + p.cc.colorCorrection4 = 0.208008f; + p.cc.colorCorrection5 = -0.332031f; p.cc.colorCorrection6 = -0.212891f; p.cc.colorCorrection7 = -0.212891f; p.cc.colorCorrection8 = 0.68457f; p.cc.colorCorrection9 = 0.930664f; - p.cc.colorCorrection10 = -0.553711; - p.cc.colorCorrection11 = -0.553711; - p.cc.colorCorrection12 = 0.0458984; + p.cc.colorCorrection10 = -0.553711f; + p.cc.colorCorrection11 = -0.553711f; + p.cc.colorCorrection12 = 0.0458984f; p.depth_table.depthClampMax = 65536; p.depth_table.depthClampMin = 0; p.depth_table.depthUnits = 1000;