Visual Servoing Platform
version 3.6.1 under development (2024-11-15)
|
#include <visp3/gui/vpPclViewer.h>
Classes | |
struct | legendParams |
Public Types | |
typedef pcl::PointXYZRGB | pclPointXYZRGB |
typedef pcl::PointCloud< pclPointXYZRGB > | pclPointCloudPointXYZRGB |
typedef pclPointCloudPointXYZRGB::Ptr | pclPointCloudPointXYZRGBPtr |
typedef struct vpPclViewer::legendParams | legendParams |
Public Member Functions | |
vpPclViewer (const std::string &title, const int &width=640, const int &height=480, const int &posU=720, const int &posV=560, const std::string &outFolder=std::string(), const double &ignoreThreshold=0.95) | |
~vpPclViewer () | |
void | setNameWindow (const std::string &nameWindow) |
void | setOutFolder (const std::string &outputFolder) |
void | setIgnoreThreshold (const double &thresh) |
unsigned int | addSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const std::string &name="", const std::vector< unsigned char > &v_color=std::vector< unsigned char >()) |
unsigned int | addSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const vpColVector &weights, const std::string &name="", const std::vector< unsigned char > &v_color=std::vector< unsigned char >()) |
void | updateSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id, const bool &hasToKeepColor=false) |
void | updateSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id, const vpColVector &weights, const bool &hasToKeepColor=false) |
void | display () |
void | refresh (const int &timeout=100, const bool &waitForDrawing=true) |
void | launchThread () |
void | stopThread () |
Protected Member Functions | |
void | threadUpdateSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id) |
void | threadUpdateSurfaceOriginalColor (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id) |
void | threadUpdateSurface (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id, const vpColVector &weights) |
void | threadUpdateSurfaceOriginalColor (const pclPointCloudPointXYZRGB::Ptr &surface, const unsigned int &id, const vpColVector &weights) |
void | loopThread () |
Static Protected Member Functions | |
static void | runThread (vpPclViewer *p_viewer) |
Protected Attributes | |
std::vector< pclPointCloudPointXYZRGB::Ptr > | m_vPointClouds |
std::vector< std::string > | m_vmeshid |
std::vector< legendParams > | m_vlegends |
std::vector< std::mutex * > | m_vpmutex |
std::vector< vpColVector > | m_vweights |
std::thread | m_threadDisplay |
bool | m_hasToRun |
std::string | m_title |
bool | m_hasToSavePCDs |
std::string | m_outFolder |
Static Protected Attributes | |
static pcl::visualization::PCLVisualizer::Ptr | sp_viewer |
static std::vector< std::vector< double > > | s_vhandler |
static int | s_width |
static int | s_height |
static int | s_posU |
static int | s_posV |
static double | s_ignoreThresh |
This class enables real time plotting of 3D point clouds. It relies on the PCL library. To see how to install PCL library, please refer to the Point Cloud Library (PCL) section. You can either plot in a non-blocking threaded manner or in a blocking manner. The point clouds can be displayed using their original colors, or using uniform colors to match a legend. Additionally, it is possible to use confidence weights to hide points that are not trusted. These weights can result from a robust estimation using for instance the vpRobust class.
Definition at line 68 of file vpPclViewer.h.
typedef struct vpPclViewer::legendParams vpPclViewer::legendParams |
Structure that contains all the required parameters to display a legend on the viewer.
typedef pcl::PointCloud<pclPointXYZRGB> vpPclViewer::pclPointCloudPointXYZRGB |
Definition at line 72 of file vpPclViewer.h.
typedef pclPointCloudPointXYZRGB::Ptr vpPclViewer::pclPointCloudPointXYZRGBPtr |
Definition at line 73 of file vpPclViewer.h.
typedef pcl::PointXYZRGB vpPclViewer::pclPointXYZRGB |
Definition at line 71 of file vpPclViewer.h.
vpPclViewer::vpPclViewer | ( | const std::string & | title, |
const int & | width = 640 , |
||
const int & | height = 480 , |
||
const int & | posU = 720 , |
||
const int & | posV = 560 , |
||
const std::string & | outFolder = std::string() , |
||
const double & | ignoreThreshold = 0.95 |
||
) |
Construct a new vpPclViewer object.
title | The title of the window of the viewer. |
width | The width of the window of the viewer. |
height | The height of the window of the viewer. |
posU | The position on the horizontal axis of the screen of the window of the viewer. |
posV | The position on the vertical axis of the screen of the window of the viewer. |
outFolder | If different from the empty string, the point clouds will be saved in this folder. |
ignoreThreshold | A point for which the weight is below this threshold will be displayed in black. |
vpPclViewer::~vpPclViewer | ( | ) |
unsigned int vpPclViewer::addSurface | ( | const pclPointCloudPointXYZRGB::Ptr & | surface, |
const std::string & | name = "" , |
||
const std::vector< unsigned char > & | v_color = std::vector< unsigned char >() |
||
) |
Add a surface to the list of point clouds known by the viewer.
surface | The surface that must be knwon to be displayed by the PCL viewer. |
name | The name of the surface that will be displayed in the legend. If empty, it will be automatically generated. |
v_color | A vector containing the 3 RGB values. |
Referenced by ClassUsingPclViewer::blockingMode(), and ClassUsingPclViewer::threadedMode().
unsigned int vpPclViewer::addSurface | ( | const pclPointCloudPointXYZRGB::Ptr & | surface, |
const vpColVector & | weights, | ||
const std::string & | name = "" , |
||
const std::vector< unsigned char > & | v_color = std::vector< unsigned char >() |
||
) |
Add a surface to the list of point clouds known by the viewer. The points whose weights are below the vpPclViewer::s_ignoreThresh wil be displayed in black.
surface | The surface that must be knwon to be displayed by the PCL viewer. |
weights | The confidence weights of each points. Must be between 0 and 1. |
name | The name of the surface that will be displayed in the legend. If empty, it will be automatically generated. |
v_color | A vector containing the 3 RGB values. |
void vpPclViewer::display | ( | ) |
Blocking-mode display of the viewer.
Referenced by ClassUsingPclViewer::blockingMode().
void vpPclViewer::launchThread | ( | ) |
Start the drawing thread that permits to have a non-blocking display.
Referenced by ClassUsingPclViewer::threadedMode().
|
protected |
The internal loop of the non-blocking drawing thread.
void vpPclViewer::refresh | ( | const int & | timeout = 100 , |
const bool & | waitForDrawing = true |
||
) |
Refresh the display.
timeout | Duration allowed for the drawing. |
waitForDrawing | If true, will wait until the drawing is done. Otherwise, might return without doing nothing. |
|
staticprotected |
Internal method that is called by vpPclViewer::launchThread to launch the drawing thread.
p_viewer | The pointer of the vpPclViewer object that will run the thread (is equal to this ). |
void vpPclViewer::setIgnoreThreshold | ( | const double & | thresh | ) |
Set the threshold below which a point must be displayed in black.
thresh | The threshold below which a point must be displayed in black. |
void vpPclViewer::setNameWindow | ( | const std::string & | nameWindow | ) |
Set the name of the PCL viewer window.
nameWindow | The name of the PCL viewer window. |
void vpPclViewer::setOutFolder | ( | const std::string & | outputFolder | ) |
Set the path to the output folder. If different from the empty string, the point clouds will be saved in this folder.
outputFolder | The path towards to the output folder, or empty if the point clouds must not be saved. |
void vpPclViewer::stopThread | ( | ) |
Stop the drawing thread that permits to have a non-blocking display.
|
protected |
Method to update a point cloud known by the viewer when the drawing thread is running. The updated surface will be drawn with the default color that was affected to it.
surface | The updated surface. |
id | The ID of the point cloud that must be updated. |
|
protected |
Method to update a point cloud known by the viewer when the drawing thread is running. The updated surface will be drawn with the default color that was affected to it.
surface | The updated surface. |
id | The ID of the point cloud that must be updated. |
weights | The confidence weights of each point. Must be between 0 and 1. |
|
protected |
Method to update a point cloud known by the viewer when the drawing thread is running. The updated surface will be drawn with the color it contains.
surface | The updated surface. |
id | The ID of the point cloud that must be updated. |
|
protected |
Method to update a point cloud known by the viewer when the drawing thread is running. The updated surface will be drawn with the color it contains.
surface | The updated surface. |
id | The ID of the point cloud that must be updated. |
weights | The confidence weights of each point. Must be between 0 and 1. |
void vpPclViewer::updateSurface | ( | const pclPointCloudPointXYZRGB::Ptr & | surface, |
const unsigned int & | id, | ||
const bool & | hasToKeepColor = false |
||
) |
Update the surface known by id by the viewer.
surface | The updated surface. |
id | The ID of the surface that must be updated. |
hasToKeepColor | If true, will be displayed in its original color. Otherwise, will be displayed in its default color. |
Referenced by ClassUsingPclViewer::threadedMode().
void vpPclViewer::updateSurface | ( | const pclPointCloudPointXYZRGB::Ptr & | surface, |
const unsigned int & | id, | ||
const vpColVector & | weights, | ||
const bool & | hasToKeepColor = false |
||
) |
Update the surface known by id by the viewer.
surface | The updated surface. |
id | The ID of the surface that must be updated. |
weights | The confidence weights of each points. |
hasToKeepColor | If true, will be displayed in its original color. Otherwise, will be displayed in its default color. |
|
protected |
If true, the drawing thread is running. Otherwise, it is stopped.
Definition at line 255 of file vpPclViewer.h.
|
protected |
If true, the point clouds will be saved at each iteration of the drawing thread.
Definition at line 257 of file vpPclViewer.h.
|
protected |
If non empty, the path to the folders where the point clouds will be saved.
Definition at line 258 of file vpPclViewer.h.
|
protected |
The non-blocking drawing thread.
Definition at line 254 of file vpPclViewer.h.
|
protected |
The title of the viewer window.
Definition at line 256 of file vpPclViewer.h.
|
protected |
The list of the legend items.
Definition at line 251 of file vpPclViewer.h.
|
protected |
The list of the point cloud names, for the legend.
Definition at line 250 of file vpPclViewer.h.
|
protected |
The list of mutexes protecting the point clouds from data race when using the drawing thread.
Definition at line 252 of file vpPclViewer.h.
|
protected |
The list of point clouds known by the viewer.
Definition at line 242 of file vpPclViewer.h.
|
protected |
The list of confidence weights of each point cloud.
Definition at line 253 of file vpPclViewer.h.
|
staticprotected |
The height of the window.
Definition at line 246 of file vpPclViewer.h.
|
staticprotected |
The minimum value of the confidence weight of a point to allow it to be displayed.
Definition at line 249 of file vpPclViewer.h.
|
staticprotected |
The position along the horizontal axis of the screen of the window.
Definition at line 247 of file vpPclViewer.h.
|
staticprotected |
The position along the vertical axis of the screen of the window.
Definition at line 248 of file vpPclViewer.h.
|
staticprotected |
The list of color handlers.
Definition at line 244 of file vpPclViewer.h.
|
staticprotected |
The width of the window.
Definition at line 245 of file vpPclViewer.h.
|
staticprotected |
The PCL viewer permitting the display.
Definition at line 243 of file vpPclViewer.h.