PotreeConverter icon indicating copy to clipboard operation
PotreeConverter copied to clipboard

repaired bounding boxes rounding problem?

Open msemtd opened this issue 4 years ago • 17 comments

PotreeConverter_2.1_x64_windows doesn't like the bounding boxes of LAZ files that have been repaired with LAStools-2021-07-20/lasinfo -repair_bb that appear to be due to rounding values...

ERROR(chunker_countsort_laszip.cpp:237): encountered point outside bounding box.
box.min: -10.192, -14.1157, -1.7038
box.max: 17.855499999999999, 13.931799999999999, 26.343699999999998
point: 7.3163, 13.931800000000001, -1.649
file: whatever.laz
PotreeConverter requires a valid bounding box to operate.
Please try to repair the bounding box, e.g. using lasinfo with the -repair_bb argument.

msemtd avatar Sep 09 '21 14:09 msemtd

Same problem!

Y axis on box.max a bit smaller than point y-coordinate.

ERROR(chunker_countsort_laszip.cpp:237): encountered point outside bounding box. box.min: 546751.69976062572, 6051869.2593929153, 138.13107263576239 box.max: 546837.05885304476, 6051954.6184853343, 223.49016505479813 point: 546764.08499999996, 6051954.6200000001, 143.55500000000001 file: file.las PotreeConverter requires a valid bounding box to operate. Please try to repair the bounding box, e.g. using lasinfo with the -repair_bb argument.

vovo-4K avatar Nov 01 '21 12:11 vovo-4K

Hi,

I got the same issue.

I didn't succeed to solve this using lasinfo.

I succeeded to to solve the issue by modifying the 3 lines in the source code 221 -->223 (in chunker_countsort_laszip.cpp) then recompile... :

float ux = (float(X) * posScale.x + posOffset.x - min.x) / size.x;
float uy = (float(Y) * posScale.y + posOffset.y - min.y) / size.y;
float uz = (float(Z) * posScale.z + posOffset.z - min.z) / size.z;

regards

tlobbri avatar Dec 20 '21 12:12 tlobbri

I modified the code and is to be found here: https://github.com/ykhedar/PotreeConverter

ykhedar avatar Feb 21 '22 18:02 ykhedar

Cheap workaround (which worked for me this one time):

Read and write the file again with pdal: [ "infile.laz", { "type" : "writers.las", "dataformat_id": "0", "scale_x":"0.001", "scale_y":"0.001", "scale_z":"0.001", "offset_x":"auto", "offset_y":"auto", "offset_z":"auto", "filename" : "outfile.laz" } ]

tobias-brunner avatar Apr 25 '22 08:04 tobias-brunner

Can U explain more? @tobias-brunner I cant do that

peampi avatar Jun 17 '22 05:06 peampi

Machine precision is something that is know. You should not used iota=0.0001 in your code. https://en.wikipedia.org/wiki/Machine_epsilon I would suggest more something like iota=3e-16

julienlau avatar Jun 17 '22 13:06 julienlau

Can U explain more? @tobias-brunner I cant do that

pdal translate pc.las pc1.las, then pc1.las will work fine with PotreeConverter

chaoqun-wang0721 avatar Oct 11 '22 08:10 chaoqun-wang0721

Hello, I'm having the same issue with Potree Viewer 1.8.0 on Windows 11. Using PotreeConverter 2.0, the error message is:

ERROR(chunker_countsort_laszip.cpp:248): encountered point outside bounding box.
box.min: 416.03942899999998, -27.960518, -2.3659479999999999
box.max: 616.0061649999999, 172.0062179999999, 197.60078799999991
point: 616.00999999999999, 86, 7.7999999999999998
file: cloud.las
PotreeConverter requires a valid bounding box to operate.
Please try to repair the bounding box, e.g. using lasinfo with the -repair_bb argument.

I've tried @chaoqun-wang0721's suggestion of using pdal translate but that didn't solve the issue. Thank you.

EDIT: I was able to successfully import my point cloud by using PotreeConverter 1.7 instead of 2.0.

OlegAlexander avatar Feb 04 '23 01:02 OlegAlexander

For me, the following patch solved the issue:

diff --git a/Converter/src/chunker_countsort_laszip.cpp b/Converter/src/chunker_countsort_laszip.cpp
index 086c00d..bc9a553 100644
--- a/Converter/src/chunker_countsort_laszip.cpp
+++ b/Converter/src/chunker_countsort_laszip.cpp
@@ -6,6 +6,7 @@
 #include <mutex>
 #include <memory>
 #include <atomic>
+#include <cfloat>
 
 #include "chunker_countsort_laszip.h"
 
@@ -234,7 +235,7 @@ namespace chunker_countsort_laszip {
                                        double uz = (double(Z) * posScale.z + posOffset.z - min.z) / size.z;
 
                                        bool inBox = ux >= 0.0 && uy >= 0.0 && uz >= 0.0;
-                                       inBox = inBox && ux <= 1.0 && uy <= 1.0 && uz <= 1.0;
+                                       inBox = inBox && ux <= 1.0 + DBL_EPSILON && uy <= 1.0 + DBL_EPSILON && uz <= 1.0 + DBL_EPSILON;
 
                                        if (!inBox) {
                                                stringstream ss;

JoseGoncalves avatar May 29 '23 18:05 JoseGoncalves

For me, the following patch solved the issue:

diff --git a/Converter/src/chunker_countsort_laszip.cpp b/Converter/src/chunker_countsort_laszip.cpp
index 086c00d..bc9a553 100644
--- a/Converter/src/chunker_countsort_laszip.cpp
+++ b/Converter/src/chunker_countsort_laszip.cpp
@@ -6,6 +6,7 @@
 #include <mutex>
 #include <memory>
 #include <atomic>
+#include <cfloat>
 
 #include "chunker_countsort_laszip.h"
 
@@ -234,7 +235,7 @@ namespace chunker_countsort_laszip {
                                        double uz = (double(Z) * posScale.z + posOffset.z - min.z) / size.z;
 
                                        bool inBox = ux >= 0.0 && uy >= 0.0 && uz >= 0.0;
-                                       inBox = inBox && ux <= 1.0 && uy <= 1.0 && uz <= 1.0;
+                                       inBox = inBox && ux <= 1.0 + DBL_EPSILON && uy <= 1.0 + DBL_EPSILON && uz <= 1.0 + DBL_EPSILON;
 
                                        if (!inBox) {
                                                stringstream ss;

Would you accept a fee for assisting in using this patch? I have Potree up and working well, but about half of our clouds throw this rounding error. I have an HTML programmer on team now, but this patch is outside his skill range. Time is critical, so please let me know and TY.

https://tlse-land-viewer.s3.amazonaws.com/Point_Cloud_Model/PotreeViewer/viewer.html

Cambraceres avatar Nov 26 '23 14:11 Cambraceres

Hi @Cambraceres, please e-mail me at [email protected] to discuss this.

JoseGoncalves avatar Nov 26 '23 19:11 JoseGoncalves

可以修改las文件中该点的值

zhongbei66 avatar Apr 29 '24 04:04 zhongbei66