Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
BIAS::PMDWarp Class Reference

class can be used to warp sequences of pmd depth images into a second view with different parameters, including a different camera center. More...

#include <OpenGLFramework/SpecializedBatches/PMDWarp.hh>

+ Collaboration diagram for BIAS::PMDWarp:

Public Member Functions

void ChangeZClipping (double zNear, double zFar)
 
void Draw ()
 
void ExecuteLinearHypothesesAssignment (const BIAS::ProjectionParametersPerspective &relativePpp, double zNear, double zFar, float N, int output=0)
 Function is used to assign a hypotheses to the warped depth map. More...
 
BIAS::glfBatchGetBatch ()
 
BIAS::glfDepthBufferModeGetDepthBufferMode ()
 
void Init (const BIAS::ProjectionParametersPerspective &pppd, bool targetParametersHaveDistortion=false)
 Initializes all neccessary data in order to render using a batch. More...
 
 PMDWarp ()
 
void SetDispForDistanceAndScale (const float &dist_from_cam, const float &disp, const float &scale)
 if disparity output is required, then points with the distance (dist_from_cam) will get disparity (disp) all disparities will also be scaled with the given scale factor More...
 
void SetRenderTarget (const BIAS::glfRenderTarget *renderTarget)
 
void SetTargetCameraParameters (const BIAS::ProjectionParametersPerspective &relativePpp, double zNear, double zFar)
 is also used to determine viewport More...
 
void SetTargetCameraParameters (BIAS::Matrix4x4< double > modelViewMatrix, BIAS::Matrix4x4< double > projectionMatrix, unsigned int width, unsigned int height)
 
void SetTargetCameraParametersToGlobal (bool global)
 
void SetViewportSize (unsigned int width, unsigned int height)
 
void SetViewportToGlobal (bool global)
 
void UploadDepthMap (const BIAS::Image< float > &pmdDepthImage)
 Upload the pmd depth image to the graphics card. More...
 
void UploadDepthMap (const BIAS::ImageBase &pmdDepthImage)
 Upload the pmd depth image to the graphics card. More...
 
void UploadProjectiveTexture (const BIAS::Image< unsigned char > &projectiveTexture)
 Upload the color image to the graphics card. More...
 
void UseProjectiveTexturing (const BIAS::ProjectionParametersPerspective &ppp)
 ppp extrinsicis have to be in global coordinates of pppd of Init call! projective texturing cannot deal with distortion! More...
 
 ~PMDWarp ()
 

Protected Member Functions

void SetupDefaultPrimitiveRendering_ ()
 
void SetupShadersDefault_ ()
 
void SetupShadersProjectiveTexturing_ ()
 

Protected Attributes

BIAS::glfBatch batch_
 
bool defaultRendering_
 
BIAS::glfDepthBufferMode depthBufferMode_
 
unsigned int depthImageHeight_
 
unsigned int depthImageWidth_
 
BIAS::glfElementBuffer elements_
 
BIAS::glfShader fragmentProgram_
 
BIAS::glfShader geometryProgram_
 
BIAS::glfPassiveRenderMatrix globalModelViewNProjection_
 
BIAS::glfPassiveViewport globalViewport_
 
float maxSize_
 
BIAS::glfMatrix modelView_
 
BIAS::glfTexture2D pmdDepthImage_
 
BIAS::ProjectionParametersPerspective pmdParams_
 
BIAS::glfMatrix Projection_
 
BIAS::glfTexture2D projectiveTexture_
 
BIAS::glfShaderProgram shaderProgram_
 
bool targetParametersHaveDistortion_
 
BIAS::ProjectionParametersPerspective targetParams_
 
BIAS::glfMatrix textureMatrix_
 
BIAS::glfShader vertexProgram_
 
BIAS::glfVertexBuffer vertices_
 
BIAS::glfViewport viewport_
 

Detailed Description

class can be used to warp sequences of pmd depth images into a second view with different parameters, including a different camera center.

Attention
this a specialized implementation, mind the usage.

usage:

deliverence of output can be controlled using the SetRenderTarget() method.

Author
bartczak 02/2008

Definition at line 61 of file PMDWarp.hh.

Constructor & Destructor Documentation

PMDWarp::~PMDWarp ( )

Definition at line 248 of file PMDWarp.cpp.

PMDWarp::PMDWarp ( )

