当前位置:网站首页>Three. Based on ply format point cloud voxel model JS upload interface writing
Three. Based on ply format point cloud voxel model JS upload interface writing
2022-04-23 20:21:00 【Install a sound 77】
I checked the relevant materials and found the content of voxels , May be studied more thoroughly , The relevant documents are too few to find .
With a point cloud PLY File as an example ,ply You can save some clouds and his patches , It can also be used to preserve voxels .
But in three.js in Although it comes with one PLYloader As shown in the figure below :

But this PLYloader Load only Faceted ply file , For voxelized ply The file can read relevant information , But it can't be displayed in the browser . The reason is that voxels ply And dough ply The data form of is a little different .
Let's open two different ply File comparison ( Be careful ,ply The document needs to be binary Binary to ascii Format , Otherwise, it can't be used txt open )

On the left is voxelized ply file , Relatively normal in the back Ply A few parameters are missing, and the connection information of the patch is useless .( Open this and see for yourself )
Point out Voxel model focuses on that 6 In figures The first three digits represent XYZ, The last three digits represent 255 Of RGB.
Now there are coordinates and colors In fact, voxels can be generated , Of course, we need to generate in the browser .
const file_loader = new THREE.FileLoader();
file_loader.load("LOOK.ply",function (data){
ply_data.file_data =data
ply_data.point_list = ply_data.file_data.split('end_header\n')[1].split("\n")
//console.log(ply_data.point_list)
let positons = []
let colors= []
let num;
num = ply_data.point_list[1]
// in the light of ply_data.point_list Data cleansing
ply_data.point_list.length -= 1;
// Delete two items
ply_data.point_list.shift();
ply_data.point_list.shift();
for (let point_str of ply_data.point_list){
//console.log(point_str)
let str_list = point_str.split(" ")
positons.push(str_list[0],str_list[1],str_list[2])
colors.push(str_list[3]/255,str_list[4]/255,str_list[5]/255)
// Make a rectangle
var material2 = new THREE.MeshBasicMaterial( );
var cubeGeometry2 = new THREE.BoxGeometry(1,1,1);
var cube =new THREE.Mesh(cubeGeometry2, material2)
cube.position.x =str_list[0]
cube.position.y =str_list[1]
cube.position.z =str_list[2]
cube.material.color.r=str_list[3]/255
cube.material.color.g=str_list[4]/255
cube.material.color.b=str_list[5]/255
scene.add(cube)
}
So with three.js Write an interface , The principle is right txt File segmentation , Find the content of each paragraph , The rectangle is generated by itself , I used it here mesh Generate , Can't find setAttribute This method of , I think PCDloader This method is used to load point clouds in batch , But in the mesh I didn't find it in the cube ... So loop generated , It should affect the speed of loading .
The result of the last load :

Disadvantages of voxel model , Because the browser load is too stretched , Without optimization Can't generate too many small squares ( Optimization estimation is also important ), Otherwise, it's easy to get stuck , This is also three.js The reason why voxels are not used very much in .
版权声明
本文为[Install a sound 77]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551491079.html
边栏推荐
- Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
- 2022 - Data Warehouse - [time dimension table] - year, week and holiday
- Servlet learning notes
- Monte Carlo py solves the area problem! (save pupils Series)
- Sqoop imports tinyint type fields to boolean type
- nc基础用法
- Commit and rollback in DCL of 16 MySQL
- RT-1052学习笔记 - GPIO架构分析
- Numpy Index & slice & iteration
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
猜你喜欢

STM32基础知识

16MySQL之DCL 中 COMMIT和ROllBACK
![[talkative cloud native] load balancing - the passenger flow of small restaurants has increased](/img/ba/4ccf0c2181572fed16bbc9c797d557.png)
[talkative cloud native] load balancing - the passenger flow of small restaurants has increased

DNS cloud school | quickly locate DNS resolution exceptions and keep these four DNS status codes in mind

selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT

PCL点云处理之计算两平面交线(五十一)

Wave field Dao new species end up, how does usdd break the situation and stabilize the currency market?

WordPress插件:WP-China-Yes解决国内访问官网慢的方法

SQL Server connectors by thread pool 𞓜 instructions for dtsqlservertp plug-in

Servlet learning notes
随机推荐
Implementation of mypromise
Redis distributed lock
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
Numpy - creation of data type and array
Modeling based on catiav6
nc基础用法2
Numpy sort search count set
Mysql database and table building: the difference between utf8 and utf8mb4
aqs的学习
How to do product innovation—— Exploration of product innovation methodology I
2022 - Data Warehouse - [time dimension table] - year, week and holiday
nc基础用法4
Es index (document name) fuzzy query method (database name fuzzy query method)
R语言使用econocharts包创建微观经济或宏观经济图、indifference函数可视化无差异曲线、自定义计算交叉点、自定义配置indifference函数的参数丰富可视化效果
【PTA】整除光棍
An error is reported when sqoop imports data from Mysql to HDFS: sqlexception in nextkeyvalue
Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
Unity 模型整体更改材质
R语言ggplot2可视化分面图(facet_wrap)、使用lineheight参数自定义设置分面图标签栏(灰色标签栏)的高度
Browser - learning notes