ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
pcl::visualization::ImageViewer Class Reference

ImageViewer is a class for 2D image visualization. More...

#include <image_viewer.h>

Inheritance diagram for pcl::visualization::ImageViewer:
[legend]
Collaboration diagram for pcl::visualization::ImageViewer:
[legend]

Classes

struct  ExitCallback
 
struct  ExitMainLoopTimerCallback
 
struct  Layer
 Internal structure describing a layer. More...
 
struct  LayerComparator
 

Public Types

using Ptr = shared_ptr< ImageViewer >
 
using ConstPtr = shared_ptr< const ImageViewer >
 

Public Member Functions

 ImageViewer (const std::string &window_title="")
 Constructor. More...
 
virtual ~ImageViewer ()
 Destructor. More...
 
void setInteractorStyle (vtkInteractorObserver *style)
 Set up the interactor style. By default the interactor style is set to vtkInteractorStyleImage you can use this to set it to another type. More...
 
void showMonoImage (const unsigned char *data, unsigned width, unsigned height, const std::string &layer_id="mono_image", double opacity=1.0)
 Show a monochrome 2D image on screen. More...
 
void addMonoImage (const unsigned char *data, unsigned width, unsigned height, const std::string &layer_id="mono_image", double opacity=1.0)
 Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showMonoImage (const pcl::PointCloud< pcl::Intensity >::ConstPtr &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Show a monochrome 2D image on screen. More...
 
void addMonoImage (const pcl::PointCloud< pcl::Intensity >::ConstPtr &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showMonoImage (const pcl::PointCloud< pcl::Intensity > &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Show a monochrome 2D image on screen. More...
 
void addMonoImage (const pcl::PointCloud< pcl::Intensity > &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showMonoImage (const pcl::PointCloud< pcl::Intensity8u >::ConstPtr &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Show a monochrome 2D image on screen. More...
 
void addMonoImage (const pcl::PointCloud< pcl::Intensity8u >::ConstPtr &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showMonoImage (const pcl::PointCloud< pcl::Intensity8u > &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Show a monochrome 2D image on screen. More...
 
void addMonoImage (const pcl::PointCloud< pcl::Intensity8u > &cloud, const std::string &layer_id="mono_image", double opacity=1.0)
 Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showRGBImage (const unsigned char *data, unsigned width, unsigned height, const std::string &layer_id="rgb_image", double opacity=1.0)
 Show a 2D RGB image on screen. More...
 
void addRGBImage (const unsigned char *data, unsigned width, unsigned height, const std::string &layer_id="rgb_image", double opacity=1.0, bool autoresize=true)
 Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
template<typename T >
void showRGBImage (const typename pcl::PointCloud< T >::ConstPtr &cloud, const std::string &layer_id="rgb_image", double opacity=1.0)
 Show a 2D image on screen, obtained from the RGB channel of a point cloud. More...
 
template<typename T >
void addRGBImage (const typename pcl::PointCloud< T >::ConstPtr &cloud, const std::string &layer_id="rgb_image", double opacity=1.0)
 Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
template<typename T >
void showRGBImage (const pcl::PointCloud< T > &cloud, const std::string &layer_id="rgb_image", double opacity=1.0)
 Show a 2D image on screen, obtained from the RGB channel of a point cloud. More...
 
template<typename T >
void addRGBImage (const pcl::PointCloud< T > &cloud, const std::string &layer_id="rgb_image", double opacity=1.0)
 Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showFloatImage (const float *data, unsigned int width, unsigned int height, float min_value=std::numeric_limits< float >::min(), float max_value=std::numeric_limits< float >::max(), bool grayscale=false, const std::string &layer_id="float_image", double opacity=1.0)
 Show a 2D image (float) on screen. More...
 
void addFloatImage (const float *data, unsigned int width, unsigned int height, float min_value=std::numeric_limits< float >::min(), float max_value=std::numeric_limits< float >::max(), bool grayscale=false, const std::string &layer_id="float_image", double opacity=1.0)
 Add a float 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showShortImage (const unsigned short *short_image, unsigned int width, unsigned int height, unsigned short min_value=std::numeric_limits< unsigned short >::min(), unsigned short max_value=std::numeric_limits< unsigned short >::max(), bool grayscale=false, const std::string &layer_id="short_image", double opacity=1.0)
 Show a 2D image (unsigned short) on screen. More...
 
void addShortImage (const unsigned short *short_image, unsigned int width, unsigned int height, unsigned short min_value=std::numeric_limits< unsigned short >::min(), unsigned short max_value=std::numeric_limits< unsigned short >::max(), bool grayscale=false, const std::string &layer_id="short_image", double opacity=1.0)
 Add a short 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showAngleImage (const float *data, unsigned width, unsigned height, const std::string &layer_id="angle_image", double opacity=1.0)
 Show a 2D image on screen representing angle data. More...
 
void addAngleImage (const float *data, unsigned width, unsigned height, const std::string &layer_id="angle_image", double opacity=1.0)
 Add an angle 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void showHalfAngleImage (const float *data, unsigned width, unsigned height, const std::string &layer_id="half_angle_image", double opacity=1.0)
 Show a 2D image on screen representing half angle data. More...
 
void addHalfAngleImage (const float *data, unsigned width, unsigned height, const std::string &layer_id="half_angle_image", double opacity=1.0)
 Add a half angle 2D image layer, but do not render it (use spin/spinOnce to update). More...
 
void markPoint (std::size_t u, std::size_t v, Vector3ub fg_color, Vector3ub bg_color=red_color, double radius=3.0, const std::string &layer_id="points", double opacity=1.0)
 Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another. More...
 
void markPoints (const std::vector< int > &uv, Vector3ub fg_color, Vector3ub bg_color=red_color, double size=3.0, const std::string &layer_id="markers", double opacity=1.0)
 Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another. More...
 
void markPoints (const std::vector< float > &uv, Vector3ub fg_color, Vector3ub bg_color=red_color, double size=3.0, const std::string &layer_id="markers", double opacity=1.0)
 Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another (float coordinates version). More...
 
void setWindowTitle (const std::string &name)
 Set the window title name. More...
 
void spin ()
 Spin method. Calls the interactor and runs an internal loop. More...
 
void spinOnce (int time=1, bool force_redraw=true)
 Spin once method. Calls the interactor and updates the screen once. More...
 
boost::signals2::connection registerKeyboardCallback (void(*callback)(const pcl::visualization::KeyboardEvent &, void *), void *cookie=nullptr)
 Register a callback function for keyboard events. More...
 
template<typename T >
boost::signals2::connection registerKeyboardCallback (void(T::*callback)(const pcl::visualization::KeyboardEvent &, void *), T &instance, void *cookie=nullptr)
 Register a callback function for keyboard events. More...
 
boost::signals2::connection registerKeyboardCallback (std::function< void(const pcl::visualization::KeyboardEvent &)> cb)
 Register a callback std::function for keyboard events. More...
 
boost::signals2::connection registerMouseCallback (void(*callback)(const pcl::visualization::MouseEvent &, void *), void *cookie=nullptr)
 Register a callback std::function for mouse events. More...
 
template<typename T >
boost::signals2::connection registerMouseCallback (void(T::*callback)(const pcl::visualization::MouseEvent &, void *), T &instance, void *cookie=nullptr)
 Register a callback function for mouse events. More...
 
boost::signals2::connection registerMouseCallback (std::function< void(const pcl::visualization::MouseEvent &)> cb)
 Register a callback function for mouse events. More...
 
void setPosition (int x, int y)
 Set the position in screen coordinates. More...
 
void setSize (int xw, int yw)
 Set the window size in screen coordinates. More...
 
int * getSize ()
 Return the window size in pixels. More...
 
bool wasStopped () const
 Returns true when the user tried to close the window. More...
 
void close ()
 Stop the interaction and close the visualizaton window. More...
 
bool addCircle (unsigned int x, unsigned int y, double radius, const std::string &layer_id="circles", double opacity=1.0)
 Add a circle shape from a point and a radius. More...
 
bool addCircle (unsigned int x, unsigned int y, double radius, double r, double g, double b, const std::string &layer_id="circles", double opacity=1.0)
 Add a circle shape from a point and a radius. More...
 
bool addRectangle (const pcl::PointXY &min_pt, const pcl::PointXY &max_pt, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
bool addRectangle (const pcl::PointXY &min_pt, const pcl::PointXY &max_pt, double r, double g, double b, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
bool addRectangle (unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
bool addRectangle (unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, double r, double g, double b, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
template<typename T >
bool addRectangle (const typename pcl::PointCloud< T >::ConstPtr &image, const T &min_pt, const T &max_pt, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
template<typename T >
bool addRectangle (const typename pcl::PointCloud< T >::ConstPtr &image, const T &min_pt, const T &max_pt, double r, double g, double b, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box and color its edges with a given color. More...
 
template<typename T >
bool addRectangle (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PointCloud< T > &mask, double r, double g, double b, const std::string &layer_id="rectangles", double opacity=1.0)
 Add a 2D box that contains a given image mask and color its edges. More...
 
template<typename T >
bool addRectangle (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PointCloud< T > &mask, const std::string &layer_id="image_mask", double opacity=1.0)
 Add a 2D box that contains a given image mask and color its edges in red. More...
 
bool addFilledRectangle (unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, const std::string &layer_id="boxes", double opacity=0.5)
 Add a 2D box and fill it in with a given color. More...
 
bool addFilledRectangle (unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, double r, double g, double b, const std::string &layer_id="boxes", double opacity=0.5)
 Add a 2D box and fill it in with a given color. More...
 
bool addLine (unsigned int x_min, unsigned int y_min, unsigned int x_max, unsigned int y_max, double r, double g, double b, const std::string &layer_id="line", double opacity=1.0)
 Add a 2D line with a given color. More...
 
bool addLine (unsigned int x_min, unsigned int y_min, unsigned int x_max, unsigned int y_max, const std::string &layer_id="line", double opacity=1.0)
 Add a 2D line with a given color. More...
 
bool addText (unsigned int x, unsigned int y, const std::string &text, double r, double g, double b, const std::string &layer_id="line", double opacity=1.0)
 Add a 2D text with a given color. More...
 
bool addText (unsigned int x, unsigned int y, const std::string &text, const std::string &layer_id="line", double opacity=1.0)
 Add a 2D text with a given color. More...
 
template<typename T >
bool addMask (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PointCloud< T > &mask, double r, double g, double b, const std::string &layer_id="image_mask", double opacity=0.5)
 Add a generic 2D mask to an image. More...
 
template<typename T >
bool addMask (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PointCloud< T > &mask, const std::string &layer_id="image_mask", double opacity=0.5)
 Add a generic 2D mask to an image (colored in red) More...
 
template<typename T >
bool addPlanarPolygon (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PlanarPolygon< T > &polygon, double r, double g, double b, const std::string &layer_id="planar_polygon", double opacity=1.0)
 Add a generic 2D planar polygon to an image. More...
 
template<typename T >
bool addPlanarPolygon (const typename pcl::PointCloud< T >::ConstPtr &image, const pcl::PlanarPolygon< T > &polygon, const std::string &layer_id="planar_polygon", double opacity=1.0)
 Add a generic 2D planar polygon to an image. More...
 
bool addLayer (const std::string &layer_id, int width, int height, double opacity=0.5)
 Add a new 2D rendering layer to the viewer. More...
 
void removeLayer (const std::string &layer_id)
 Remove a 2D layer given by its ID. More...
 
template<typename PointT >
bool showCorrespondences (const pcl::PointCloud< PointT > &source_img, const pcl::PointCloud< PointT > &target_img, const pcl::Correspondences &correspondences, int nth=1, const std::string &layer_id="correspondences")
 Add the specified correspondences to the display. More...
 

Protected Types

using LayerMap = std::vector< Layer >
 

Protected Member Functions

void render ()
 Trigger a render call. More...
 
void convertIntensityCloudToUChar (const pcl::PointCloud< pcl::Intensity > &cloud, boost::shared_array< unsigned char > data)
 Convert the Intensity information in a PointCloud<Intensity> to an unsigned char array. More...
 
void convertIntensityCloud8uToUChar (const pcl::PointCloud< pcl::Intensity8u > &cloud, boost::shared_array< unsigned char > data)
 Convert the Intensity8u information in a PointCloud<Intensity8u> to an unsigned char array. More...
 
template<typename T >
void convertRGBCloudToUChar (const pcl::PointCloud< T > &cloud, boost::shared_array< unsigned char > &data)
 Convert the RGB information in a PointCloud<T> to an unsigned char array. More...
 
void resetStoppedFlag ()
 Set the stopped flag back to false. More...
 
void emitMouseEvent (unsigned long event_id)
 Fire up a mouse event with a specified event ID. More...
 
void emitKeyboardEvent (unsigned long event_id)
 Fire up a keyboard event with a specified event ID. More...
 
LayerMap::iterator createLayer (const std::string &layer_id, int width, int height, double opacity=0.5, bool fill_box=true)
 Add a new 2D rendering layer to the viewer. More...
 

Static Protected Member Functions

static void MouseCallback (vtkObject *, unsigned long eid, void *clientdata, void *calldata)
 
static void KeyboardCallback (vtkObject *, unsigned long eid, void *clientdata, void *calldata)
 

Protected Attributes

boost::signals2::signal< void(const pcl::visualization::MouseEvent &)> mouse_signal_
 
boost::signals2::signal< void(const pcl::visualization::KeyboardEvent &)> keyboard_signal_
 
vtkSmartPointer< vtkRenderWindowInteractor > interactor_
 
vtkSmartPointer< vtkCallbackCommand > mouse_command_
 
vtkSmartPointer< vtkCallbackCommand > keyboard_command_
 
vtkSmartPointer< ExitMainLoopTimerCallback > exit_main_loop_timer_callback_
 Callback object enabling us to leave the main loop, when a timer fires. More...
 
vtkSmartPointer< ExitCallback > exit_callback_
 
vtkSmartPointer< vtkImageViewer > image_viewer_
 The ImageViewer widget. More...
 
vtkSmartPointer< vtkRenderWindow > win_
 The render window. More...
 
vtkSmartPointer< vtkRenderer > ren_
 The renderer. More...
 
vtkSmartPointer< vtkImageSlice > slice_
 Global prop. This is the actual "actor". More...
 
vtkSmartPointer< ImageViewerInteractorStyle > interactor_style_
 The interactor style. More...
 
boost::shared_array< unsigned char > data_
 The data array representing the image. Used internally. More...
 
std::size_t data_size_
 The data array (representing the image) size. Used internally. More...
 
bool stopped_
 Set to false if the interaction loop is running. More...
 
int timer_id_
 Global timer ID. Used in destructor only. More...
 
LayerMap layer_map_
 Internal list with different 2D layers shapes. More...
 
vtkSmartPointer< vtkImageFlip > algo_
 Image reslice, used for flipping the image. More...
 
std::vector< unsigned char * > image_data_
 Internal data array. Used everytime add***Image is called. Cleared, everytime the render loop is executed. More...
 

Detailed Description

ImageViewer is a class for 2D image visualization.

Features include:

  • add and remove different layers with different opacity (transparency) values
  • add 2D geometric shapes (circles, boxes, etc) in separate layers
  • display RGB, monochrome, float, angle images

Simple usage example:

iv.addCircle (10, 10, 5, 1.0, 0.0, 0.0, "circles", 1.0); // add a red,
fully opaque circle with radius 5 pixels at (10,10) in layer "circles"
iv.addFilledRectangle (10, 20, 10, 20, 0.0, 1.0, 0.0, "boxes", 0.5); //
add a green, 50% transparent box at (10,10->20,20) in layer "boxes"
iv.addRGBImage<pcl::PointXYZRGBA> (cloud); // add a RGB
image from a point cloud dataset in an "rgb_image" default layer iv.spin ();
// press 'q' to exit iv.removeLayer ("circles"); // remove layer "circles"
iv.spin (); // press 'q' to
exit
Author
Radu B. Rusu, Suat Gedikli

Member Typedef Documentation

◆ ConstPtr

◆ LayerMap

using pcl::visualization::ImageViewer::LayerMap = std::vector<Layer>
protected

◆ Ptr

Constructor & Destructor Documentation

◆ ImageViewer()

pcl::visualization::ImageViewer::ImageViewer ( const std::string &  window_title = "")

◆ ~ImageViewer()

pcl::visualization::ImageViewer::~ImageViewer ( )
virtual

Destructor.

Member Function Documentation

◆ addAngleImage()

void pcl::visualization::ImageViewer::addAngleImage ( const float *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "angle_image",
double  opacity = 1.0 
)

Add an angle 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ addCircle() [1/2]

bool pcl::visualization::ImageViewer::addCircle ( unsigned int  x,
unsigned int  y,
double  radius,
const std::string &  layer_id = "circles",
double  opacity = 1.0 
)

Add a circle shape from a point and a radius.

Parameters
[in]xthe x coordinate of the circle center
[in]ythe y coordinate of the circle center
[in]radiusthe radius of the circle
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References x, and y.

◆ addCircle() [2/2]

bool pcl::visualization::ImageViewer::addCircle ( unsigned int  x,
unsigned int  y,
double  radius,
double  r,
double  g,
double  b,
const std::string &  layer_id = "circles",
double  opacity = 1.0 
)

Add a circle shape from a point and a radius.

Parameters
[in]xthe x coordinate of the circle center
[in]ythe y coordinate of the circle center
[in]radiusthe radius of the circle
[in]rthe red channel of the color that the sphere should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the sphere should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the sphere should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References x, and y.

◆ addFilledRectangle() [1/2]

bool pcl::visualization::ImageViewer::addFilledRectangle ( unsigned int  x_min,
unsigned int  x_max,
unsigned int  y_min,
unsigned int  y_max,
const std::string &  layer_id = "boxes",
double  opacity = 0.5 
)

Add a 2D box and fill it in with a given color.

Parameters
[in]x_minthe X min coordinate
[in]x_maxthe X max coordinate
[in]y_minthe Y min coordinate
[in]y_maxthe Y max coordinate
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)

◆ addFilledRectangle() [2/2]

bool pcl::visualization::ImageViewer::addFilledRectangle ( unsigned int  x_min,
unsigned int  x_max,
unsigned int  y_min,
unsigned int  y_max,
double  r,
double  g,
double  b,
const std::string &  layer_id = "boxes",
double  opacity = 0.5 
)

Add a 2D box and fill it in with a given color.

Parameters
[in]x_minthe X min coordinate
[in]x_maxthe X max coordinate
[in]y_minthe Y min coordinate
[in]y_maxthe Y max coordinate
[in]rthe red channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)

◆ addFloatImage()

void pcl::visualization::ImageViewer::addFloatImage ( const float *  data,
unsigned int  width,
unsigned int  height,
float  min_value = std::numeric_limits<float>::min(),
float  max_value = std::numeric_limits<float>::max(),
bool  grayscale = false,
const std::string &  layer_id = "float_image",
double  opacity = 1.0 
)

Add a float 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]datathe input data representing the image in float format
[in]widththe width of the image
[in]heightthe height of the image
[in]min_valuefilter all values in the image to be larger than this minimum value
[in]max_valuefilter all values in the image to be smaller than this maximum value
[in]grayscaleshow data as grayscale (true) or not (false). Default: false
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ addHalfAngleImage()

void pcl::visualization::ImageViewer::addHalfAngleImage ( const float *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "half_angle_image",
double  opacity = 1.0 
)

Add a half angle 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ addLayer()

bool pcl::visualization::ImageViewer::addLayer ( const std::string &  layer_id,
int  width,
int  height,
double  opacity = 0.5 
)

Add a new 2D rendering layer to the viewer.

Parameters
[in]layer_idthe name of the layer
[in]widththe width of the layer
[in]heightthe height of the layer
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)

References height, and width.

◆ addLine() [1/2]

bool pcl::visualization::ImageViewer::addLine ( unsigned int  x_min,
unsigned int  y_min,
unsigned int  x_max,
unsigned int  y_max,
const std::string &  layer_id = "line",
double  opacity = 1.0 
)

Add a 2D line with a given color.

Parameters
[in]x_minthe X min coordinate
[in]y_minthe Y min coordinate
[in]x_maxthe X max coordinate
[in]y_maxthe Y max coordinate
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addLine() [2/2]

bool pcl::visualization::ImageViewer::addLine ( unsigned int  x_min,
unsigned int  y_min,
unsigned int  x_max,
unsigned int  y_max,
double  r,
double  g,
double  b,
const std::string &  layer_id = "line",
double  opacity = 1.0 
)

Add a 2D line with a given color.

Parameters
[in]x_minthe X min coordinate
[in]y_minthe Y min coordinate
[in]x_maxthe X max coordinate
[in]y_maxthe Y max coordinate
[in]rthe red channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addMask() [1/2]

template<typename T >
bool pcl::visualization::ImageViewer::addMask ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PointCloud< T > &  mask,
const std::string &  layer_id = "image_mask",
double  opacity = 0.5 
)

Add a generic 2D mask to an image (colored in red)

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]maskthe point data representing the mask that we want to draw
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)

References image.

◆ addMask() [2/2]

template<typename T >
bool pcl::visualization::ImageViewer::addMask ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PointCloud< T > &  mask,
double  r,
double  g,
double  b,
const std::string &  layer_id = "image_mask",
double  opacity = 0.5 
)

Add a generic 2D mask to an image.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]maskthe point data representing the mask that we want to draw
[in]rthe red channel of the color that the mask should be rendered with
[in]gthe green channel of the color that the mask should be rendered with
[in]bthe blue channel of the color that the mask should be rendered with
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)

References image, and points.

◆ addMonoImage() [1/5]

void pcl::visualization::ImageViewer::addMonoImage ( const pcl::PointCloud< pcl::Intensity > &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addMonoImage() [2/5]

void pcl::visualization::ImageViewer::addMonoImage ( const pcl::PointCloud< pcl::Intensity >::ConstPtr &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)
inline

Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addMonoImage() [3/5]

void pcl::visualization::ImageViewer::addMonoImage ( const pcl::PointCloud< pcl::Intensity8u > &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addMonoImage() [4/5]

void pcl::visualization::ImageViewer::addMonoImage ( const pcl::PointCloud< pcl::Intensity8u >::ConstPtr &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)
inline

Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addMonoImage() [5/5]

void pcl::visualization::ImageViewer::addMonoImage ( const unsigned char *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Add a monochrome 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References data, height, image, and width.

◆ addPlanarPolygon() [1/2]

template<typename T >
bool pcl::visualization::ImageViewer::addPlanarPolygon ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PlanarPolygon< T > &  polygon,
const std::string &  layer_id = "planar_polygon",
double  opacity = 1.0 
)

Add a generic 2D planar polygon to an image.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]polygonthe point data representing the polygon that we want to draw. A line will be drawn from each point to the next in the dataset.
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References image.

◆ addPlanarPolygon() [2/2]

template<typename T >
bool pcl::visualization::ImageViewer::addPlanarPolygon ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PlanarPolygon< T > &  polygon,
double  r,
double  g,
double  b,
const std::string &  layer_id = "planar_polygon",
double  opacity = 1.0 
)

Add a generic 2D planar polygon to an image.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]polygonthe point data representing the polygon that we want to draw. A line will be drawn from each point to the next in the dataset.
[in]rthe red channel of the color that the polygon should be rendered with
[in]gthe green channel of the color that the polygon should be rendered with
[in]bthe blue channel of the color that the polygon should be rendered with
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References image, and size.

◆ addRectangle() [1/8]

bool pcl::visualization::ImageViewer::addRectangle ( const pcl::PointXY &  min_pt,
const pcl::PointXY &  max_pt,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]min_ptthe X,Y min coordinate
[in]max_ptthe X,Y max coordinate
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addRectangle() [2/8]

bool pcl::visualization::ImageViewer::addRectangle ( const pcl::PointXY &  min_pt,
const pcl::PointXY &  max_pt,
double  r,
double  g,
double  b,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]min_ptthe X,Y min coordinate
[in]max_ptthe X,Y max coordinate
[in]rthe red channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addRectangle() [3/8]

template<typename T >
bool pcl::visualization::ImageViewer::addRectangle ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PointCloud< T > &  mask,
const std::string &  layer_id = "image_mask",
double  opacity = 1.0 
)

Add a 2D box that contains a given image mask and color its edges in red.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]maskthe point data representing the mask that we want to draw
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References image.

