当前位置:网站首页>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), 就把之前的颜色和新的颜色做平均,就相当于这个点上所有颜色求平均。
边栏推荐
- Crawling exercise: Notice of crawling Henan Agricultural University
- TypeScript接口与泛型的使用
- TypeScript 变量作用域
- 1015 reversible primes (20 points) prime d-ary
- 合规、高效,加快药企数字化转型,全新打造药企文档资源中心
- Leecode-c language implementation -15 Sum of three ----- ideas to be improved
- Fundamentals of C language 9: Functions
- Lesson 12 study notes 2022.02.11
- Significance and measures of encryption protection for intelligent terminal equipment
- TypeScript 接口属性
猜你喜欢

Apache middleware vulnerability recurrence

jmeter性能测试步骤实战教程

Set picture annotation in markdown

杰理之蓝牙设备想要发送数据给手机,需要手机先打开 notify 通道【篇】

杰理之BLE【篇】

The way to learn go (I) the basic introduction of go to the first HelloWorld

Solution to the problem of breakthrough in OWASP juice shop shooting range

数字经济时代,如何保障安全?

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

Leecode-c language implementation -15 Sum of three ----- ideas to be improved
随机推荐
Word setting directory
位运算异或
C - Inheritance - hidden method
JMeter performance test steps practical tutorial
Multithreading and concurrent programming (2)
【mysql学习笔记30】锁(非教程)
Ble of Jerry [chapter]
杰理之AD 系列 MIDI 功能说明【篇】
TypeScript 可索引类型
Lesson 12 study notes 2022.02.11
Comparison of usage scenarios and implementations of extensions, equal, and like in TS type Gymnastics
Seriously recommend several machine learning official account
jmeter性能测试步骤实战教程
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
#systemverilog# 可综合模型的结构总结
TypeScript void 基础类型
http缓存,强制缓存,协商缓存
[JDBC] quick start tutorial
C intercept string
杰理之开发板上电开机,就可以手机打开 NRF 的 APP【篇】