当前位置:网站首页>Description of octomap averagenodecolor function
Description of octomap averagenodecolor function
2022-07-06 07:37:00 【Blue feather birds】
averageNodeColor yes ColorOcTreeNode The function in , Parameter is x,y,z,r,g,b
But the official website didn't say how this function works average color Of , So we have to start with the source code
According to the tips on the official website , This function is in the 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 }
You can see the call averageNodeColor(key, r, g, b), So look at the code of this overloaded function
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 }
You can see that every new color comes (r, g, b), Just average the previous color with the new color , It is equivalent to averaging all colors at this point .
边栏推荐
- 杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】
- Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer
- 学go之路(一)go的基本介绍到第一个helloworld
- Ble of Jerry [chapter]
- Scala语言学习-08-抽象类
- [dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
- 上线APS系统,破除物料采购计划与生产实际脱钩的难题
- 2022年Instagram运营小技巧简单讲解
- Brief explanation of instagram operation tips in 2022
- OpenJudge NOI 2.1 1749:数字方格
猜你喜欢
![If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]](/img/57/12a97ab3d2dabfaf06bbe1788450cf.png)
If Jerry needs to send a large package, he needs to modify the MTU on the mobile terminal [article]

软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历

杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】

Simulation of Teman green interferometer based on MATLAB

杰理之BLE【篇】

Multi attribute object detection on rare aircraft data sets: experimental process using yolov5

TS 类型体操 之 循环中的键值判断,as 关键字使用

navicat如何导入MySQL脚本

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

Bugku CTF daily question: do you want seeds? Blackmailed
随机推荐
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
Do you really think binary search is easy
opencv学习笔记八--答题卡识别
学go之路(二)基本类型及变量、常量
洛谷P1836 数页码 题解
【MySQL学习笔记32】mvcc
Bloom taxonomy
剪映的相关介绍
解决方案:智慧工地智能巡检方案视频监控系统
Opencv learning notes 9 -- background modeling + optical flow estimation
[dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
C # connect to SQLite database to read content
Google可能在春节后回归中国市场。
Ble of Jerry [chapter]
继电反馈PID控制器参数自整定
数字IC设计笔试题汇总(一)
Typescript variable scope
edge瀏覽器 路徑獲得
TypeScript 变量作用域
Oracle column to row -- a field is converted to multiple rows according to the specified separator