为了促进同行业人员(特指 LiDAR 点云处理人员或相近行业)的技术交流,解决平时开发过程中遇到的技术性问题,博主建立一个QQ群,欢迎大家积极加入,共同引领点云行业的快速发展 ~
群名:LiDAR点云部落
群号:190162198
以上引用自:PengPengBlog 的 liblas和lastools的关系
不要在 Github 上下载,下载的貌似不能用
路径尽量不要带中文和空格
其实这里用 VS 哪个版本都无所谓,相差无几
出现复查项目和解决方案更改,直接确定
XXXX.XXX 已损坏无法打开,直接确定若干次
选中加载失败的工程,右键移除(DEL)
修改 LASlib 的属性,配置全部修改成 Release ,平台全部修改成 x64
C/C++ -> 常规 -> 附加包含目录下 删除 …las\zip\stl
有的教程说还要添加预编译器,经测试,没必要添加,添加后会报错
行数只是个大概,找自己的即可,有的可能显示的不是 #if defined(_MSC_VER) || defined (MINGW32),没什么关系,只留下#if defined(_MSC_VER)即可
修改前
#if defined(_MSC_VER) || defined (__MINGW32__)
typedef int BOOL;
#else
typedef bool BOOL;
#endif
修改后
#if defined(_MSC_VER) // || defined (__MINGW32__)
typedef int BOOL;
#else
typedef bool BOOL;
#endif
有的博客说把这部分全部注释掉,改成
typedef int Bool
经测试,这样改并不正确
参考博客:visual studio 2017出现MSB8020,MSB8036等SDK版本选择的错误
参考博客:VS2017不能打开stdio.h等文件
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>D:\LAStools\LASzip\src;D:\LAStools\LASlib\inc;$(IncludePath)IncludePath>
<LibraryPath>D:\LAStools\LASlib\lib;$(LibraryPath)LibraryPath>
PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>LASlib.lib;%(AdditionalDependencies)AdditionalDependencies>
Link>
ItemDefinitionGroup>
<ItemGroup />
Project>
#include
#include "lasreader.hpp"
void foo(){
//laslib只允许'\\'格式的文件路径。
std::string lasFile("E:\\test_LAStools.las"); //替换成自己的路径
//打开las文件
LASreadOpener lasreadopener;
lasreadopener.set_file_name(lasFile.c_str());
LASreader* lasreader = lasreadopener.open();
//size_t count = lasreader->header.number_of_point_records;
int loop_time = 0;
while (lasreader->read_point() && loop_time < 10) //只让输出前 10 行坐标
{
std::cout << lasreader->point.get_x() << " "
<< lasreader->point.get_y() << " "
<< lasreader->point.get_z() << std::endl;
loop_time++;
}
lasreader->close();
delete lasreader;
}
int main(){
foo();
return 0;
}
参考一:error LNK2038: 检测到“RuntimeLibrary”的不匹配项: 值“MDd_DynamicDebug”不匹配值“MTd_StaticDebug”
参考二:值“MD_DynamicRelease”不匹配值“MDd_DynamicDebug”的问题
参考博客:error LNK2005: ___xi_a 已经在 msvcrt.lib(cinitexe.obj) 中定义
或者
converts LAZ file to ASCII and places the x, y, and z coordinates at the 1st, 2nd, and 3rd entry and the r, g, and b value of the RGB color as the 4th, 5th, and 6th entry of each line. the entries are separated by a space. note that lidar.las should be format 1.2 or higher (because 1.0 and 1.1 do not support RGB colors).
converts LAS file to ASCII and places the x, y, and z coordinate of each point at the 1st, 2nd, and 3rd entry of each line. the entries are separated by a space.
converts LAZ file to ASCII and places the x, y, and z coordinate at the 1st, 2nd, and 3rd entry, the classification at the 4th and the user data as the 5th entry of each line. the entries are separated by a semicolon. at the beginning of the file we print the header information as a comment starting with a ‘%’ symbol.