◆ addRectangle() [4/8]

template<typename T >
bool pcl::visualization::ImageViewer::addRectangle ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const pcl::PointCloud< T > &  mask,
double  r,
double  g,
double  b,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box that contains a given image mask and color its edges.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]maskthe point data representing the mask that we want to draw
[in]rthe red channel of the color that the mask should be rendered with
[in]gthe green channel of the color that the mask should be rendered with
[in]bthe blue channel of the color that the mask should be rendered with
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References float, and image.

◆ addRectangle() [5/8]

template<typename T >
bool pcl::visualization::ImageViewer::addRectangle ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const T &  min_pt,
const T &  max_pt,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]min_ptthe X,Y min coordinate
[in]max_ptthe X,Y max coordinate
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References image.

◆ addRectangle() [6/8]

template<typename T >
bool pcl::visualization::ImageViewer::addRectangle ( const typename pcl::PointCloud< T >::ConstPtr &  image,
const T &  min_pt,
const T &  max_pt,
double  r,
double  g,
double  b,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]imagethe organized point cloud dataset containing the image data
[in]min_ptthe X,Y min coordinate
[in]max_ptthe X,Y max coordinate
[in]rthe red channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References float, and image.

◆ addRectangle() [7/8]

bool pcl::visualization::ImageViewer::addRectangle ( unsigned int  x_min,
unsigned int  x_max,
unsigned int  y_min,
unsigned int  y_max,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]x_minthe X min coordinate
[in]x_maxthe X max coordinate
[in]y_minthe Y min coordinate
[in]y_maxthe Y max coordinate
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addRectangle() [8/8]

