当前位置:网站首页>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 .
边栏推荐
- Simple and understandable high-precision addition in C language
- 杰理之AD 系列 MIDI 功能说明【篇】
- 2022年Instagram运营小技巧简单讲解
- Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
- 【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
- When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
- [MySQL learning notes 29] trigger
- How MySQL merges data
- OpenJudge NOI 2.1 1661:Bomb Game
- Scala language learning-08-abstract classes
猜你喜欢
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
Generator Foundation
TS 类型体操 之 循环中的键值判断,as 关键字使用
Excel的相关操作
Pre knowledge reserve of TS type gymnastics to become an excellent TS gymnastics master
navicat如何导入MySQL脚本
NiO programming introduction
【MySQL学习笔记32】mvcc
Opencv learning notes 9 -- background modeling + optical flow estimation
Ble of Jerry [chapter]
随机推荐
Jerry needs to modify the profile definition of GATT [chapter]
Ble of Jerry [chapter]
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Typescript interface and the use of generics
qt颜色与字符串、uint相互转换
杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】
【线上问题处理】因代码造成mysql表死锁的问题,如何杀掉对应的进程
Select all the lines with a symbol in word and change them to titles
Typescript indexable type
OpenJudge NOI 2.1 1749:数字方格
[1. Delphi foundation] 1 Introduction to Delphi Programming
Go learning --- use reflection to judge whether the value is valid
Wonderful use of TS type gymnastics string
OpenJudge NOI 2.1 1661:Bomb Game
Le chemin du navigateur Edge obtient
合规、高效,加快药企数字化转型,全新打造药企文档资源中心
How to delete all the words before or after a symbol in word
Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
After the hot update of uniapp, "mismatched versions may cause application exceptions" causes and Solutions
杰理之AD 系列 MIDI 功能说明【篇】