当前位置:网站首页>octomap averageNodeColor函数说明
octomap averageNodeColor函数说明
2022-07-06 07:31:00 【蓝羽飞鸟】
averageNodeColor是ColorOcTreeNode中的函数,参数是x,y,z,r,g,b
但是官网上没说这函数具体是怎么average color的,于是只好从源码入手
根据官网提示,这个函数在Definition at line 144 of file ColorOcTree.h.
00144 ColorOcTreeNode* averageNodeColor(const float& x, const float& y,
00145 const float& z, const unsigned char& r,
00146 const unsigned char& g, const unsigned char& b) {
00147 OcTreeKey key;
00148 if (!this->coordToKeyChecked(point3d(x,y,z), key)) return NULL;
00149 return averageNodeColor(key,r,g,b);
00150 }
可以看到调用了averageNodeColor(key, r, g, b), 所以看这个重载函数的代码
00145 ColorOcTreeNode* ColorOcTree::averageNodeColor(const OcTreeKey& key,
00146 const unsigned char& r,
00147 const unsigned char& g,
00148 const unsigned char& b) {
00149 ColorOcTreeNode* n = search (key);
00150 if (n != 0) {
00151 if (n->isColorSet()) {
00152 ColorOcTreeNode::Color prev_color = n->getColor();
00153 n->setColor((prev_color.r + r)/2, (prev_color.g + g)/2, (prev_color.b + b)/2);
00154 }
00155 else {
00156 n->setColor(r, g, b);
00157 }
00158 }
00159 return n;
00160 }
可以看到是每来一个新的颜色(r, g, b), 就把之前的颜色和新的颜色做平均,就相当于这个点上所有颜色求平均。
边栏推荐
- 合规、高效,加快药企数字化转型,全新打造药企文档资源中心
- Google可能在春节后回归中国市场。
- After the hot update of uniapp, "mismatched versions may cause application exceptions" causes and Solutions
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Crawling exercise: Notice of crawling Henan Agricultural University
- Jerry's ad series MIDI function description [chapter]
- Significance and measures of encryption protection for intelligent terminal equipment
- qt颜色与字符串、uint相互转换
- Get/post/put/patch/delete meaning
- C # connect to SQLite database to read content
猜你喜欢
![[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code](/img/93/ec9de907cae4714038bb5f95aba52b.png)
[online problem processing] how to kill the corresponding process when the MySQL table deadlock is caused by the code

C - Inheritance - polymorphism - virtual function member (lower)

TypeScript接口与泛型的使用
![Ble of Jerry [chapter]](/img/ce/127b597cdd238bb0c37326f5cf8265.png)
Ble of Jerry [chapter]

Sharing of source code anti disclosure scheme under burning scenario

杰理之如若需要大包发送,需要手机端修改 MTU【篇】

Fundamentals of C language 9: Functions

QT color is converted to string and uint

Markdown 中设置图片图注
![[CF Gym101196-I] Waif Until Dark 网络最大流](/img/66/6b339fc23146b5fbdcd2a1fa0a2349.png)
[CF Gym101196-I] Waif Until Dark 网络最大流
随机推荐
Word setting directory
Scala language learning-08-abstract classes
#systemverilog# 可綜合模型的結構總結
Summary of Digital IC design written examination questions (I)
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
Go learning --- use reflection to judge whether the value is valid
Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
Sharing of source code anti disclosure scheme under burning scenario
杰理之BLE【篇】
Openjudge noi 2.1 1749: Digital Square
Project GFS data download
On the world of NDK (2)
Oracle column to row -- a field is converted to multiple rows according to the specified separator
[MySQL learning notes 30] lock (non tutorial)
Typescript variable scope
Scala语言学习-08-抽象类
Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The way to learn go (I) the basic introduction of go to the first HelloWorld
Jerry's general penetration test - do data transmission with app Communication [article]