bool pcl::visualization::ImageViewer::addRectangle ( unsigned int  x_min,
unsigned int  x_max,
unsigned int  y_min,
unsigned int  y_max,
double  r,
double  g,
double  b,
const std::string &  layer_id = "rectangles",
double  opacity = 1.0 
)

Add a 2D box and color its edges with a given color.

Parameters
[in]x_minthe X min coordinate
[in]x_maxthe X max coordinate
[in]y_minthe Y min coordinate
[in]y_maxthe Y max coordinate
[in]rthe red channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the box should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

◆ addRGBImage() [1/3]

template<typename T >
void pcl::visualization::ImageViewer::addRGBImage ( const pcl::PointCloud< T > &  cloud,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0 
)

Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addRGBImage() [2/3]

template<typename T >
void pcl::visualization::ImageViewer::addRGBImage ( const typename pcl::PointCloud< T >::ConstPtr &  cloud,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0 
)
inline

Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ addRGBImage() [3/3]

void pcl::visualization::ImageViewer::addRGBImage ( const unsigned char *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0,
bool  autoresize = true 
)

Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)
[in]autoresizeflag to enable window to adapt to image size (default true)

References data, height, image, and width.

◆ addShortImage()

void pcl::visualization::ImageViewer::addShortImage ( const unsigned short *  short_image,
unsigned int  width,
unsigned int  height,
unsigned short  min_value = std::numeric_limits<unsigned short>::min(),
unsigned short  max_value = std::numeric_limits<unsigned short>::max(),
bool  grayscale = false,
const std::string &  layer_id = "short_image",
double  opacity = 1.0 
)

