当前位置:网站首页>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), 就把之前的颜色和新的颜色做平均,就相当于这个点上所有颜色求平均。
边栏推荐
- 【mysql学习笔记29】触发器
- Twelve rules for naming variables
- navicat如何导入MySQL脚本
- TS 类型体操 之 循环中的键值判断,as 关键字使用
- C # connect to SQLite database to read content
- 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
- Simulation of Michelson interferometer based on MATLAB
- 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
- Simple and understandable high-precision addition in C language
- TS类型体操 之 字符串的妙用
猜你喜欢
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]
Fundamentals of C language 9: Functions
Apache middleware vulnerability recurrence
JMeter performance test steps practical tutorial
杰理之BLE【篇】
jmeter性能测试步骤实战教程
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
【mysql学习笔记30】锁(非教程)
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
Oracle column to row -- a field is converted to multiple rows according to the specified separator
随机推荐
Apache middleware vulnerability recurrence
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
[MySQL learning notes 30] lock (non tutorial)
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
Structure summary of SystemVerilog integrable model
Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
js對象獲取屬性的方法(.和[]方式)
Jerry's general penetration test - do data transmission with app Communication [article]
TS 体操 &(交叉运算) 和 接口的继承的区别
数字IC设计笔试题汇总(一)
#systemverilog# 可综合模型的结构总结
Emo diary 1
Force buckle day31
Relevant introduction of clip image
Full Score composition generator: living on code
word中把帶有某個符號的行全部選中,更改為標題
烧录场景下的源代码防泄密方案分享
Seriously recommend several machine learning official account
How Navicat imports MySQL scripts
学go之路(二)基本类型及变量、常量