当前位置:网站首页>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), 就把之前的颜色和新的颜色做平均,就相当于这个点上所有颜色求平均。
边栏推荐
- js對象獲取屬性的方法(.和[]方式)
- Typescript indexable type
- 洛谷P4127 [AHOI2009]同类分布 题解
- How to delete all the words before or after a symbol in word
- TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
- Simple and understandable high-precision addition in C language
- How Navicat imports MySQL scripts
- The differences and advantages and disadvantages between cookies, seeion and token
- 数字经济时代,如何保障安全?
- Uni app third party package configuration network request
猜你喜欢
Multi attribute object detection on rare aircraft data sets: experimental process using yolov5
Crawling exercise: Notice of crawling Henan Agricultural University
Fundamentals of C language 9: Functions
[MySQL learning notes 32] mvcc
Ali's redis interview question is too difficult, isn't it? I was pressed on the ground and rubbed
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
Related operations of Excel
Typescript interface and the use of generics
JDBC learning notes
随机推荐
可变参数重载时的内存错误
洛谷P1836 数页码 题解
【mysql学习笔记29】触发器
Luogu p4127 [ahoi2009] similar distribution problem solution
Bit operation XOR
QT color is converted to string and uint
[MySQL learning notes 32] mvcc
杰理之普通透传测试---做数传搭配 APP 通信【篇】
Luogu p1836 number page solution
Week6 weekly report
TypeScript 变量作用域
GET/POST/PUT/PATCH/DELETE含义
Significance and measures of encryption protection for intelligent terminal equipment
How MySQL merges data
Twelve rules for naming variables
Uni app practical project
C # display the list control, select the file to obtain the file path and filter the file extension, and RichTextBox displays the data
OpenJudge NOI 2.1 1749:数字方格
SSM learning
数字IC设计笔试题汇总(一)