Add a short 2D image layer, but do not render it (use spin/spinOnce to update).

Parameters
[in]short_imagethe input data representing the image in unsigned short format
[in]widththe width of the image
[in]heightthe height of the image
[in]min_valuefilter all values in the image to be larger than this minimum value
[in]max_valuefilter all values in the image to be smaller than this maximum value
[in]grayscaleshow data as grayscale (true) or not (false). Default: false
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ addText() [1/2]

bool pcl::visualization::ImageViewer::addText ( unsigned int  x,
unsigned int  y,
const std::string &  text,
const std::string &  layer_id = "line",
double  opacity = 1.0 
)

Add a 2D text with a given color.

Parameters
[in]xthe X coordinate
[in]ythe Y coordinate
[in]textthe text string to be displayed
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References x, and y.

◆ addText() [2/2]

bool pcl::visualization::ImageViewer::addText ( unsigned int  x,
unsigned int  y,
const std::string &  text,
double  r,
double  g,
double  b,
const std::string &  layer_id = "line",
double  opacity = 1.0 
)

Add a 2D text with a given color.

Parameters
[in]xthe X coordinate
[in]ythe Y coordinate
[in]textthe text string to be displayed
[in]rthe red channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]gthe green channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]bthe blue channel of the color that the line should be rendered with (0.0 -> 1.0)
[in]layer_idthe 2D layer ID where we want the extra information to be drawn.
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 1.0)