Definition at line 243 of file PMDWarp.cpp.

Member Function Documentation

void PMDWarp::ChangeZClipping ( double  zNear,
double  zFar 
)

Definition at line 206 of file PMDWarp.cpp.

void PMDWarp::Draw ( )
void PMDWarp::ExecuteLinearHypothesesAssignment ( const BIAS::ProjectionParametersPerspective relativePpp,
double  zNear,
double  zFar,
float  N,
int  output = 0 
)

Function is used to assign a hypotheses to the warped depth map.

The result will be pushed to the MRT target identified by output. The result is a 3D image the first two channels coding the two representants the warped depth is lying in between, if an exact representant is found, both will be the same. The third channels is holding the relative distance of the depth to the two representants. The range between zNear and zFar is equidistantly discretized into N intervalls.

Attention
call after init, use of SetTargetCameraParameters() is not required.

Definition at line 458 of file PMDWarp.cpp.

References BIAS::glfShader::Create(), fragmentProgram_, BIAS::glfShader::GetInfoLog(), BIAS::glfShaderProgram::GetInfoLog(), BIAS::glfShaderProgram::Link(), SetTargetCameraParameters(), BIAS::glfShaderProgram::SetUniform(), and shaderProgram_.

glfBatch & PMDWarp::GetBatch ( )

Definition at line 69 of file PMDWarp.cpp.

BIAS::glfDepthBufferMode & PMDWarp::GetDepthBufferMode ( )

Definition at line 75 of file PMDWarp.cpp.

void PMDWarp::Init ( const BIAS::ProjectionParametersPerspective pppd,
bool  targetParametersHaveDistortion = false 
)

Initializes all neccessary data in order to render using a batch.

Parameters
parametersHaveDistortionis a flag the toggles the use of distortion parameters, if this is set to false then a shader using idealy perspective camera parameters is used, otherwise vertices are displaced so that they form a distorted image, uniform params are derived from target parameters (see SetTargetCameraParameters)!
Attention
call this method only if the gl-context that has to be used is active and valid.

Definition at line 36 of file PMDWarp.cpp.

References BIAS::ProjectionParametersBase::GetImageSize().

void PMDWarp::SetDispForDistanceAndScale ( const float &  dist_from_cam,
const float &  disp,
const float &  scale 
)

if disparity output is required, then points with the distance (dist_from_cam) will get disparity (disp) all disparities will also be scaled with the given scale factor

Definition at line 449 of file PMDWarp.cpp.

References BIAS::glfShaderProgram::SetUniform(), and shaderProgram_.

void PMDWarp::SetRenderTarget ( const BIAS::glfRenderTarget renderTarget)

Definition at line 129 of file PMDWarp.cpp.

void PMDWarp::SetTargetCameraParameters ( const BIAS::ProjectionParametersPerspective relativePpp,
double  zNear,
double  zFar 
)

is also used to determine viewport

Attention
relativePpp means extrinsics relative to the pppd param passed to Init().

Definition at line 143 of file PMDWarp.cpp.

References BIAS::ProjectionParametersPerspective::GetUndistortion().

Referenced by ExecuteLinearHypothesesAssignment().

void PMDWarp::SetTargetCameraParameters ( BIAS::Matrix4x4< double >  modelViewMatrix,
BIAS::Matrix4x4< double >  projectionMatrix,
unsigned int  width,
unsigned int  height 
)
Attention
This method should not be used if distortion is used, if distortion parameters are required and you use this method the result is undefined.

Definition at line 166 of file PMDWarp.cpp.

void PMDWarp::SetTargetCameraParametersToGlobal ( bool  global)

Definition at line 177 of file PMDWarp.cpp.

void PMDWarp::SetupDefaultPrimitiveRendering_ ( )
protected
void PMDWarp::SetupShadersDefault_ ( )
protected
void PMDWarp::SetupShadersProjectiveTexturing_ ( )
protected
void PMDWarp::SetViewportSize ( unsigned int  width,
unsigned int  height 
)

Definition at line 135 of file PMDWarp.cpp.

void PMDWarp::SetViewportToGlobal ( bool  global)

Definition at line 193 of file PMDWarp.cpp.

void PMDWarp::UploadDepthMap ( const BIAS::Image< float > &  pmdDepthImage)

Upload the pmd depth image to the graphics card.

