las2pcd

227 views
Skip to first unread message

jianghuiy...@gmail.com

unread,
Oct 8, 2016, 1:21:55 PM10/8/16
to LAStools - efficient tools for LiDAR processing
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <string>
#include <vector>
#include <fstream>
#include <ios>
#include "lasreader.hpp"


//#pragma comment(lib, "D:\\LAStools\\LASlib\\Debug\\LASlib.lib")
#ifdef __cplusplus
extern "C"
#endif
{FILE _iob[3] = {__iob_func()[0], __iob_func()[1], __iob_func()[2]};}
//将'/'格式的文件路径转换成 '\\';
static std::string convertFilePath(const std::string& file)
{
       
int i = 0;
        std
::string s(file);
       
for(i = 0; i < s.size(); ++i)
       
{
               
if(s[i] == '/')
                        s
[i] = '\\';
       
}
       
return s;
}


int main(int argc, char* argv[])
{
       
const char* your_las_file_path = "D:/体育场南路250米.las";
       
const char* your_pcd_out_file_path = "D:\\00.pcd";
       
//laslib只允许'\\'格式的文件路径。
        std
::string lasFile = convertFilePath(your_las_file_path);




       
//打开las文件
       
LASreadOpener lasreadopener;
        lasreadopener
.set_file_name(lasFile.c_str());
       
LASreader* lasreader = lasreadopener.open();
        size_t count
= lasreader->header.number_of_point_records;
        pcl
::PointCloud<pcl::PointXYZ>::Ptr pointCloudPtr(new pcl::PointCloud<pcl::PointXYZ>);
        pointCloudPtr
->resize(count);
        pointCloudPtr
->width = 1;
        pointCloudPtr
->height = count;
        pointCloudPtr
->is_dense = false;
        size_t i
= 0;
       
while(lasreader->read_point() && i < count)
       
{
                pointCloudPtr
->points[i].x = lasreader->point.get_x();
                pointCloudPtr
->points[i].y = lasreader->point.get_y();
                pointCloudPtr
->points[i].z = lasreader->point.get_z();
               
++i;
       
}
        pcl
::io::savePCDFileASCII(your_pcd_out_file_path,*pointCloudPtr);
       
return 0;
}







this is the code that I downloaded from the Internet, I want to turn the LAS format into pcd format ,thus,I could use it for PCL learning .but I have the problem such as:



>LASlib.lib(lasreader_las.obj) : error LNK2019: 无法解析的外部符号 "public: int __thiscall istream::get(void)" (?get@istream@@QAEHXZ),该符号在函数 "public: virtual unsigned int __thiscall ByteStreamInIstream::getByte(void)" (?getByte@ByteStreamInIstream@@UAEIXZ) 中被引用
1>LASlib.lib(lasreader_las.obj) : error LNK2019: 无法解析的外部符号 "public: class istream & __thiscall istream::read(char *,int)" (?read@istream@@QAEAAV1@PADH@Z),该符号在函数 "public: virtual void __thiscall ByteStreamInIstream::getBytes(unsigned char *,unsigned int)" (?getBytes@ByteStreamInIstream@@UAEXPAEI@Z) 中被引用
1>LASlib.lib(lasreader_las.obj) : error LNK2019: 无法解析的外部符号 "public: long __thiscall istream::tellg(void)" (?tellg@istream@@QAEJXZ),该符号在函数 "public: virtual __int64 __thiscall ByteStreamInIstream::tell(void)const " (?tell@ByteStreamInIstream@@UBE_JXZ) 中被引用
1>LASlib.lib(lasreader_las.obj) : error LNK2019: 无法解析的外部符号 "public: class istream & __thiscall istream::seekg(long)" (?seekg@istream@@QAEAAV1@J@Z),该符号在函数 "public: virtual int __thiscall ByteStreamInIstream::seek(__int64)" (?seek@ByteStreamInIstream@@UAEH_J@Z) 中被引用
1>LASlib.lib(lasreader_las.obj) : error LNK2019: 无法解析的外部符号 "public: class istream & __thiscall istream::seekg(long,enum ios::seek_dir)" (?seekg@istream@@QAEAAV1@JW4seek_dir@ios@@@Z),该符号在函数 "public: virtual int __thiscall ByteStreamInIstream::seekEnd(__int64)" (?seekEnd@ByteStreamInIstream@@UAEH_J@Z) 中被引用
1>LASlib.lib(laswriter_las.obj) : error LNK2019: 无法解析的外部符号 "public: class ostream & __thiscall ostream::put(unsigned char)" (?put@ostream@@QAEAAV1@E@Z),该符号在函数 "public: virtual int __thiscall ByteStreamOutOstream::putByte(unsigned char)" (?putByte@ByteStreamOutOstream@@UAEHE@Z) 中被引用
1>LASlib.lib(laswriter_las.obj) : error LNK2019: 无法解析的外部符号 "public: class ostream & __thiscall ostream::write(char const *,int)" (?write@ostream@@QAEAAV1@PBDH@Z),该符号在函数 "public: virtual int __thiscall ByteStreamOutOstream::putBytes(unsigned char const *,unsigned int)" (?putBytes@ByteStreamOutOstream@@UAEHPBEI@Z) 中被引用
1>LASlib.lib(laswriter_las.obj) : error LNK2019: 无法解析的外部符号 "public: long __thiscall ostream::tellp(void)" (?tellp@ostream@@QAEJXZ),该符号在函数 "public: virtual __int64 __thiscall ByteStreamOutOstream::tell(void)const " (?tell@ByteStreamOutOstream@@UBE_JXZ) 中被引用
1>LASlib.lib(laswriter_las.obj) : error LNK2019: 无法解析的外部符号 "public: class ostream & __thiscall ostream::seekp(long)" (?seekp@ostream@@QAEAAV1@J@Z),该符号在函数 "public: virtual int __thiscall ByteStreamOutOstream::seek(__int6

在此输入代码...
4)"
(?seek@ByteStreamOutOstream@@UAEH_J@Z) 中被引用
1>LASlib.lib(laswriter_las.obj) : error LNK2019: 无法解析的外部符号 "public: class ostream & __thiscall ostream::seekp(long,enum ios::seek_dir)" (?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z),该符号在函数 "public: virtual int __thiscall ByteStreamOutOstream::seekEnd(void)" (?seekEnd@ByteStreamOutOstream@@UAEHXZ) 中被引用
1>F:\vs projects\pcl_test\Debug\pcl_test.exe : fatal error LNK1120: 10 个无法解析的外部命令
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 ==========



Reply all
Reply to author
Forward
0 new messages