Skip to content

Commit

Permalink
renamed key parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Oct 29, 2024
1 parent 7840cb6 commit 210325f
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 63 deletions.
5 changes: 5 additions & 0 deletions code/CLI_Example_1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "../model/map.h"
#include "../model/map_io.h"
#include "../model/point_set_io.h"
#include "../method/method_global.h"
#include "../method/reconstruction.h"


int main(int argc, char **argv)
{
///ToDo: user may need to tune these parameters for their datasets
Method::min_points = 40;
Method::pixel_size = 0.15;

const std::string directory = std::string(CITY3D_ROOT_DIR) + "/../data/";

// input point cloud file name
Expand Down
5 changes: 5 additions & 0 deletions code/CLI_Example_2/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "../model/map.h"
#include "../model/map_io.h"
#include "../model/point_set_io.h"
#include "../method/method_global.h"
#include "../method/reconstruction.h"
#include "../basic/file_utils.h"


int main(int argc, char **argv) {
///ToDo: user may need to tune these parameters for their datasets
Method::min_points = 40;
Method::pixel_size = 0.15;

const std::string directory = std::string(CITY3D_ROOT_DIR) + "/../data/building_instances";
//get the file names of the input point clouds
std::vector<std::string> all_file_names;
Expand Down
16 changes: 8 additions & 8 deletions code/City3D/dlg/weight_panel_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,27 @@ void WeightPanelManual::updateUI() {
float fitting = truncate_digits(Method::lambda_data_fitting, 3);
float coverage = truncate_digits(Method::lambda_model_height, 3);
float complexity = truncate_digits(Method::lambda_model_complexity, 3);
float number=Method::number_region_growing;
float density=Method::point_density;
float min_points=Method::min_points;
float pixel_size=Method::pixel_size;

QString text_fitting = QString("%1").arg(fitting);
QString text_coverage = QString("%1").arg(coverage);
QString text_complexity = QString("%1").arg(complexity);
QString text_number = QString("%1").arg(number);
QString text_density = QString("%1").arg(density);
QString text_min_points = QString("%1").arg(min_points);
QString text_pixel_size = QString("%1").arg(pixel_size);

lineEditFitting->setText(text_fitting);
lineEditHeight->setText(text_coverage);
lineEditComplexity->setText(text_complexity);
lineEditNumber->setText(text_number);
lineEditDensity->setText(text_density);
lineEditMinPoints->setText(text_min_points);
lineEditPixelSize->setText(text_pixel_size);
}


void WeightPanelManual::updateWeights() {
Method::lambda_data_fitting = lineEditFitting->text().toFloat();
Method::lambda_model_height = lineEditHeight->text().toFloat();
Method::lambda_model_complexity = lineEditComplexity->text().toFloat();
Method::number_region_growing=lineEditNumber->text().toFloat();
Method::point_density=lineEditDensity->text().toFloat();
Method::min_points=lineEditMinPoints->text().toFloat();
Method::pixel_size=lineEditPixelSize->text().toFloat();
}
59 changes: 25 additions & 34 deletions code/City3D/dlg/weight_panel_manual.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,10 @@
<rect>
<x>0</x>
<y>0</y>
<width>230</width>
<height>210</height>
<width>181</width>
<height>183</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>230</width>
<height>210</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>350</width>
<height>210</height>
</size>
</property>
<property name="windowTitle">
<string>Weight Panel</string>
</property>
Expand All @@ -33,24 +21,24 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>22</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Fitting</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditFitting">
<property name="minimumSize">
<size>
Expand All @@ -69,14 +57,14 @@
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="2" column="1" rowspan="2">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditHeight">
<property name="minimumSize">
<size>
Expand All @@ -95,14 +83,14 @@
</property>
</widget>
</item>
<item row="3" column="0" rowspan="2">
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Complexity</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditComplexity">
<property name="minimumSize">
<size>
Expand Down Expand Up @@ -131,16 +119,16 @@
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Number</string>
<string>MinPoints</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2">
<widget class="QLineEdit" name="lineEditNumber">
<item row="0" column="1">
<widget class="QLineEdit" name="lineEditMinPoints">
<property name="maximumSize">
<size>
<width>80</width>
Expand All @@ -152,15 +140,15 @@
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Density</string>
<string>PixelSize</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditDensity">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditPixelSize">
<property name="maximumSize">
<size>
<width>80</width>
Expand All @@ -183,8 +171,8 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>21</width>
<height>20</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
Expand All @@ -194,10 +182,13 @@
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>33</height>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
Expand Down
4 changes: 2 additions & 2 deletions code/method/method_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Method
double lambda_model_height = 0.04;
double lambda_model_complexity = 0.62;

double number_region_growing=40;
double point_density=0.15;
double min_points = 40;
double pixel_size = 0.15;

double coincident_threshold = 1e-7;

Expand Down
4 changes: 2 additions & 2 deletions code/method/method_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace Method {
extern double lambda_model_height;
extern double lambda_model_complexity;

extern double number_region_growing;
extern double point_density;
extern double min_points;
extern double pixel_size;

// - two points considered coincident
// - a point considered to be on a plane, etc.
Expand Down
8 changes: 4 additions & 4 deletions code/method/point_set_region_growing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ std::vector<VertexGroup::Ptr> do_detect(
return results;
}

std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(
std::vector<VertexGroup::Ptr> RegionGrowingDectetor::detect(
PointSet* pset,
unsigned int min_support)
{
Expand Down Expand Up @@ -139,7 +139,7 @@ std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(
min_support);
}

std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(
std::vector<VertexGroup::Ptr> RegionGrowingDectetor::detect(
PointSet* pset,
const std::vector<unsigned int>& vertitces,
unsigned int min_support // the minimal number of points required for a primitive
Expand Down Expand Up @@ -273,7 +273,7 @@ std::vector<VertexGroup::Ptr> do_detect(
return results;
}

std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(
std::vector<VertexGroup::Ptr> RegionGrowingDectetor::detect(
PointSet* pset,
unsigned int min_support)
{
Expand Down Expand Up @@ -326,7 +326,7 @@ std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(

}

std::vector<VertexGroup::Ptr> Region_Growing_Dectetor::detect(
std::vector<VertexGroup::Ptr> RegionGrowingDectetor::detect(
PointSet* pset,
const std::vector<unsigned int>& vertitces,
unsigned int min_support // the minimal number of points required for a primitive
Expand Down
8 changes: 4 additions & 4 deletions code/method/point_set_region_growing.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@

class PointSet;

class Region_Growing_Dectetor
class RegionGrowingDectetor
{
public:
// for entire point cloud. Returns the extracted primitives.
std::vector<VertexGroup::Ptr> detect(
PointSet* pset,
unsigned int min_support = 100 // the minimal number of points required for a primitive
unsigned int min_points // the minimal number of points required for a primitive
);

// for a subset of the point cloud. Returns the extracted primitives.
// for a subset of the point cloud. Returns the extracted primitives.
// for a subset of the point cloud. Returns the extracted primitives.
std::vector<VertexGroup::Ptr> detect(
PointSet* pset,
const std::vector<unsigned int>& vertitces,
unsigned int min_support = 1000 // the minimal number of points required for a primitive
unsigned int min_points // the minimal number of points required for a primitive
);

std::vector<unsigned int> unassigned_points;
Expand Down
18 changes: 9 additions & 9 deletions code/method/reconstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ int Reconstruction::extract_building_roof(PointSet *pset,
std::vector<unsigned int> p_index = *building;
std::vector<unsigned int> remaining_ind;

Region_Growing_Dectetor rg;
RegionGrowingDectetor rg;
//std::cout<<"min_support: "<<min_support<<std::endl;
const std::vector<VertexGroup::Ptr> &roofs = rg.detect(pset, p_index, min_support);
if (roofs.empty())
Expand Down Expand Up @@ -201,12 +201,12 @@ bool Reconstruction::extract_roofs(PointSet *pset, Map *footprint)
if (!g)
continue;
std::vector<VertexGroup::Ptr> &roofs = g->children();
unsigned int min_support = Method::number_region_growing;
num += extract_building_roof(pset, g, min_support);
while (roofs.empty() && min_support > 6) // Liangliang: the number must be "> 6" to avoid infinite loops
unsigned int min_points = Method::min_points;
num += extract_building_roof(pset, g, min_points);
while (roofs.empty() && min_points > 6) // Liangliang: the number must be "> 6" to avoid infinite loops
{
num += extract_building_roof(pset, g, min_support);
min_support *= 0.75;
num += extract_building_roof(pset, g, min_points);
min_points *= 0.75;
}
progress.next();
}
Expand Down Expand Up @@ -527,9 +527,9 @@ std::vector<std::vector<int>> Reconstruction::compute_height_field(PointSet *pse
plg.push_back(r);
}

//set the image resolution, a larger value for the sparser or noisy point set, usually (0.15,0.25).
double point_density = Method::point_density;
int in_x = (x_max - x_min) / point_density, in_y = (y_max - y_min) / point_density;
//set the pixel size of the height map, a larger value for the sparser or noisy point set, usually within (0.15, 0.3).
double pixel_size = Method::pixel_size;
int in_x = (x_max - x_min) / pixel_size, in_y = (y_max - y_min) / pixel_size;
width_ = ogf_max(in_x, in_y);
height_ = width_;
int image_width = width_, image_height = height_;
Expand Down

0 comments on commit 210325f

Please sign in to comment.