43 #include <Eigen/Geometry>
46 #include <condition_variable>
89 const std::string& render_vertex_shader =
"",
const std::string& render_fragment_shader =
"",
90 const std::string& filter_vertex_shader =
"",
const std::string& filter_fragment_shader =
"");
117 void filter(
const void* sensor_data, GLushort
type,
bool wait =
false)
const;
187 void initialize(
const std::string& render_vertex_shader,
const std::string& render_fragment_shader,
188 const std::string& filter_vertex_shader,
const std::string& filter_fragment_shader);
198 void run(
const std::string& render_vertex_shader,
const std::string& render_fragment_shader,
199 const std::string& filter_vertex_shader,
const std::string& filter_fragment_shader);
225 void addJob(
const JobPtr& job)
const;
233 void setSize(
unsigned int width,
unsigned int height);
GLMesh represents a mesh from geometric_shapes for rendering in GL frame buffers.
void setTransformCallback(const TransformCallback &transform_callback)
set the callback for retrieving transformations for each mesh.
std::mutex transform_callback_mutex_
mutex for synchronization of setting/calling transform_callback_
void doFilter(const void *sensor_data, const int encoding) const
the filter method that does the magic
void getModelLabels(LabelType *labels) const
retrieves the labels of the rendered model
std::map< MeshHandle, GLMeshPtr > meshes_
storage for meshed to be filtered
void filter(const void *sensor_data, GLushort type, bool wait=false) const
label/remove pixels from input depth-image
SensorModel::ParametersPtr sensor_parameters_
the parameters of the used sensor model
GLuint sensor_depth_texture_
handle depth texture from sensor data
GLuint shadow_threshold_location_
handle to GLSL location of shadow threshold
MeshFilterBase(const TransformCallback &transform_callback, const SensorModel::Parameters &sensor_parameters, const std::string &render_vertex_shader="", const std::string &render_fragment_shader="", const std::string &filter_vertex_shader="", const std::string &filter_fragment_shader="")
Constructor.
bool removeMeshHelper(MeshHandle handle)
used within a Job to allow the main thread removing meshes
~MeshFilterBase()
Destructor.
std::queue< JobPtr > jobs_queue_
OpenGL job queue that need to be processed by the worker thread.
void run(const std::string &render_vertex_shader, const std::string &render_fragment_shader, const std::string &filter_vertex_shader, const std::string &filter_fragment_shader)
filtering thread
bool stop_
indicates whether the filtering loop should stop
void addMeshHelper(MeshHandle handle, const shapes::Mesh &cmesh)
used within a Job to allow the main thread adding meshes
float padding_offset_
padding offset
GLRendererPtr depth_filter_
second pass renderer for filtering the results of first pass
void removeMesh(MeshHandle mesh_handle)
removes a mesh given by its handle
GLRendererPtr mesh_renderer_
first pass renderer for rendering the mesh
void initialize(const std::string &render_vertex_shader, const std::string &render_fragment_shader, const std::string &filter_vertex_shader, const std::string &filter_fragment_shader)
initializes OpenGL related things as well as renderers
void addJob(const JobPtr &job) const
add a Job for the main thread that needs to be executed there
MeshHandle next_handle_
next handle to be used for next mesh that is added
void setShadowThreshold(float threshold)
set the shadow threshold. points that are further away than the rendered model are filtered out....
float padding_scale_
padding scale
void deInitialize()
cleaning up
MeshHandle min_handle_
Handle values below this are all taken (this variable is used for more efficient computation of next_...
MeshHandle addMesh(const shapes::Mesh &mesh)
adds a mesh to the filter object.
TransformCallback transform_callback_
callback function for retrieving the mesh transformations
std::function< bool(MeshHandle, Eigen::Isometry3d &)> TransformCallback
void setPaddingOffset(float offset)
set the offset component of padding. This value is added to the scaled sensor-specific constant compo...
void getModelDepth(float *depth) const
retrieves the depth values of the rendered model
void getFilteredLabels(LabelType *labels) const
retrieves the labels of the input data
std::thread filter_thread_
the filtering thread that also holds the OpenGL context
void getFilteredDepth(float *depth) const
retrieves the filtered depth values
void setPaddingScale(float scale)
set the scale component of padding used to multiply with sensor-specific padding coefficients to get ...
void setSize(unsigned int width, unsigned int height)
sets the size of the fram buffers
std::mutex meshes_mutex_
mutex for synchronization of updating filtered meshes
std::condition_variable jobs_condition_
condition variable to notify the filtering thread if a new image arrived
std::mutex jobs_mutex_
mutex required for synchronization of condition states
float shadow_threshold_
threshold for shadowed pixels vs. filtered pixels
GLuint canvas_
canvas element (screen-filling quad) for second pass
Abstract Interface defining Sensor Parameters.
MOVEIT_CLASS_FORWARD(Job)