Open csnsNayana opened 3 years ago
If the converter is working correctly, then the LAZ file has a bad bounding box. The size, min, and max are all 0. So basically every point would be located outside a 0-sized boundary. Can you double check that your point cloud has a good bounding box? I think you can attempt a repair with one of the utilities found in LAS Tools.
By the way, can you try running this conversion with the LAS version of the point cloud? It would be good to know if the LAZ reader is causing an unexpected complication.
@midnight-dev same issue, I use this code convert pcd to las. pcl 1.9.1 las 1.8.2
std::ofstream ofs(outPath.c_str(), ios::out | ios::binary);
if (!ofs.is_open())
{
std::cout << "err to open file las....." << std::endl;
return;
}
liblas::Header header;
header.SetVersionMajor(1);
header.SetVersionMinor(2);
header.SetDataFormatId(liblas::ePointFormat3);
header.SetScale(0.001, 0.001, 0.001);
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile(inPath, *cloud);
std::cout << "total:" << cloud->points.size() << std::endl;
liblas::Writer writer(ofs, header);
liblas::Point point(&header);
for (size_t i = 0; i < cloud->points.size(); i++)
{
double x = cloud->points[i].x;
double y = cloud->points[i].y;
double z = cloud->points[i].z;
point.SetCoordinates(x, y, z);
writer.WritePoint(point);
//std::cout << x << "," << y << "," << z << std::endl;
}
double minPt[3] = { 9999999, 9999999, 9999999};
double maxPt[3] = { 0, 0, 0 };
header.SetPointRecordsCount(cloud->points.size());
header.SetPointRecordsByReturnCount(0, cloud->points.size());
header.SetMax(maxPt[0], maxPt[1], maxPt[2]);
header.SetMin(minPt[0], minPt[1], minPt[2]);
writer.SetHeader(header);
Hey there, Heaven.
I think the converter will probably throw a fit when trying to make sense of your min/max values. Can you set the header minimum to the origin 0, 0, 0
and maximum to the far positive vector? (could round it to a clean 10m for XYZ, by the way)
Any points outside the max bounding box dimensions would be invalid, and everything is outside a max of 0, 0, 0
.
@midnight-dev ok. I will try
fix it by change convert
@LightSun What converter you used?
@Frander here: https://github.com/potree/PotreeConverter. but change the source code follow the message('invalid bounding box. at least one axis has a size of zero').
Hello, I also encountered this problem. How to effectively and simply solve the problem?
I find PotreeConverter_1.7_x64_windows.zip is success. But PotreeConverter_2.1_x64_windows.zip on the contrary.
Great!No Chinese in file path the is success
I can confirm this issue if the las file itself contains non-ansi characters, like German Umlauts:
Working: "demo_flaeche.las" Not working: "demo_fläche.las"
In my experience these empty bounding boxes in LAZ are being generated by Polycam, an app that runs on the iPhone12/13 Pro which has a solid state lidar.
To get round this problem I'm having to wrap PotreeConverter in the following Python script.
import subprocess, tempfile, laspy
args = [potreeconverterexe, "--source", inlaz, "--outdir",
outdir, "--attributes", "position_cartesian",
"--attributes", "rgb", "--method", "poisson"]
p = subprocess.run(args, capture_output=True)
if p.returncode != 0 and b"invalid bounding box" in p.stdout:
lp = laspy.open(options.inlaz, "r").read()
lz = tempfile.NamedTemporaryFile(suffix=os.path.splitext(options.inlaz)[1])
lpf = laspy.open(lz.name, "w", header=lp.header)
lpf.write_points(lp.points)
lpf.close()
args[2] = lzname
p = subprocess.run(args, capture_output=True)
All it does is load and save the file using the Python laspy library, which fills in these range values from the points.
Given that this range attribute in the header is redundant and nothing more than a source of failure, why not have an option in PotreeConverter to ignore it and calculate it itself?
Hi,
I downloaded the PotreeConverter_2.1_x64_windows.zip version and tried to execute PotreeConvertor exe with cmd as Administrator on Windows 10 and I am using it for .laz files:
It is working fine for some files but giving following error for one of the .laz file,
ERROR(main.cpp:264): invalid bounding box. at least one axis has a size of zero.
Any ideas/suggestions of how to fix this issue? (found similar issues posted by other peoples but no solutions.)
screenshot is attached for reference.
Thanks in advance