资源简介
matlab打开las点云文件的程序,也就是m文件,能够打开激光点云的las文件
代码片段和文件信息
function A = LASreadAll(infilename)
% LASREADALL reads in all variables from a LAS 1.x data file (used with lidar data)
%
% INPUT
% infilename: input file name (for example ‘myinfile.las‘)
%
% OUTPUT
% A: This is a structure containing all the data in the file.
% See the file documentation for more information:
% http://www.asprs.org/Committee-General/LASer-LAS-File-Format-Exchange-Activities.html
%
% EXAMPLE
% A = LASreadAll(‘infile.las‘)
%
% Cici Alexander
% September 2008 (updated 26.09.2008)
% Amy Farris (afarris@usgs.gov)
% November 2013 Substatially altered to read in all variables from the file
% This file has the capability to load data files using any 1 of 5 formats.
% However I was only able to test it with one of the formats.
% I included support for the rest of the file formats b/c I
% thought someone might find it useful. I sure hope they work!!!
% If the code crashes it may be because either the pointDataFormatID
% value was not what I expected or the value for pointDataRecordLength
% is not what I think it should be based on the format ID.
% If pointDataRecordLength is different than I expected then you may need
% to change the values in fseek eg: (c+????)
% The number added to c should be the sum of bytes of all the variables
% that occur before the variable currently being read in.
%
% Also the file I tested this code with was LAS format 1.2 I
% think this code will run on later versions of LAS.
%
% A brief explanation of the LAS file format:
% LAS files are binary they begin with header information. Included in
% the header is the size of the header (in bytes); this is called
% ‘OffsetToPointData‘ refered to a ‘c‘ in this code. After c bytes the
% data begins with the first x value then the first y value and so on...
% (exactly what data is included depends on the file format). Then the
% file continues with the second x value the second y value and so on...
% The header tells you how many bytes of data there are for each data point
% (‘pointDataRecordLength‘ also refered to as ‘p‘ in this code).
% So to read in all the x values you start at the beginig of the file and
% skip c bytes: “(fseek(fid c ‘bof‘);“
% Then you read in one value and skip p-4 bytes
% (each x value consists of 4 bytes) and then read the next x and so on:
% “X1 = fread(fidinf‘int32‘p-4);“
%
% This is my (Amy Farris‘) first attempt at reading in a binary file.
% I depended strongly on Cici‘s orignal file (LASRead.m) at first. Most
% of the code after about line # 134 was written by me as are these
% garrolous beginning comments. I hope they help.
%% Open the file
fid =fopen(infilename);
% Check whether the file is valid
if fid == -1
error(‘Error opening file‘)
end
%% Read in important information from the header
% Check whether the LAS format is 1.1
fseek(fid 24 ‘bof‘);
VersionMajor = fread(fid1‘uchar‘);
- 上一篇:图像加密的源代码
- 下一篇:E5 信号导航电文阶梯码构造
相关资源
- 后方-前方交会
- matlab仿真全桥电路
- SSDA算法基于MATLAB
- 彩色图像增强matlab代码
- 熵权法matlab
- PSCAD与MATLAB的交互
- 有效地亚像素配准方法matlab
- jpegtbx1.4
- matlab蔡氏电路相图
- 基带波形 matlab实现
- 运输问题表上作业法matlab完整描述
- SSIM 全参考图像质量评价 matlab代码
- 33节点潮流计算matlab
- 流形学习算法MATLAB代码
- MATLAB与编程英文Chapman之习题解答
- matlab 使用递归方法列出或查找指定目
- 罗盘赌算法Matlab实现
- Bresenham画直线MATLAB实现
- matlab光点识别
- matlab环境下光伏电池典型模型
- 倒立摆 matlab仿真程序
- MatLab解数学方程组
- Gabor小波变换
- 用MATLAB实现彩色图像的灰度化处理
- 数值积分的龙贝格算法MATLAB程序
- MATLAB 贪吃蛇
- Matlab_Active-set算法和
- levinson_durbin算法matlab程序
- 一些用matlab编写的经典遗传算法算例
- matlab矩阵中心化的详细方法
评论
共有 条评论