From 0a0ed375a950aaadfeaa4ff0931c6dda585517ce Mon Sep 17 00:00:00 2001 From: mschuetz Date: Mon, 14 Dec 2015 13:18:45 +0100 Subject: [PATCH] fix a numPoints bug; increase default spacing; decrease point node threshold --- PotreeConverter/include/LASPointWriter.hpp | 2 -- PotreeConverter/include/PointWriter.hpp | 2 +- PotreeConverter/include/PotreeWriter.h | 2 +- PotreeConverter/src/PotreeWriter.cpp | 15 +++++++++++++++ PotreeConverter/src/main.cpp | 6 +++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/PotreeConverter/include/LASPointWriter.hpp b/PotreeConverter/include/LASPointWriter.hpp index 0bd3e146..14febb0b 100644 --- a/PotreeConverter/include/LASPointWriter.hpp +++ b/PotreeConverter/include/LASPointWriter.hpp @@ -23,8 +23,6 @@ namespace Potree{ class LASPointWriter : public PointWriter{ public: - string file; - int numPoints = 0; AABB aabb; laszip_POINTER writer = NULL; laszip_header header; diff --git a/PotreeConverter/include/PointWriter.hpp b/PotreeConverter/include/PointWriter.hpp index 6fa8b4e3..e6874202 100644 --- a/PotreeConverter/include/PointWriter.hpp +++ b/PotreeConverter/include/PointWriter.hpp @@ -15,7 +15,7 @@ class PointWriter{ public: string file; - int numPoints; + int numPoints = 0; virtual ~PointWriter(){}; diff --git a/PotreeConverter/include/PotreeWriter.h b/PotreeConverter/include/PotreeWriter.h index 9bd25e77..2bbc5938 100644 --- a/PotreeConverter/include/PotreeWriter.h +++ b/PotreeConverter/include/PotreeWriter.h @@ -37,7 +37,7 @@ class PWNode{ bool addCalledSinceLastFlush = false; PotreeWriter *potreeWriter; vector cache; - int storeLimit = 20'000; + int storeLimit = 2'000; vector store; bool isInMemory = true; diff --git a/PotreeConverter/src/PotreeWriter.cpp b/PotreeConverter/src/PotreeWriter.cpp index c62ca608..46e168c3 100644 --- a/PotreeConverter/src/PotreeWriter.cpp +++ b/PotreeConverter/src/PotreeWriter.cpp @@ -251,6 +251,12 @@ void PWNode::flush(){ for(const auto &e_c : points){ writer->write(e_c); } + + if(append && (writer->numPoints != this->numAccepted)){ + cout << "writeToDisk " << writer->numPoints << " != " << this->numAccepted << endl; + exit(1); + } + writer->close(); delete writer; }; @@ -259,6 +265,10 @@ void PWNode::flush(){ if(isLeafNode()){ if(addCalledSinceLastFlush){ writeToDisk(store, false); + + //if(store.size() != this->numAccepted){ + // cout << "store " << store.size() << " != " << this->numAccepted << " - " << this->name() << endl; + //} }else if(!addCalledSinceLastFlush && isInMemory){ store = vector(); @@ -267,6 +277,11 @@ void PWNode::flush(){ }else{ if(addCalledSinceLastFlush){ writeToDisk(cache, true); + //if(cache.size() != this->numAccepted){ + // cout << "cache " << cache.size() << " != " << this->numAccepted << " - " << this->name() << endl; + // + // exit(1); + //} cache = vector(); }else if(!addCalledSinceLastFlush && isInMemory){ delete grid; diff --git a/PotreeConverter/src/main.cpp b/PotreeConverter/src/main.cpp index 3c83b95d..fa541bbf 100644 --- a/PotreeConverter/src/main.cpp +++ b/PotreeConverter/src/main.cpp @@ -64,6 +64,7 @@ struct Arguments{ string aabbValuesString; vector aabbValues; string pageName = ""; + string projection; }; Arguments parseArguments(int argc, char **argv){ @@ -86,6 +87,7 @@ Arguments parseArguments(int argc, char **argv){ ("aabb", po::value(&a.aabbValuesString), "Bounding cube as \"minX minY minZ maxX maxY maxZ\". If not provided it is automatically computed") ("incremental", "Add new points to existing conversion") ("overwrite", "Replace existing conversion at target directory") + ("projection", po::value(&a.projection), "Specify projection in proj4 format.") ("source", po::value >(), "Source file. Can be LAS, LAZ, PTX or PLY"); po::positional_options_description p; p.add("source", -1); @@ -162,6 +164,7 @@ Arguments parseArguments(int argc, char **argv){ if(!vm.count("input-format")) a.format = ""; if(!vm.count("scale")) a.scale = 0; if(!vm.count("output-format")) a.outFormatString = "BINARY"; + if(a.outFormatString == "BINARY"){ a.outFormat = Potree::OutputFormat::BINARY; }else if(a.outFormatString == "LAS"){ @@ -169,10 +172,11 @@ Arguments parseArguments(int argc, char **argv){ }else if(a.outFormatString == "LAZ"){ a.outFormat = Potree::OutputFormat::LAZ; } + if (a.diagonalFraction != 0) { a.spacing = 0; }else if(a.spacing == 0){ - a.diagonalFraction = 250; + a.diagonalFraction = 200; } return a;