当前位置:网站首页>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), 就把之前的颜色和新的颜色做平均,就相当于这个点上所有颜色求平均。
边栏推荐
- Scala language learning-08-abstract classes
- qt颜色与字符串、uint相互转换
- leecode-C語言實現-15. 三數之和------思路待改進版
- Select all the lines with a symbol in word and change them to titles
- word中把带有某个符号的行全部选中,更改为标题
- Go learning --- use reflection to judge whether the value is valid
- chrome查看页面fps
- 软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
- [dictionary tree] [trie] p3879 [tjoi2010] reading comprehension
- [computer skills]
猜你喜欢
数字经济时代,如何保障安全?
Week6 weekly report
Redis builds clusters
JMeter performance test steps practical tutorial
剪映的相关介绍
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
[MySQL learning notes 30] lock (non tutorial)
leecode-C語言實現-15. 三數之和------思路待改進版
Bugku CTF daily question: do you want seeds? Blackmailed
TypeScript接口与泛型的使用
随机推荐
Typescript void base type
杰理之BLE【篇】
C语言 简单易懂的高精度加法
OpenJudge NOI 2.1 1661:Bomb Game
TypeScript接口与泛型的使用
If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
#systemverilog# 可綜合模型的結構總結
Fundamentals of C language 9: Functions
Week6 weekly report
QT color is converted to string and uint
杰理之普通透传测试---做数传搭配 APP 通信【篇】
杰理之BLE【篇】
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
Seriously recommend several machine learning official account
Go learning -- implementing generics based on reflection and empty interfaces
TypeScript 变量作用域
Basics of reptile - Scratch reptile
学go之路(二)基本类型及变量、常量
Crawling exercise: Notice of crawling Henan Agricultural University
[window] when the Microsoft Store is deleted locally, how to reinstall it in three steps