Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptable depthcloud range #207

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions build/ros3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ ROS3D.closestAxisPoint = function(axisRay, camera, mousePos) {
* * url - the URL of the stream
* * streamType (optional) - the stream type: mjpeg or vp8 video (defaults to vp8)
* * f (optional) - the camera's focal length (defaults to standard Kinect calibration)
* * maxDepthPerTile (optional) - the factor with which we control the desired depth range (defaults to 1.0)
* * pointSize (optional) - point size (pixels) for rendered point cloud
* * width (optional) - width of the video stream
* * height (optional) - height of the video stream
Expand All @@ -192,6 +193,7 @@ ROS3D.DepthCloud = function(options) {
this.url = options.url;
this.streamType = options.streamType || 'vp8';
this.f = options.f || 526;
this.maxDepthPerTile = options.maxDepthPerTile || 1.0;
this.pointSize = options.pointSize || 3;
this.width = options.width || 1024;
this.height = options.height || 1024;
Expand Down Expand Up @@ -225,6 +227,7 @@ ROS3D.DepthCloud = function(options) {
'uniform float zOffset;',
'',
'uniform float focallength;',
'uniform float maxDepthPerTile;',
'',
'varying vec2 vUvP;',
'varying vec2 colorP;',
Expand Down Expand Up @@ -328,9 +331,9 @@ ROS3D.DepthCloud = function(options) {
' float z = -depth;',
' ',
' pos = vec4(',
' ( position.x / width - 0.5 ) * z * (1000.0/focallength) * -1.0,',
' ( position.y / height - 0.5 ) * z * (1000.0/focallength),',
' (- z + zOffset / 1000.0) * 2.0,',
' ( position.x / width - 0.5 ) * z * 0.5 * maxDepthPerTile * (1000.0/focallength) * -1.0,',
' ( position.y / height - 0.5 ) * z * 0.5 * maxDepthPerTile * (1000.0/focallength),',
' (- z + zOffset / 1000.0) * maxDepthPerTile,',
' 1.0);',
' ',
' vec2 maskP = vec2( position.x / (width*2.0), position.y / (height*2.0) );',
Expand Down Expand Up @@ -445,7 +448,11 @@ ROS3D.DepthCloud.prototype.initStreamer = function() {
'varianceThreshold' : {
type : 'f',
value : this.varianceThreshold
}
},
'maxDepthPerTile': {
type : 'f',
value : this.maxDepthPerTile
},
},
vertexShader : this.vertex_shader,
fragmentShader : this.fragment_shader
Expand Down
Loading