References x, and y.

◆ close()

void pcl::visualization::ImageViewer::close ( )
inline

Stop the interaction and close the visualizaton window.

◆ convertIntensityCloud8uToUChar()

void pcl::visualization::ImageViewer::convertIntensityCloud8uToUChar ( const pcl::PointCloud< pcl::Intensity8u > &  cloud,
boost::shared_array< unsigned char >  data 
)
protected

Convert the Intensity8u information in a PointCloud<Intensity8u> to an unsigned char array.

Parameters
[in]cloudthe input cloud containing the grayscale intensity information
[out]dataa boost shared array of unsigned char type
Note
The method assumes that the data array has already been allocated and contains enough space to copy all the data from cloud!

References data.

◆ convertIntensityCloudToUChar()

void pcl::visualization::ImageViewer::convertIntensityCloudToUChar ( const pcl::PointCloud< pcl::Intensity > &  cloud,
boost::shared_array< unsigned char >  data 
)
protected

Convert the Intensity information in a PointCloud<Intensity> to an unsigned char array.

Parameters
[in]cloudthe input cloud containing the grayscale intensity information
[out]dataa boost shared array of unsigned char type
Note
The method assumes that the data array has already been allocated and contains enough space to copy all the data from cloud!

References data.

◆ convertRGBCloudToUChar()

template<typename T >
void pcl::visualization::ImageViewer::convertRGBCloudToUChar ( const pcl::PointCloud< T > &  cloud,
boost::shared_array< unsigned char > &  data 
)
protected

Convert the RGB information in a PointCloud<T> to an unsigned char array.

Parameters
[in]cloudthe input cloud containing the RGB information
[out]dataa boost shared array of unsigned char type
Note
The method assumes that the data array has already been allocated and contains enough space to copy all the data from cloud!

References data.

◆ createLayer()

