Go to the documentation of this file.
61 for (
int i=0; i<8; i++) {
77 return Color((uint8_t) mr, (uint8_t) mg, (uint8_t) mb);
80 return Color(255, 255, 255);
118 for (
unsigned int i=0;i<8;i++) {
137 for (
unsigned int i = 1; i<8; i++) {
154 n->
setColor((prev_color.
r + r)/2, (prev_color.
g + g)/2, (prev_color.
b + b)/2);
172 uint8_t new_r = (uint8_t) ((
double) prev_color.
r * node_prob
173 + (double) r * (0.99-node_prob));
174 uint8_t new_g = (uint8_t) ((
double) prev_color.
g * node_prob
175 + (double) g * (0.99-node_prob));
176 uint8_t new_b = (uint8_t) ((
double) prev_color.
b * node_prob
177 + (double) b * (0.99-node_prob));
197 for (
unsigned int i=0; i<8; i++) {
211 fprintf(stderr,
"The color histogram uses gnuplot, this is not supported under windows.\n");
214 std::vector<int> histogram_r (256,0);
215 std::vector<int> histogram_g (256,0);
216 std::vector<int> histogram_b (256,0);
217 for(ColorOcTree::tree_iterator it = this->
begin_tree(),
219 if (!it.isLeaf() || !this->isNodeOccupied(*it))
continue;
226 FILE *gui = popen(
"gnuplot ",
"w");
227 fprintf(gui,
"set term postscript eps enhanced color\n");
228 fprintf(gui,
"set output \"%s\"\n", filename.c_str());
229 fprintf(gui,
"plot [-1:256] ");
230 fprintf(gui,
"'-' w filledcurve lt 1 lc 1 tit \"r\",");
231 fprintf(gui,
"'-' w filledcurve lt 1 lc 2 tit \"g\",");
232 fprintf(gui,
"'-' w filledcurve lt 1 lc 3 tit \"b\",");
233 fprintf(gui,
"'-' w l lt 1 lc 1 tit \"\",");
234 fprintf(gui,
"'-' w l lt 1 lc 2 tit \"\",");
235 fprintf(gui,
"'-' w l lt 1 lc 3 tit \"\"\n");
237 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_r[i]);
238 fprintf(gui,
"0 0\n"); fprintf(gui,
"e\n");
239 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_g[i]);
240 fprintf(gui,
"0 0\n"); fprintf(gui,
"e\n");
241 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_b[i]);
242 fprintf(gui,
"0 0\n"); fprintf(gui,
"e\n");
243 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_r[i]);
245 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_g[i]);
247 for (
int i=0; i<256; ++i) fprintf(gui,
"%d %d\n", i, histogram_b[i]);
254 return out <<
'(' << (
unsigned int)c.
r <<
' ' << (
unsigned int)c.
g <<
' ' << (
unsigned int)c.
b <<
')';
virtual bool isNodeCollapsible(const ColorOcTreeNode *node) const
void updateColorChildren()
ColorOcTree(double resolution)
Default constructor, sets resolution of leafs.
virtual bool pruneNode(ColorOcTreeNode *node)
void deleteNodeChild(ColorOcTreeNode *node, unsigned int childIdx)
Deletes the i-th child of the node.
ColorOcTreeNode * averageNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
std::ostream & writeData(std::ostream &s) const
float value
stored data (payload)
const unsigned int tree_depth
Maximum tree depth is fixed to 16 currently.
void updateInnerOccupancy()
ColorOcTreeNode * root
Pointer to the root NODE, NULL for empty tree.
ColorOcTreeNode * search(double x, double y, double z, unsigned int depth=0) const
const tree_iterator end_tree() const
static StaticMemberInitializer colorOcTreeMemberInit
static member to ensure static initialization (only once)
ColorOcTreeNode * integrateNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
bool nodeChildExists(const ColorOcTreeNode *node, unsigned int childIdx) const
void updateOccupancyChildren()
update this node's occupancy according to its children's maximum occupancy
bool nodeHasChildren(const ColorOcTreeNode *node) const
void copyData(const ColorOcTreeNode &from)
std::ostream & operator<<(std::ostream &out, ColorOcTreeNode::Color const &c)
user friendly output in format (r g b)
tree_iterator begin_tree(unsigned char maxDepth=0) const
void updateInnerOccupancyRecurs(ColorOcTreeNode *node, unsigned int depth)
void writeColorHistogram(std::string filename)
ColorOcTreeNode::Color getAverageChildColor() const
ColorOcTreeNode * getNodeChild(ColorOcTreeNode *node, unsigned int childIdx) const
const iterator end() const
double getOccupancy() const
ColorOcTreeNode * setNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
AbstractOcTreeNode ** children
std::istream & readData(std::istream &s)
octomap
Author(s): Kai M. Wurm
, Armin Hornung
autogenerated on Tue Dec 12 2023 03:39:40