注意
PCLVisualizer的addText()方法不支持中文显示。
viewer.addText("不支持中文显示", 20, 60, "text");
最简单的用法,只设置文字显示的位置:
pcl::visualization::PCLVisualizer viewer("点云显示");
viewer.addText("cloud", 20, 60, "text");
复杂一点的用法,可以设置字体颜色和大小:
bool
addText (const std::string &text,
int xpos, int ypos,
const std::string &id = "", int viewport = 0);
/** \brief Add a text to screen
* \param[in] text the text to add
* \param[in] xpos the X position on screen where the text should be added
* \param[in] ypos the Y position on screen where the text should be added
* \param[in] r the red color value
* \param[in] g the green color value
* \param[in] b the blue color value
* \param[in] id the text object id (default: equal to the "text" parameter)
* \param[in] viewport the view port (default: all)
*/
bool
addText (const std::string &text, int xpos, int ypos, double r, double g, double b,
const std::string &id = "", int viewport = 0);
/** \brief Add a text to screen
* \param[in] text the text to add
* \param[in] xpos the X position on screen where the text should be added
* \param[in] ypos the Y position on screen where the text should be added
* \param[in] fontsize the fontsize of the text
* \param[in] r the red color value
* \param[in] g the green color value
* \param[in] b the blue color value
* \param[in] id the text object id (default: equal to the "text" parameter)
* \param[in] viewport the view port (default: all)
*/
bool
addText (const std::string &text, int xpos, int ypos, int fontsize, double r, double g, double b,
const std::string &id = "", int viewport = 0);
viewer.addText("cloud", 20, 60,16,255,255,255, "text");