pcl::visualization::ImageViewer::LayerMap::iterator pcl::visualization::ImageViewer::createLayer ( const std::string &  layer_id,
int  width,
int  height,
double  opacity = 0.5,
bool  fill_box = true 
)
protected

Add a new 2D rendering layer to the viewer.

Parameters
[in]layer_idthe name of the layer
[in]widththe width of the layer
[in]heightthe height of the layer
[in]opacitythe opacity of the layer: 0 for invisible, 1 for opaque. (default: 0.5)
[in]fill_boxset to true to fill in the image with one black box before starting

References pcl::visualization::ImageViewer::Layer::actor, height, pcl::visualization::ImageViewer::Layer::layer_name, and width.

◆ emitKeyboardEvent()

void pcl::visualization::ImageViewer::emitKeyboardEvent ( unsigned long  event_id)
protected

Fire up a keyboard event with a specified event ID.

Parameters
[in]event_idthe id of the event

References event.

Referenced by KeyboardCallback().

◆ emitMouseEvent()

void pcl::visualization::ImageViewer::emitMouseEvent ( unsigned long  event_id)
protected

Fire up a mouse event with a specified event ID.

Parameters
[in]event_idthe id of the event

References event, x, and y.

Referenced by MouseCallback().

◆ getSize()

int * pcl::visualization::ImageViewer::getSize ( )

Return the window size in pixels.

Referenced by PclUtils::ImageVis::addText().

◆ KeyboardCallback()

void pcl::visualization::ImageViewer::KeyboardCallback ( vtkObject *  ,
unsigned long  eid,
void *  clientdata,
void *  calldata 
)
staticprotected

References emitKeyboardEvent().

Referenced by ImageViewer().

◆ markPoint()

void pcl::visualization::ImageViewer::markPoint ( std::size_t  u,
std::size_t  v,
Vector3ub  fg_color,
Vector3ub  bg_color = red_color,
double  radius = 3.0,
const std::string &  layer_id = "points",
double  opacity = 1.0 
)

Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another.

Parameters
[in]uthe u/x coordinate of the pixel
[in]vthe v/y coordinate of the pixel
[in]fg_colorthe pixel color
[in]bg_colorthe neighborhood color
[in]radiusthe circle radius around the pixel
[in]layer_idthe name of the layer (default: "points")
[in]opacitythe opacity of the layer (default: 1.0)

◆ markPoints() [1/2]

void pcl::visualization::ImageViewer::markPoints ( const std::vector< float > &  uv,
Vector3ub  fg_color,
Vector3ub  bg_color = red_color,
double  size = 3.0,
const std::string &  layer_id = "markers",
double  opacity = 1.0 
)

Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another (float coordinates version).

Parameters
[in]uvthe u/x, v/y coordinate of the pixels to be marked
[in]fg_colorthe pixel color
[in]bg_colorthe neighborhood color
[in]sizeedge of the square surrounding each pixel
[in]layer_idthe name of the layer (default: "markers")
[in]opacitythe opacity of the layer (default: 1.0)

References size, and uv.

◆ markPoints() [2/2]

void pcl::visualization::ImageViewer::markPoints ( const std::vector< int > &  uv,
Vector3ub  fg_color,
Vector3ub  bg_color = red_color,
double  size = 3.0,
const std::string &  layer_id = "markers",
double  opacity = 1.0 
)

Sets the pixel at coordinates(u,v) to color while setting the neighborhood to another.

Parameters
[in]uvthe u/x, v/y coordinate of the pixels to be marked
[in]fg_colorthe pixel color
[in]bg_colorthe neighborhood color
[in]sizeedge of the square surrounding each pixel
[in]layer_idthe name of the layer (default: "markers")
[in]opacitythe opacity of the layer (default: 1.0)

References size, and uv.

◆ MouseCallback()

void pcl::visualization::ImageViewer::MouseCallback ( vtkObject *  ,
unsigned long  eid,
void *  clientdata,
void *  calldata 
)
staticprotected

References emitMouseEvent().

Referenced by ImageViewer().

◆ registerKeyboardCallback() [1/3]

boost::signals2::connection pcl::visualization::ImageViewer::registerKeyboardCallback ( std::function< void(const pcl::visualization::KeyboardEvent &)>  cb)

Register a callback std::function for keyboard events.

Parameters
[in]cbthe boost function that will be registered as a callback for a keyboard event
Returns
a connection object that allows to disconnect the callback function.

References callback.

◆ registerKeyboardCallback() [2/3]

boost::signals2::connection pcl::visualization::ImageViewer::registerKeyboardCallback ( void(*)(const pcl::visualization::KeyboardEvent &, void *)  callback,
void *  cookie = nullptr 
)
inline

Register a callback function for keyboard events.

Parameters
[in]callbackthe function that will be registered as a callback for a keyboard event
[in]cookieuser data that is passed to the callback
Returns
a connection object that allows to disconnect the callback function.

References e.

◆ registerKeyboardCallback() [3/3]

template<typename T >
boost::signals2::connection pcl::visualization::ImageViewer::registerKeyboardCallback ( void(T::*)(const pcl::visualization::KeyboardEvent &, void *)  callback,
T &  instance,
void *  cookie = nullptr 
)
inline

Register a callback function for keyboard events.

Parameters
[in]callbackthe member function that will be registered as a callback for a keyboard event
[in]instanceinstance to the class that implements the callback function
[in]cookieuser data that is passed to the callback
Returns
a connection object that allows to disconnect the callback function.

References callback, and e.

◆ registerMouseCallback() [1/3]

boost::signals2::connection pcl::visualization::ImageViewer::registerMouseCallback ( std::function< void(const pcl::visualization::MouseEvent &)>  cb)

Register a callback function for mouse events.

Parameters
[in]cbthe boost function that will be registered as a callback for a mouse event
Returns
a connection object that allows to disconnect the callback function.

References callback.

◆ registerMouseCallback() [2/3]

boost::signals2::connection pcl::visualization::ImageViewer::registerMouseCallback ( void(*)(const pcl::visualization::MouseEvent &, void *)  callback,
void *  cookie = nullptr 
)
inline

Register a callback std::function for mouse events.

Parameters
[in]callbackthe function that will be registered as a callback for a mouse event
[in]cookieuser data that is passed to the callback
Returns
a connection object that allows to disconnect the callback function.

References e.

