43 float near_clipping_plane_distance,
44 float far_clipping_plane_distance,
float fx,
float fy,
float cx,
45 float cy,
float base_line,
float disparity_resolution)
51 , base_line_(base_line)
52 , disparity_resolution_(disparity_resolution)
53 , padding_coefficients_(
Eigen::Vector3f(disparity_resolution_ / (fx_ * base_line_), 0, 0))
118 "uniform vec3 padding_coefficients;" 121 " gl_FrontColor = gl_Color;" 122 " gl_BackColor = gl_Color;" 123 " vec4 vertex = gl_ModelViewMatrix * gl_Vertex;" 124 " vec3 normal = normalize(gl_NormalMatrix * gl_Normal);" 125 " float lambda = padding_coefficients.x * vertex.z * vertex.z + padding_coefficients.y * vertex.z + " 126 "padding_coefficients.z;" 127 " gl_Position = gl_ProjectionMatrix * (vertex + lambda * vec4(normal,0) );" 128 " gl_Position.y = -gl_Position.y;" 134 " gl_FragColor = gl_Color;" 140 " gl_FrontColor = gl_Color;" 141 " gl_TexCoord[0] = gl_MultiTexCoord0;" 142 " gl_Position = gl_Vertex;" 143 " gl_Position.w = 1.0;" 148 "uniform sampler2D sensor;" 149 "uniform sampler2D depth;" 150 "uniform sampler2D label;" 151 "uniform float near;" 153 "uniform float shadow_threshold;" 154 "const float shadowLabel = 1.0 / 255.0;" 155 "const float nearLabel = 2.0 / 255.0;" 156 "const float farLabel = 3.0 / 255.0;" 157 "float f_n = far - near;" 158 "float threshold = shadow_threshold / f_n;" 161 " float sValue = float(texture2D(sensor, gl_TexCoord[0].st));" 162 " if (sValue <= 0) {" 163 " gl_FragColor = vec4 (nearLabel, 0, 0, 0);" 167 " float dValue = float(texture2D(depth, gl_TexCoord[0].st));" 168 " float zValue = dValue * near / (far - dValue * f_n);" 169 " float diff = sValue - zValue;" 170 " if (diff < 0 && sValue < 1) {" 171 " gl_FragColor = vec4 (0, 0, 0, 0);" 172 " gl_FragDepth = float(texture2D(sensor, gl_TexCoord[0].st));" 173 " } else if (diff > threshold) {" 174 " gl_FragColor = vec4 (shadowLabel, 0, 0, 0);" 175 " gl_FragDepth = float(texture2D(sensor, gl_TexCoord[0].st));" 176 " } else if (sValue == 1) {" 177 " gl_FragColor = vec4 (farLabel, 0, 0, 0);" 178 " gl_FragDepth = float(texture2D(sensor, gl_TexCoord[0].st));" 180 " gl_FragColor = texture2D(label, gl_TexCoord[0].st);" Parameters(unsigned width, unsigned height, float near_clipping_plane_distance, float far_clipping_plane_distance, float fx, float fy, float cx, float cy, float base_line, float disparity_resolution)
Constructor.
const Eigen::Vector3f padding_coefficients_
padding coefficients
const GLuint & getProgramID() const
float cx_
x component of principal point
void setFilterParameters(GLRenderer &renderer) const
set the shader parameters required for the mesh filtering
float base_line_
distance of the two projective devices that are used to determine the disparities ...
void setCameraParameters(float fx, float fy, float cx, float cy)
set the camera parameters
float fy_
focal length in y-direction
static const std::string filterVertexShaderSource
source code of the vertex shader used to filter the depth map
unsigned width_
width of depth maps generated by the sensor
float far_clipping_plane_distance_
distance of far clipping plane
void setDisparityResolution(float disparity_resolution)
the quantization of disparity values in pixels. Usually 1/16th or 1/8th for OpenNI compatible devices...
void setBaseline(float base_line)
sets the base line = distance of the two projective devices (camera, projector-camera) ...
Abstracts the OpenGL frame buffer objects, and provides an interface to render meshes, and retrieve the color and depth ap from opengl.
float fx_
focal length in x-direction
static const StereoCameraModel::Parameters & RegisteredPSDKParams
predefined sensor model for OpenNI compatible devices (e.g., PrimeSense, Kinect, Asus Xtion) ...
Parameters for Stereo-like devices.
float near_clipping_plane_distance_
distance of near clipping plane
float disparity_resolution_
resolution/quantization of disparity values
Abstract Interface defining Sensor Parameters.
static const std::string renderFragmentShaderSource
source code of the fragment shader used to render the meshes
static const std::string filterFragmentShaderSource
source code of the fragment shader used to filter the depth map
~Parameters()
Descturctor.
void setCameraParameters(float fx, float fy, float cx, float cy)
sets the camera parameters of the pinhole camera where the disparities were obtained. Usually the left camera
void setBufferSize(unsigned width, unsigned height)
set the size of fram buffers
const Eigen::Vector3f & getPaddingCoefficients() const
returns the coefficients that are required for obtaining the padding for meshes
static const std::string renderVertexShaderSource
source code of the vertex shader used to render the meshes
void setRenderParameters(GLRenderer &renderer) const
set the shader parameters required for the model rendering
SensorModel::Parameters * clone() const
polymorphic clone method
void setClippingRange(float near, float far)
sets the near and far clipping plane distances in meters
unsigned height_
height of depth maps generated by the sensor
float cy_
y component of principal point
Abstract Interface defining a sensor model for mesh filtering.