当前位置:网站首页>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
边栏推荐
- Es index (document name) fuzzy query method (database name fuzzy query method)
- Paper writing 19: the difference between conference papers and journal papers
- JDBC database addition, deletion, query and modification tool class
- Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]
- WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
- Monte Carlo py solves the area problem! (save pupils Series)
- 【PTA】L2-011 玩转二叉树
- R language uses econocrats package to create microeconomic or macroeconomic map, visualize indifference function indifference curve, customize calculation intersection, and customize the parameters of
- Modeling based on catiav6
- R语言使用caret包的preProcess函数进行数据预处理:对所有的数据列进行BoxCox变换处理(将非正态分布数据列转换为正态分布数据、不可以处理负数)、设置method参数为BoxCox
猜你喜欢

How to protect ECs from hacker attacks?

【PTA】整除光棍

波场DAO新物种下场,USDD如何破局稳定币市场?

DTMF双音多频信号仿真演示系统

An error is reported when sqoop imports data from Mysql to HDFS: sqlexception in nextkeyvalue

16MySQL之DCL 中 COMMIT和ROllBACK

PIP installation package reports an error. Could not find a version that satisfies the requirement pymysql (from versions: none)

网络通信基础(局域网、广域网、IP地址、端口号、协议、封装、分用)

Livego + ffmpeg + RTMP + flvjs to realize live video

DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
随机推荐
An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
DTMF双音多频信号仿真演示系统
ABAQUS script email auto notification
Implementation of mypromise
Numpy sort search count set
LeetCode动态规划训练营(1~5天)
JDBC tool class jdbcfiledateutil uploads files and date format conversion, including the latest, simplest and easiest way to upload single files and multiple files
RT-1052学习笔记 - GPIO架构分析
[graph theory brush question-4] force deduction 778 Swimming in a rising pool
腾讯邱东洋:深度模型推理加速的术与道
Change the material of unity model as a whole
nc基础用法3
Confusion about thread blocking after calling the read () method of wrapper flow
本地调用feign接口报404
R语言使用caret包的preProcess函数进行数据预处理:对所有的数据列进行BoxCox变换处理(将非正态分布数据列转换为正态分布数据、不可以处理负数)、设置method参数为BoxCox
Leetcode dynamic planning training camp (1-5 days)
ArcGIS js api 4. X submergence analysis and water submergence analysis
Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
Monte Carlo py solves the area problem! (save pupils Series)
Building the tide, building the foundation and winning the future -- the successful holding of zdns Partner Conference