Referenced by PclUtils::ImageVis::enable2Dviewer().

◆ registerMouseCallback() [3/3]

template<typename T >
boost::signals2::connection pcl::visualization::ImageViewer::registerMouseCallback ( void(T::*)(const pcl::visualization::MouseEvent &, void *)  callback,
T &  instance,
void *  cookie = nullptr 
)
inline

Register a callback function for mouse events.

Parameters
[in]callbackthe member function that will be registered as a callback for a mouse event
[in]instanceinstance to the class that implements the callback function
[in]cookieuser data that is passed to the callback
Returns
a connection object that allows to disconnect the callback function.

References callback, and e.

◆ removeLayer()

void pcl::visualization::ImageViewer::removeLayer ( const std::string &  layer_id)

Remove a 2D layer given by its ID.

Parameters
[in]layer_idthe name of the layer

Referenced by PclUtils::ImageVis::removeLayer().

◆ render()

void pcl::visualization::ImageViewer::render ( )
protected

Trigger a render call.

Referenced by PclUtils::ImageVis::setRender().

◆ resetStoppedFlag()

void pcl::visualization::ImageViewer::resetStoppedFlag ( )
inlineprotected

Set the stopped flag back to false.

Referenced by ImageViewer(), and PclUtils::ImageVis::setRenderWindowInteractor().

◆ setInteractorStyle()

void pcl::visualization::ImageViewer::setInteractorStyle ( vtkInteractorObserver *  style)
inline

Set up the interactor style. By default the interactor style is set to vtkInteractorStyleImage you can use this to set it to another type.

Parameters
[in]styleuser set interactor style.

◆ setPosition()

void pcl::visualization::ImageViewer::setPosition ( int  x,
int  y 
)

Set the position in screen coordinates.

Parameters
[in]xwhere to move the window to (X)
[in]ywhere to move the window to (Y)

References x, and y.

◆ setSize()

void pcl::visualization::ImageViewer::setSize ( int  xw,
int  yw 
)

Set the window size in screen coordinates.

Parameters
[in]xwwindow size in horizontal (pixels)
[in]ywwindow size in vertical (pixels)

◆ setWindowTitle()

void pcl::visualization::ImageViewer::setWindowTitle ( const std::string &  name)

Set the window title name.

Parameters
[in]namethe window title

References name.

◆ showAngleImage()

void pcl::visualization::ImageViewer::showAngleImage ( const float *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "angle_image",
double  opacity = 1.0 
)

Show a 2D image on screen representing angle data.

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ showCorrespondences()

template<typename PointT >
bool pcl::visualization::ImageViewer::showCorrespondences ( const pcl::PointCloud< PointT > &  source_img,
const pcl::PointCloud< PointT > &  target_img,
const pcl::Correspondences &  correspondences,
int  nth = 1,
const std::string &  layer_id = "correspondences" 
)

Add the specified correspondences to the display.

Parameters
[in]source_imgThe source RGB image
[in]target_imgThe target RGB image
[in]correspondencesThe list of correspondences to display.
[in]nthdisplay only the Nth correspondence (e.g., skip the rest)
[in]layer_idthe layer id (default: "correspondences")

References data, G3Point::getRandomColors(), and image.

◆ showFloatImage()

void pcl::visualization::ImageViewer::showFloatImage ( const float *  data,
unsigned int  width,
unsigned int  height,
float  min_value = std::numeric_limits<float>::min(),
float  max_value = std::numeric_limits<float>::max(),
bool  grayscale = false,
const std::string &  layer_id = "float_image",
double  opacity = 1.0 
)

Show a 2D image (float) on screen.

Parameters
[in]datathe input data representing the image in float format
[in]widththe width of the image
[in]heightthe height of the image
[in]min_valuefilter all values in the image to be larger than this minimum value
[in]max_valuefilter all values in the image to be smaller than this maximum value
[in]grayscaleshow data as grayscale (true) or not (false). Default: false
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ showHalfAngleImage()

void pcl::visualization::ImageViewer::showHalfAngleImage ( const float *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "half_angle_image",
double  opacity = 1.0 
)

Show a 2D image on screen representing half angle data.

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ showMonoImage() [1/5]

