Skip to content

Commit 3c5e36a

Browse files
committed
changed depth hit threshold parameter implementation, tweeked parameters
1 parent 2843cd4 commit 3c5e36a

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed

‎opengl_ros/launch/depth_image_projection.launch‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
<arg name="bag_prefix" default="/mnt/log/d435"/>
44
<arg name="depth_width" default="640"/>
55
<arg name="depth_height" default="360"/>
6-
<arg name="depth_min" default="0.105"/>
6+
<arg name="depth_min" default="0.3"/>
77
<arg name="depth_max" default="10"/>
8-
<arg name="depth_hit_threshold" default="0.95"/>
8+
<arg name="depth_hit_threshold" default="0.1"/>
99
<arg name="depth_unknown_color" default="0"/> <!-- 0 to 255 -->
1010
<arg name="grid_map_width" default="200"/>
1111
<arg name="grid_map_height" default="200"/>
1212
<arg name="grid_map_resolution" default="0.1"/>
13-
<arg name="grid_map_layer_height" default="3.0"/>
13+
<arg name="grid_map_layer_height" default="2.0"/>
1414
<arg name="grid_map_accumulation_weight" default="0.001"/>
15-
<arg name="grid_map_decay" default="0.5"/>
15+
<arg name="grid_map_decay" default="0.95"/>
1616
<arg name="frame_rate" default="30"/>
1717

1818
<node pkg="opengl_ros" type="depth_image_projector"

‎opengl_ros/src/depth_image_projector_nodecore.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DepthImageProjectorNode::DepthImageProjectorNode(const ros::NodeHandle& nh, cons
3232
int unknownDepthColor;
3333
nh_.param<double>("min_depth", minDepth, 0.105);
3434
nh_.param<double>("max_depth", maxDepth, 10);
35-
nh_.param<double>("depth_hit_threshold", depthHitThreshold, 0.95);
35+
nh_.param<double>("depth_hit_threshold", depthHitThreshold, 0.01);
3636
nh_.param<int>("unknown_depth_color", unknownDepthColor, 255);
3737

3838
std::string vertexShader, geometryShader, fragmentShader, vertexShaderScaling, fragmentShaderScaling;

‎opengl_ros_lib/shader/fs_depth_image_projection.glsl‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@ void main(void)
1717
//TODO multilayer output based on depth which represents height
1818

1919
//If the height is out of the range, discard the fragment.
20-
if (gl_FragCoord.z < -gridMapLayerHeight / 2 || gridMapLayerHeight / 2 < gl_FragCoord.z)
20+
float height = gl_FragCoord.z / gl_FragCoord.w;
21+
if (height < -gridMapLayerHeight / 2 || gridMapLayerHeight / 2 < height)
2122
discard;
2223

2324
float validDepthMeasured = 1.0;
2425
if (validDepthInMeter.y <= hitDepth)
2526
validDepthMeasured = 0.0;
2627

2728
float accumulatedProbability = 0.0;
28-
if (0 < validDepthMeasured && hitDepth * depthHitThreshold < depth)
29+
if (0 < validDepthMeasured && hitDepth - depthHitThreshold < depth)
2930
accumulatedProbability = gridMapAccumulationWeight;
3031

3132
//store accumulated value in R channel

‎opengl_ros_lib/shader/fs_rgb_to_occupancy_grid.glsl‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ uniform float gridMapDecay;
77
uniform float gridMapResolution;
88
uniform mat4 mapToPreviousMap;
99

10-
in vec4 gl_FragCoord;
11-
1210
layout(location = 0) out float fragmentColor;
1311
//output 0 - 100 if valid depth is measured
1412
//output `unknownDepthColor` if valid depth is not measured

‎opengl_ros_lib/shader/vs_depth_image_projection.glsl‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ in vec3 input_pixel; //This input position is integer pixel coordinate in the op
1919

2020
out vertex
2121
{
22-
vec4 position; //The vertex coordinate of the point in grid map space.
22+
vec4 position; //The vertex coordinate of the point in grid map space
2323
//x = -1 to 1; which represents left to right
2424
//y = -1 to 1; which represents far to near, note this is flipped upside down
2525
//z = -1 to 1; which represents low to high,
2626
//w = 1
2727

28-
float depth; //The depth value in meter of the point.
28+
float depth; //The depth value in meter of the point
2929
} output_vertex;
3030

3131
void main(void)
@@ -57,10 +57,10 @@ void main(void)
5757
//Ouptut vertex coordinate
5858
//Projecting the point to the occupancy grid plane, in top down orthognal projection
5959
output_vertex.position = vec4(
60-
p.x / gridMapResolution / gridMapSize.x * 2, //convert to -1 to 1
61-
p.y / gridMapResolution / gridMapSize.y * 2, //set the origin at the center and flip upside down
62-
p.z / (gridMapLayerHeight / 2), //mapping -height/2 to height/2, to -1 to 1
60+
p.x / gridMapResolution / gridMapSize.x * 2, //convert to -1 to 1
61+
p.y / gridMapResolution / gridMapSize.y * 2, //set the origin at the center and flip upside down
62+
p.z / gridMapLayerHeight * 2, //mapping -height/2 to height/2, to -1 to 1
6363
1.0
6464
);
65-
output_vertex.depth = depth;
65+
output_vertex.depth = depth;
6666
}

0 commit comments

Comments
 (0)