当前位置:网站首页>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 .
边栏推荐
- [1. Delphi foundation] 1 Introduction to Delphi Programming
- 杰理之需要修改 gatt 的 profile 定义【篇】
- TypeScript 接口属性
- Simulation of holographic interferogram and phase reconstruction of Fourier transform based on MATLAB
- 洛谷P4127 [AHOI2009]同类分布 题解
- 继电反馈PID控制器参数自整定
- word中如何删除某符号前面或后面所有的文字
- How Navicat imports MySQL scripts
- 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
- 实现精细化生产, MES、APS、ERP必不可少
猜你喜欢
Set picture annotation in markdown
Games101 Lesson 7 shading 1 Notes
[cf gym101196-i] waif until dark network maximum flow
When the Jericho development board is powered on, you can open the NRF app with your mobile phone [article]
Go learning -- implementing generics based on reflection and empty interfaces
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
How to delete all the words before or after a symbol in word
How Navicat imports MySQL scripts
烧录场景下的源代码防泄密方案分享
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
随机推荐
【mysql学习笔记30】锁(非教程)
leecode-C语言实现-15. 三数之和------思路待改进版
CF1036C Classy Numbers 题解
Mise en œuvre du langage leecode - C - 15. Somme des trois chiffres - - - - - idées à améliorer
Typescript interface properties
Ble of Jerry [chapter]
Typescript indexable type
TS 类型体操 之 extends,Equal,Alike 使用场景和实现对比
Relevant introduction of clip image
[computer skills]
Opencv learning notes 9 -- background modeling + optical flow estimation
洛谷P1836 数页码 题解
The way to learn go (I) the basic introduction of go to the first HelloWorld
leecode-C語言實現-15. 三數之和------思路待改進版
解决方案:智慧工地智能巡檢方案視頻監控系統
In the era of digital economy, how to ensure security?
杰理之BLE【篇】
How can word delete English only and keep Chinese or delete Chinese and keep English
软件测试界的三无简历,企业拿什么来招聘你,石沉大海的简历
Select all the lines with a symbol in word and change them to titles