void pcl::visualization::ImageViewer::showMonoImage ( const pcl::PointCloud< pcl::Intensity > &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Show a monochrome 2D image on screen.

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showMonoImage() [2/5]

void pcl::visualization::ImageViewer::showMonoImage ( const pcl::PointCloud< pcl::Intensity >::ConstPtr &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)
inline

Show a monochrome 2D image on screen.

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showMonoImage() [3/5]

void pcl::visualization::ImageViewer::showMonoImage ( const pcl::PointCloud< pcl::Intensity8u > &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Show a monochrome 2D image on screen.

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showMonoImage() [4/5]

void pcl::visualization::ImageViewer::showMonoImage ( const pcl::PointCloud< pcl::Intensity8u >::ConstPtr &  cloud,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)
inline

Show a monochrome 2D image on screen.

Parameters
[in]cloudthe input data representing the grayscale point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showMonoImage() [5/5]

void pcl::visualization::ImageViewer::showMonoImage ( const unsigned char *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "mono_image",
double  opacity = 1.0 
)

Show a monochrome 2D image on screen.

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ showRGBImage() [1/3]

template<typename T >
void pcl::visualization::ImageViewer::showRGBImage ( const pcl::PointCloud< T > &  cloud,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0 
)

Show a 2D image on screen, obtained from the RGB channel of a point cloud.

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showRGBImage() [2/3]

template<typename T >
void pcl::visualization::ImageViewer::showRGBImage ( const typename pcl::PointCloud< T >::ConstPtr &  cloud,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0 
)
inline

Show a 2D image on screen, obtained from the RGB channel of a point cloud.

Parameters
[in]cloudthe input data representing the RGB point cloud
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

◆ showRGBImage() [3/3]

void pcl::visualization::ImageViewer::showRGBImage ( const unsigned char *  data,
unsigned  width,
unsigned  height,
const std::string &  layer_id = "rgb_image",
double  opacity = 1.0 
)

Show a 2D RGB image on screen.

Parameters
[in]datathe input data representing the image
[in]widththe width of the image
[in]heightthe height of the image
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ showShortImage()

void pcl::visualization::ImageViewer::showShortImage ( const unsigned short *  short_image,
unsigned int  width,
unsigned int  height,
unsigned short  min_value = std::numeric_limits<unsigned short>::min(),
unsigned short  max_value = std::numeric_limits<unsigned short>::max(),
bool  grayscale = false,
const std::string &  layer_id = "short_image",
double  opacity = 1.0 
)

Show a 2D image (unsigned short) on screen.

Parameters
[in]short_imagethe input data representing the image in unsigned short format
[in]widththe width of the image
[in]heightthe height of the image
[in]min_valuefilter all values in the image to be larger than this minimum value
[in]max_valuefilter all values in the image to be smaller than this maximum value
[in]grayscaleshow data as grayscale (true) or not (false). Default: false
[in]layer_idthe name of the layer (default: "image")
[in]opacitythe opacity of the layer (default: 1.0)

References height, and width.

◆ spin()

void pcl::visualization::ImageViewer::spin ( )

Spin method. Calls the interactor and runs an internal loop.

◆ spinOnce()

void pcl::visualization::ImageViewer::spinOnce ( int  time = 1,
bool  force_redraw = true 
)

Spin once method. Calls the interactor and updates the screen once.

Parameters
[in]time- How long (in ms) should the visualization loop be allowed to run.
[in]force_redraw- if false it might return without doing anything if the interactor's framerate does not require a redraw yet.

◆ wasStopped()

bool pcl::visualization::ImageViewer::wasStopped ( ) const
inline

Returns true when the user tried to close the window.

Member Data Documentation

◆ algo_

vtkSmartPointer<vtkImageFlip> pcl::visualization::ImageViewer::algo_
protected

Image reslice, used for flipping the image.

Referenced by ImageViewer().

◆ data_

boost::shared_array<unsigned char> pcl::visualization::ImageViewer::data_
protected

The data array representing the image. Used internally.

◆ data_size_

std::size_t pcl::visualization::ImageViewer::data_size_
protected

The data array (representing the image) size. Used internally.

◆ exit_callback_

vtkSmartPointer<ExitCallback> pcl::visualization::ImageViewer::exit_callback_
protected

◆ exit_main_loop_timer_callback_

vtkSmartPointer<ExitMainLoopTimerCallback> pcl::visualization::ImageViewer::exit_main_loop_timer_callback_
protected

Callback object enabling us to leave the main loop, when a timer fires.

Referenced by ImageViewer(), and PclUtils::ImageVis::setRenderWindowInteractor().

◆ image_data_

std::vector<unsigned char*> pcl::visualization::ImageViewer::image_data_
protected

Internal data array. Used everytime add***Image is called. Cleared, everytime the render loop is executed.

◆ image_viewer_

vtkSmartPointer<vtkImageViewer> pcl::visualization::ImageViewer::image_viewer_
protected

The ImageViewer widget.

Referenced by PclUtils::ImageVis::createLayer().

◆ interactor_

vtkSmartPointer<vtkRenderWindowInteractor> pcl::visualization::ImageViewer::interactor_
protected

◆ interactor_style_

vtkSmartPointer<ImageViewerInteractorStyle> pcl::visualization::ImageViewer::interactor_style_
protected

The interactor style.

Referenced by PclUtils::ImageVis::addText(), and ImageViewer().

◆ keyboard_command_

vtkSmartPointer<vtkCallbackCommand> pcl::visualization::ImageViewer::keyboard_command_
protected

Referenced by ImageViewer().

◆ keyboard_signal_

boost::signals2::signal<void(const pcl::visualization::KeyboardEvent&)> pcl::visualization::ImageViewer::keyboard_signal_
protected

◆ layer_map_

LayerMap pcl::visualization::ImageViewer::layer_map_
protected

◆ mouse_command_

vtkSmartPointer<vtkCallbackCommand> pcl::visualization::ImageViewer::mouse_command_
protected

Referenced by ImageViewer().

◆ mouse_signal_

boost::signals2::signal<void(const pcl::visualization::MouseEvent&)> pcl::visualization::ImageViewer::mouse_signal_
protected

◆ ren_

◆ slice_

vtkSmartPointer<vtkImageSlice> pcl::visualization::ImageViewer::slice_
protected

Global prop. This is the actual "actor".

Referenced by PclUtils::ImageVis::addRGBImage(), ImageViewer(), and PclUtils::ImageVis::setRender().

◆ stopped_

bool pcl::visualization::ImageViewer::stopped_
protected

Set to false if the interaction loop is running.

◆ timer_id_

int pcl::visualization::ImageViewer::timer_id_
protected

Global timer ID. Used in destructor only.

Referenced by PclUtils::ImageVis::setRenderWindowInteractor().

◆ win_

vtkSmartPointer<vtkRenderWindow> pcl::visualization::ImageViewer::win_
protected

The documentation for this class was generated from the following files:
pcl
Definition: MaterialConverter.h:18
pcl::visualization::ImageViewer::addFilledRectangle
bool addFilledRectangle(unsigned int x_min, unsigned int x_max, unsigned int y_min, unsigned int y_max, const std::string &layer_id="boxes", double opacity=0.5)
Add a 2D box and fill it in with a given color.
Definition: image_viewer.cpp:676
pcl::visualization::ImageViewer
ImageViewer is a class for 2D image visualization.
Definition: image_viewer.h:83
pcl::visualization::ImageViewer::addCircle
bool addCircle(unsigned int x, unsigned int y, double radius, const std::string &layer_id="circles", double opacity=1.0)
Add a circle shape from a point and a radius.
Definition: image_viewer.cpp:629
pcl::visualization::ImageViewer::addRGBImage
void addRGBImage(const unsigned char *data, unsigned width, unsigned height, const std::string &layer_id="rgb_image", double opacity=1.0, bool autoresize=true)
Add an RGB 2D image layer, but do not render it (use spin/spinOnce to update).
Definition: image_viewer.cpp:104
ecvColor::LookUpTable::at
Rgb at(size_t color_id)
Definition: ecvColorTypes.cpp:77
ecvColor::green
constexpr Rgb green(0, MAX, 0)
pcl::visualization::ImageViewer::spin
void spin()
Spin method. Calls the interactor and runs an internal loop.
Definition: image_viewer.cpp:357
a
a[190]
Definition: essential_matrix_poly.h:19
image
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184