Do not flip the image!

Definition at line 83 of file PMDWarp.cpp.

void PMDWarp::UploadDepthMap ( const BIAS::ImageBase pmdDepthImage)

Upload the pmd depth image to the graphics card.

Do not flip the image!

Definition at line 89 of file PMDWarp.cpp.

void PMDWarp::UploadProjectiveTexture ( const BIAS::Image< unsigned char > &  projectiveTexture)

Upload the color image to the graphics card.

Do not flip the image! projective texturing cannot deal with distortion!

Definition at line 123 of file PMDWarp.cpp.

void PMDWarp::UseProjectiveTexturing ( const BIAS::ProjectionParametersPerspective ppp)

ppp extrinsicis have to be in global coordinates of pppd of Init call! projective texturing cannot deal with distortion!

Definition at line 95 of file PMDWarp.cpp.

References BIAS::CoordinateTransform3D::BecomeRelativeTransform(), BIAS::ProjectionParametersBase::GetC(), BIAS::ProjectionParametersBase::GetPose(), and BIAS::ProjectionParametersBase::SetPose().

Member Data Documentation

BIAS::glfBatch BIAS::PMDWarp::batch_
protected

Definition at line 178 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

bool BIAS::PMDWarp::defaultRendering_
protected

Definition at line 182 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

BIAS::glfDepthBufferMode BIAS::PMDWarp::depthBufferMode_
protected

Definition at line 167 of file PMDWarp.hh.

unsigned int BIAS::PMDWarp::depthImageHeight_
protected

Definition at line 180 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

unsigned int BIAS::PMDWarp::depthImageWidth_
protected

Definition at line 179 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

BIAS::glfElementBuffer BIAS::PMDWarp::elements_
protected

Definition at line 165 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

BIAS::glfShader BIAS::PMDWarp::fragmentProgram_
protected
BIAS::glfShader BIAS::PMDWarp::geometryProgram_
protected

Definition at line 173 of file PMDWarp.hh.

Referenced by SetupShadersDefault_().

BIAS::glfPassiveRenderMatrix BIAS::PMDWarp::globalModelViewNProjection_
protected

Definition at line 158 of file PMDWarp.hh.

BIAS::glfPassiveViewport BIAS::PMDWarp::globalViewport_
protected

Definition at line 161 of file PMDWarp.hh.

float BIAS::PMDWarp::maxSize_
protected

Definition at line 190 of file PMDWarp.hh.

BIAS::glfMatrix BIAS::PMDWarp::modelView_
protected

Definition at line 156 of file PMDWarp.hh.

BIAS::glfTexture2D BIAS::PMDWarp::pmdDepthImage_
protected

Definition at line 169 of file PMDWarp.hh.

BIAS::ProjectionParametersPerspective BIAS::PMDWarp::pmdParams_
protected

Definition at line 153 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

BIAS::glfMatrix BIAS::PMDWarp::Projection_
protected

Definition at line 157 of file PMDWarp.hh.

BIAS::glfTexture2D BIAS::PMDWarp::projectiveTexture_
protected

Definition at line 175 of file PMDWarp.hh.

BIAS::glfShaderProgram BIAS::PMDWarp::shaderProgram_
protected
bool BIAS::PMDWarp::targetParametersHaveDistortion_
protected

Definition at line 188 of file PMDWarp.hh.

Referenced by SetupShadersDefault_(), and SetupShadersProjectiveTexturing_().

BIAS::ProjectionParametersPerspective BIAS::PMDWarp::targetParams_
protected

Definition at line 154 of file PMDWarp.hh.

BIAS::glfMatrix BIAS::PMDWarp::textureMatrix_
protected

Definition at line 176 of file PMDWarp.hh.

BIAS::glfShader BIAS::PMDWarp::vertexProgram_
protected

Definition at line 171 of file PMDWarp.hh.

Referenced by SetupShadersDefault_(), and SetupShadersProjectiveTexturing_().

BIAS::glfVertexBuffer BIAS::PMDWarp::vertices_
protected

Definition at line 164 of file PMDWarp.hh.

Referenced by SetupDefaultPrimitiveRendering_().

BIAS::glfViewport BIAS::PMDWarp::viewport_
protected

Definition at line 160 of file PMDWarp.hh.


The documentation for this class was generated from the following files: