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(),
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 <<
')';
ColorOcTreeNode::Color getAverageChildColor() const
float value
stored data (payload)
const tree_iterator end_tree() const
ColorOcTreeNode * integrateNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
const unsigned int tree_depth
Maximum tree depth is fixed to 16 currently.
void writeColorHistogram(std::string filename)
void updateInnerOccupancyRecurs(ColorOcTreeNode *node, unsigned int depth)
void updateColorChildren()
const iterator end() const
void deleteNodeChild(ColorOcTreeNode *node, unsigned int childIdx)
Deletes the i-th child of the node.
std::ostream & writeData(std::ostream &s) const
ColorOcTreeNode * search(double x, double y, double z, unsigned int depth=0) const
ColorOcTreeNode * setNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
void updateOccupancyChildren()
update this node's occupancy according to its children's maximum occupancy
ColorOcTreeNode * getNodeChild(ColorOcTreeNode *node, unsigned int childIdx) const
std::ostream & operator<<(std::ostream &out, ColorOcTreeNode::Color const &c)
user friendly output in format (r g b)
AbstractOcTreeNode ** children
bool nodeHasChildren(const ColorOcTreeNode *node) const
ColorOcTreeNode * averageNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
virtual bool pruneNode(ColorOcTreeNode *node)
double getOccupancy() const
void updateInnerOccupancy()
ColorOcTree(double resolution)
Default constructor, sets resolution of leafs.
tree_iterator begin_tree(unsigned char maxDepth=0) const
ColorOcTreeNode * root
Pointer to the root NODE, NULL for empty tree.
bool nodeChildExists(const ColorOcTreeNode *node, unsigned int childIdx) const
std::istream & readData(std::istream &s)
static StaticMemberInitializer colorOcTreeMemberInit
static member to ensure static initialization (only once)
bool isNodeOccupied(const OcTreeNode *occupancyNode) const
queries whether a node is occupied according to the tree's parameter for "occupancy" ...
virtual bool isNodeCollapsible(const ColorOcTreeNode *node) const
void copyData(const ColorOcTreeNode &from)