Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag to disable window autoresizing in ImageViewer #3394

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion visualization/include/pcl/visualization/image_viewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ namespace pcl
* \param[in] height the height of the image
* \param[in] layer_id the name of the layer (default: "image")
* \param[in] opacity the opacity of the layer (default: 1.0)
* \param[in] autoresize flag to enable window to adapt to image size (default true)
*/
void
addRGBImage (const unsigned char* data, unsigned width, unsigned height,
const std::string &layer_id = "rgb_image", double opacity = 1.0);
const std::string &layer_id = "rgb_image", double opacity = 1.0,
bool autoresize = true);

/** \brief Show a 2D image on screen, obtained from the RGB channel of a point cloud.
* \param[in] cloud the input data representing the RGB point cloud
Expand Down
7 changes: 4 additions & 3 deletions visualization/src/image_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ pcl::visualization::ImageViewer::~ImageViewer ()
void
pcl::visualization::ImageViewer::addRGBImage (
const unsigned char* rgb_data, unsigned width, unsigned height,
const std::string &layer_id, double opacity)
const std::string &layer_id, double opacity, bool autoresize)
{
if (unsigned (getSize ()[0]) != width ||
unsigned (getSize ()[1]) != height)
if (autoresize &&
(unsigned (getSize ()[0]) != width ||
unsigned (getSize ()[1]) != height))
setSize (width, height);

// Check to see if this ID entry already exists (has it been already added to the visualizer?)
Expand Down