├── .gitignore
├── CalculateFeature
├── CalculateFeature.vcxproj
├── CalculateFeature.vcxproj.filters
└── calculate_feature.cpp
├── CmdUtility
├── CmdUtility.vcxproj
├── CmdUtility.vcxproj.filters
├── cmd_utility.cpp
└── cmd_utility.h
├── CompareResultTool
├── CompareResultTool.vcxproj
├── CompareResultTool.vcxproj.filters
└── compare_result_tool.cpp
├── CreateGridTool
├── CreateGridTool.vcxproj
├── CreateGridTool.vcxproj.filters
└── create_grid_tool.cpp
├── DataDrivenClassify
├── DataDrivenClassify.vcxproj
├── DataDrivenClassify.vcxproj.filters
└── classify.cpp
├── Downsample
├── Downsample.vcxproj
├── Downsample.vcxproj.filters
└── downsample.cpp
├── OutlierRemover
└── outlier_remover.cpp
├── ParsingEngine.sln
├── ParsingFacadeTool
├── ParsingFacadeTool.vcxproj
├── ParsingFacadeTool.vcxproj.filters
└── parse_facade_tool.cpp
├── PassThroughFilter
├── PassThroughFilter.vcxproj
├── PassThroughFilter.vcxproj.filters
└── pass_through_filter.cpp
├── PclCore
├── PclCore.vcxproj
├── PclCore.vcxproj.filters
├── pclib.cpp
└── pclib.h
├── ReadMe
├── ReinforcementLearningCore
├── ReinforcementLearningCore.filters
├── ReinforcementLearningCore.vcxproj
├── ReinforcementLearningCore.vcxproj.filters
├── rl_algorithm.cpp
├── rl_algorithm.h
├── rl_utility.cpp
└── rl_utility.h
├── ReviseGridTool
├── ReviseGridTool.vcxproj
├── ReviseGridTool.vcxproj.filters
└── revise_grid_tool.cpp
├── SampleInput
├── cofigure.json
└── grammar.json
├── ShapeGrammarCore
├── ShapeGrammarCore.vcxproj
├── ShapeGrammarCore.vcxproj.filters
├── facade_geography.cpp
├── facade_geography.h
├── facade_grammar.cpp
├── facade_grammar.h
├── facade_model.cpp
├── facade_model.h
├── grammar_elements.cpp
├── grammar_elements.h
├── main_page.h
├── rule_define.h
├── scale_model.cpp
└── scale_model.h
├── TestShapeGrammar
├── TestShapeGrammarCore.vcxproj
├── TestShapeGrammarCore.vcxproj.filters
└── test.cpp
├── Tests
├── Tests.vcxproj
├── Tests.vcxproj.filters
├── rl_utility_test.h
├── run_tests.cpp
├── shape_grammar_test.h
└── test_suits.h
├── TransformPointCloudTool
├── TransformPointCloudTool.vcxproj
├── TransformPointCloudTool.vcxproj.filters
└── transform_cloud.cpp
├── Txt2Pcd
└── txt2pcd.cpp
├── Usage
└── key guid
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # My folders
5 | 3rd/
6 | Doc/
7 | Experiments/
8 | RawData/
9 | ResultGallery/
10 | TestResults/
11 | *.pcd
12 | *.txt
13 |
14 | # User-specific files
15 | *.suo
16 | *.user
17 | *.sln.docstates
18 |
19 | # Build results
20 |
21 | [Dd]ebug/
22 | [Rr]elease/
23 | x64/
24 | build/
25 | [Bb]in/
26 | [Oo]bj/
27 |
28 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
29 | !packages/*/build/
30 |
31 | # MSTest test Results
32 | [Tt]est[Rr]esult*/
33 | [Bb]uild[Ll]og.*
34 |
35 | *_i.c
36 | *_p.c
37 | *.ilk
38 | *.meta
39 | *.obj
40 | *.pch
41 | *.pdb
42 | *.pgc
43 | *.pgd
44 | *.rsp
45 | *.sbr
46 | *.tlb
47 | *.tli
48 | *.tlh
49 | *.tmp
50 | *.tmp_proj
51 | *.log
52 | *.vspscc
53 | *.vssscc
54 | .builds
55 | *.pidb
56 | *.log
57 | *.scc
58 |
59 | # Visual C++ cache files
60 | ipch/
61 | *.aps
62 | *.ncb
63 | *.opensdf
64 | *.sdf
65 | *.cachefile
66 |
67 | # Visual Studio profiler
68 | *.psess
69 | *.vsp
70 | *.vspx
71 |
72 | # Guidance Automation Toolkit
73 | *.gpState
74 |
75 | # ReSharper is a .NET coding add-in
76 | _ReSharper*/
77 | *.[Rr]e[Ss]harper
78 |
79 | # TeamCity is a build add-in
80 | _TeamCity*
81 |
82 | # DotCover is a Code Coverage Tool
83 | *.dotCover
84 |
85 | # NCrunch
86 | *.ncrunch*
87 | .*crunch*.local.xml
88 |
89 | # Installshield output folder
90 | [Ee]xpress/
91 |
92 | # DocProject is a documentation generator add-in
93 | DocProject/buildhelp/
94 | DocProject/Help/*.HxT
95 | DocProject/Help/*.HxC
96 | DocProject/Help/*.hhc
97 | DocProject/Help/*.hhk
98 | DocProject/Help/*.hhp
99 | DocProject/Help/Html2
100 | DocProject/Help/html
101 |
102 | # Click-Once directory
103 | publish/
104 |
105 | # Publish Web Output
106 | *.Publish.xml
107 | *.pubxml
108 |
109 | # NuGet Packages Directory
110 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
111 | #packages/
112 |
113 | # Windows Azure Build Output
114 | csx
115 | *.build.csdef
116 |
117 | # Windows Store app package directory
118 | AppPackages/
119 |
120 | # Others
121 | sql/
122 | *.Cache
123 | ClientBin/
124 | [Ss]tyle[Cc]op.*
125 | ~$*
126 | *~
127 | *.dbmdl
128 | *.[Pp]ublish.xml
129 | *.pfx
130 | *.publishsettings
131 |
132 | # RIA/Silverlight projects
133 | Generated_Code/
134 |
135 | # Backup & report files from converting an old project file to a newer
136 | # Visual Studio version. Backup files are not needed, because we have git ;-)
137 | _UpgradeReport_Files/
138 | Backup*/
139 | UpgradeLog*.XML
140 | UpgradeLog*.htm
141 |
142 | # SQL Server files
143 | App_Data/*.mdf
144 | App_Data/*.ldf
145 |
146 | # =========================
147 | # Windows detritus
148 | # =========================
149 |
150 | # Windows image file caches
151 | Thumbs.db
152 | ehthumbs.db
153 |
154 | # Folder config file
155 | Desktop.ini
156 |
157 | # Recycle Bin used on file shares
158 | $RECYCLE.BIN/
159 |
160 | # Mac crap
161 | .DS_Store
162 |
--------------------------------------------------------------------------------
/CalculateFeature/CalculateFeature.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CalculateFeature/calculate_feature.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "facade_model.h"
3 | #include "boost/program_options.hpp"
4 | #include
5 | #include
6 |
7 | using namespace std;
8 |
9 | CommandLineArgument cmd_arguments;
10 |
11 | pcl::PointCloud::Ptr facade_cloud(new pcl::PointCloud);
12 | std::shared_ptr facade_grammar;
13 | std::shared_ptr facade_model;
14 |
15 | int main(int argc, char** argv) {
16 | // Step 0
17 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
18 | return -1;
19 |
20 | // Step 1
21 | cout << "\nLoad the shape grammar.\n";
22 | facade_grammar = std::shared_ptr(new FacadeGrammar);
23 | facade_grammar->ReadGrammar(cmd_arguments.grammar_);
24 |
25 | // Step 2
26 | cout << "\nInitialize the facade model, ";
27 | facade_model = std::shared_ptr(new FacadeModel(facade_grammar));
28 |
29 | // Step 3
30 | cout << "\nLoad grids.\n";
31 | facade_model->LoadGrids(cmd_arguments.revise_grid_);
32 |
33 | // Step 4
34 | cout << "\nLoad point cloud ...\n";
35 | //pcl::io::loadPCDFile(cloud_file_path, *facade_cloud);
36 |
37 | cout << "\nCompute feature ...\n";
38 | facade_model->ComputeFeature2();
39 |
40 | // Step 5
41 | cout << "\nShow feature.\n";
42 | facade_model->ShowFeature();
43 |
44 | // Step 6
45 | double vertical_thread, horizontal_thread;
46 | std::cout << "Please input the vertical thread: ";
47 | std::cin >> vertical_thread;
48 | std::cout << "Please input the horizontal thread: ";
49 | std::cin >> horizontal_thread;
50 |
51 | // Step 7
52 | std::cout << "Calculate the action parameters ...\n";
53 | facade_model->CalculateActionParameters2(vertical_thread, horizontal_thread);
54 |
55 | // Step 8
56 | std::cout << "Save the action parameters.\n";
57 | facade_model->SaveActionParammeters2(cmd_arguments.action_parameters_debug_);
58 |
59 | // Step 9
60 | std::cout << "Generate validate picture.\n";
61 | facade_model->DebugCalculateFeature(cmd_arguments.action_parameters_png_);
62 | facade_model->ParseActionParameters();
63 |
64 | facade_model->SaveActionParammeters(cmd_arguments.action_parameters_);
65 |
66 | cout << "\nDone.\n";
67 | return 0;
68 | }
--------------------------------------------------------------------------------
/CmdUtility/CmdUtility.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {6BA776B1-CF6C-46B0-A735-647D7211B8D4}
15 | Win32Proj
16 | CmdUtility
17 |
18 |
19 |
20 | StaticLibrary
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
55 | true
56 | ..\3rd\rapidjson_lib;..\3rd\boost_build\include\boost-1_54;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | D:\3rd\boost_build\lib;%(AdditionalLibraryDirectories)
62 |
63 |
64 |
65 |
66 | Level3
67 |
68 |
69 | MaxSpeed
70 | true
71 | true
72 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
73 | true
74 |
75 |
76 | Console
77 | true
78 | true
79 | true
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/CmdUtility/CmdUtility.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 头文件
20 |
21 |
22 |
23 |
24 | 源文件
25 |
26 |
27 |
--------------------------------------------------------------------------------
/CmdUtility/cmd_utility.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "rapidjson/reader.h"
3 | #include "rapidjson/filestream.h"
4 | #include "rapidjson/document.h"
5 | #include
6 |
7 | CommandLineArgument::CommandLineArgument() {
8 | // Initialize some parameters
9 | episodes_ = 5000;
10 | margin_[0] = margin_[1] = margin_[2] = margin_[3] = 0;
11 | resolution_ = 0.2;
12 | resample_resolution_[0] = resample_resolution_[1] = resample_resolution_[2] = 0.0;
13 | load_qtable_ = 0;
14 |
15 | ready_radius_outlier_remover_ = ready_refine_grid_ = ready_resample_ = ready_statiscal_outlier_remover_ = false;
16 | }
17 |
18 | bool CommandLineArgument::ParseCommandLine(int argc, char** argv) {
19 | boost::program_options::options_description options_desc("Parsing Building Facade Tools Options");
20 | options_desc.add_options()
21 | ("help", "print help information.")
22 | ("workplace", boost::program_options::value(), "working folder.")
23 | ;
24 |
25 | boost::program_options::variables_map variables_map;
26 | try
27 | {
28 | boost::program_options::store(boost::program_options::parse_command_line(argc, argv, options_desc), variables_map);
29 | boost::program_options::notify(variables_map);
30 |
31 | if(variables_map.count("help") || variables_map.size() == 0) {
32 | std::cout << options_desc << std::endl;
33 | return false;
34 | }
35 | if(variables_map.count("workplace")) {
36 | working_folder = variables_map["workplace"].as();
37 | }
38 | else
39 | {
40 | return false;
41 | }
42 | }
43 | catch(boost::program_options::error& e)
44 | {
45 | std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
46 | std::cerr << options_desc << std::endl;
47 | return false;
48 | }
49 | return true;
50 | }
51 |
52 | bool CommandLineArgument::ParseCommandLineArgument(int argc, char** argv) {
53 | if (!ParseCommandLine(argc, argv))
54 | {
55 | return false;
56 | }
57 |
58 | action_parameters_ = working_folder + "\\action.txt";
59 | action_parameters_debug_ = working_folder + "\\action_debug.txt";
60 | action_parameters_png_ = working_folder + "\\action.png";
61 | grammar_ = working_folder + "\\grammar.json";
62 | /*grid_header_ = working_folder + "\\grid_header.txt";
63 | grid_wall_png_ = working_folder + "\\grid_wall.png";
64 | grid_wall_txt_ = working_folder + "\\grid_wall.txt";
65 | grid_window_png_ = working_folder + "\\grid_window.png";
66 | grid_window_txt_ = working_folder + "\\grid_window.txt";*/
67 | grid_ = working_folder + "\\grid_";
68 | original_result_overlap_png_ = working_folder + "\\compare_result.png";
69 | parameters_ = working_folder + "\\configure.json";
70 | pt_pcd_ = working_folder + "\\pt.pcd";
71 | qtable_ = working_folder + "\\qtable.txt";
72 | raw_pcd_ = working_folder + "\\raw.pcd";
73 | raw_txt_ = working_folder + "\\raw.txt";
74 | result_png_ = working_folder + "\\result.png";
75 | result_txt_ = working_folder + "\\result.txt";
76 | /*revise_grid_header_ = working_folder + "\\revise_grid_header.txt";
77 | revise_grid_wall_png_ = working_folder + "\\revise_grid_wall.png";
78 | revise_grid_wall_txt_ = working_folder + "\\revise_grid_wall.txt";
79 | revise_grid_window_png_ = working_folder + "\\revise_grid_window.png";
80 | revise_grid_window_txt_ = working_folder + "\\revise_grid_window.txt";*/
81 | revise_grid_ = working_folder + "\\revise_grid_";
82 | rt_pcd_ = working_folder + "\\rt.pcd";
83 |
84 | if (!ReadParameters())
85 | {
86 | return false;
87 | }
88 | else
89 | {
90 | return true;
91 | }
92 | }
93 |
94 | bool CommandLineArgument::ReadParameters() {
95 | rapidjson::Document document;
96 | FILE* fp = fopen(parameters_.c_str(), "r");
97 | if(fp == NULL) {
98 | return false;
99 | }
100 |
101 | rapidjson::FileStream is(fp);
102 | if(document.ParseStream<0>(is).HasParseError()) {
103 | return false;
104 | }
105 |
106 | if (!document.IsObject()) {
107 | return false;
108 | }
109 |
110 | if (document.HasMember("episodes")) {
111 | episodes_ = document["episodes"].GetInt();
112 | }
113 |
114 | if (document.HasMember("resolution")) {
115 | resolution_ = document["resolution"].GetDouble();
116 | }
117 |
118 | if (document.HasMember("load_qtable")) {
119 | load_qtable_ = document["load_qtable"].GetInt();
120 | }
121 |
122 | if (document.HasMember("margin")) {
123 | const rapidjson::Value& margin = document["margin"];
124 | if(margin.IsArray()) {
125 | if (margin.Size() == 4) {
126 | for (rapidjson::SizeType i = 0; i < margin.Size(); ++i) {
127 | margin_[i] = margin[i].GetInt();
128 | }
129 | ready_refine_grid_ = true;
130 | }
131 | }
132 | }
133 |
134 | if (document.HasMember("radius_outlier_remover")) {
135 | const rapidjson::Value& radius_outlier_remover = document["radius_outlier_remover"];
136 | if(radius_outlier_remover.IsArray()) {
137 | if (radius_outlier_remover.Size() == 2) {
138 | for (rapidjson::SizeType i = 0; i < radius_outlier_remover.Size(); ++i) {
139 | radius_outlier_remover_[i] = radius_outlier_remover[i].GetDouble();
140 | }
141 | ready_radius_outlier_remover_ = true;
142 | }
143 | }
144 | }
145 | if (document.HasMember("static_outlier_remover")) {
146 | const rapidjson::Value& static_outlier_remover = document["static_outlier_remover"];
147 | if(static_outlier_remover.IsArray()) {
148 | if (static_outlier_remover.Size() == 4) {
149 | for (rapidjson::SizeType i = 0; i < static_outlier_remover.Size(); ++i) {
150 | statiscal_outlier_remover_[i] = static_outlier_remover[i].GetDouble();
151 | }
152 | ready_statiscal_outlier_remover_ = true;
153 | }
154 | }
155 | }
156 | if (document.HasMember("resample")) {
157 | const rapidjson::Value& resample = document["resample"];
158 | if(resample.IsArray()) {
159 | if (resample.Size() == 3) {
160 | for (rapidjson::SizeType i = 0; i < resample.Size(); ++i) {
161 | resample_resolution_[i] = resample[i].GetDouble();
162 | }
163 | ready_resample_ = true;
164 | }
165 | }
166 | }
167 |
168 | return true;
169 | }
--------------------------------------------------------------------------------
/CmdUtility/cmd_utility.h:
--------------------------------------------------------------------------------
1 | #ifndef CMD_UTILITY_H
2 | #define CMD_UTILITY_H
3 |
4 | #include "boost/program_options.hpp"
5 | #include
6 | #include
7 |
8 | class CommandLineArgument {
9 | public:
10 | CommandLineArgument();
11 | ~CommandLineArgument() {}
12 |
13 | bool ParseCommandLineArgument(int argc, char** argv);
14 | bool ReadParameters();
15 | bool ParseCommandLine(int argc, char** argv);
16 |
17 | //private:
18 | std::string working_folder;
19 |
20 | // point clouds
21 | std::string raw_pcd_; // raw point cloud in pcd format.
22 | std::string raw_txt_; // raw point cloud in text format
23 | std::string rt_pcd_; // raw transform point cloud.
24 | std::string pt_pcd_; // plane transform point cloud.
25 |
26 | // actions
27 | std::string action_parameters_;
28 | std::string action_parameters_debug_;
29 | std::string action_parameters_png_;
30 |
31 | // grammar file
32 | std::string grammar_;
33 |
34 | // original grid
35 | //std::string grid_header_;
36 | //std::string grid_wall_txt_;
37 | //std::string grid_window_txt_;
38 | //std::string grid_wall_png_;
39 | //std::string grid_window_png_;
40 | std::string grid_;
41 |
42 | // revise grid
43 | /*std::string revise_grid_header_;
44 | std::string revise_grid_wall_txt_;
45 | std::string revise_grid_window_txt_;
46 | std::string revise_grid_wall_png_;
47 | std::string revise_grid_window_png_;*/
48 | std::string revise_grid_;
49 |
50 | // q table
51 | std::string qtable_;
52 |
53 | // parameter file
54 | std::string parameters_;
55 | double resolution_;
56 | double episodes_;
57 | int load_qtable_; // 0 -- not load; 1 -- load.
58 | //int margin_up_, margin_down_, margin_left_, margin_right_;
59 | int margin_[4]; // up, down, left, right
60 | double resample_resolution_[3];
61 | double radius_outlier_remover_[2];
62 | double statiscal_outlier_remover_[2];
63 |
64 | bool ready_refine_grid_;
65 | bool ready_resample_;
66 | bool ready_radius_outlier_remover_;
67 | bool ready_statiscal_outlier_remover_;
68 |
69 | // result
70 | std::string result_png_;
71 | std::string result_txt_;
72 | std::string original_result_overlap_png_;
73 |
74 | };
75 |
76 | #endif // !CMD_UTILITY_H
77 |
--------------------------------------------------------------------------------
/CompareResultTool/CompareResultTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CreateGridTool/CreateGridTool.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {4E594CA7-F3CC-4682-832F-0510B9BF2B7B}
15 | Win32Proj
16 | CreateGridTool
17 |
18 |
19 |
20 | Application
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
55 | true
56 | ..\CmdUtility;..\3rd\VTK6.0.0\INCLUDE;..\3rd\VTK_BUILD\INCLUDE;..\3rd\pcl_lib\includes;..\3rd\opencv\build\include;..\3rd\flann_build;..\3rd\eigen;..\3rd\boost_build\include\boost-1_54;..\ReinforcementLearningCore;..\ShapeGrammarCore;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | ..\3rd\VTK_BUILD\lib\Debug;..\3rd\pcl_lib\lib;..\3rd\opencv\build\x86\vc11\lib;..\3rd\boost_build\lib;%(AdditionalLibraryDirectories)
62 | boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;opencv_core246d.lib;opencv_highgui246d.lib;opencv_imgproc246d.lib;opencv_video246d.lib;opencv_videostab246d.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_recognition_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_stereo_debug.lib;pcl_surface_debug.lib;pcl_visualization_debug.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {6ba776b1-cf6c-46b0-a735-647d7211b8d4}
89 |
90 |
91 | {8efede7a-bf56-4a5e-af00-71dd489d8b15}
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/CreateGridTool/CreateGridTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/CreateGridTool/create_grid_tool.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "facade_grammar.h"
3 | #include "facade_model.h"
4 | #include "cmd_utility.h"
5 | #include "pcl\io\pcd_io.h"
6 | #include "opencv2/opencv.hpp"
7 | #include "boost/program_options.hpp"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | using namespace std;
17 |
18 | CommandLineArgument cmd_arguments;
19 |
20 | pcl::PointCloud::Ptr facade_cloud(new pcl::PointCloud);
21 | std::shared_ptr facade_grammar;
22 | std::shared_ptr facade_model;
23 |
24 | // Main function
25 | int main(int argc, char** argv)
26 | {
27 | // Step 0
28 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
29 | return -1;
30 |
31 | // Step 1
32 | cout << "\nLoad the shape grammar.\n";
33 | facade_grammar = std::shared_ptr(new FacadeGrammar);
34 | facade_grammar->ReadGrammar(cmd_arguments.grammar_);
35 |
36 | // Step 2
37 | cout << "Initialize the facade model, ";
38 | facade_model = std::shared_ptr(new FacadeModel(facade_grammar));
39 |
40 | // Step 3
41 | cout << "\nLoad the facade point cloud.\n";
42 | pcl::io::loadPCDFile(cmd_arguments.rt_pcd_, *facade_cloud);
43 |
44 | // Step 4
45 | cout << "\nConstruct the facade grid ...\n";
46 | facade_model->CreateGridFromPointCloud(facade_cloud, cmd_arguments.resolution_);
47 |
48 | facade_model->RenderGrd(cmd_arguments.grid_);
49 |
50 | facade_model->SaveGrids(cmd_arguments.grid_);
51 |
52 | return 0;
53 | }
--------------------------------------------------------------------------------
/DataDrivenClassify/DataDrivenClassify.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 |
15 |
16 |
17 | {255F8377-9774-4264-8AFE-5E56E63279C8}
18 | Win32Proj
19 | DataDrivenClassify
20 |
21 |
22 |
23 | Application
24 | true
25 | v110
26 | Unicode
27 |
28 |
29 | Application
30 | false
31 | v110
32 | true
33 | Unicode
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | true
47 |
48 |
49 | false
50 |
51 |
52 |
53 |
54 |
55 | Level3
56 | Disabled
57 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
58 | true
59 | ..\CmdUtility;..\3rd\flann_build;..\3rd\VTK6.0.0\INCLUDE;..\3rd\VTK_BUILD\INCLUDE;..\3rd\boost_build\include\boost-1_54;..\3rd\eigen;..\3rd\pcl_lib\includes;%(AdditionalIncludeDirectories)
60 |
61 |
62 | Console
63 | true
64 | boost_thread-vc110-mt-gd-1_54.lib;boost_system-vc110-mt-gd-1_54.lib;boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;boost_date_time-vc110-mt-gd-1_54.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_visualization_debug.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;%(AdditionalDependencies)
65 | ..\3rd\VTK_BUILD\lib\Debug;..\3rd\boost_build\lib;..\3rd\pcl_lib\lib;..\vs2012projects\ParsingEngine\DataDrivenClassify;%(AdditionalLibraryDirectories)
66 |
67 |
68 |
69 |
70 | Level3
71 |
72 |
73 | MaxSpeed
74 | true
75 | true
76 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
77 | true
78 |
79 |
80 | Console
81 | true
82 | true
83 | true
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/DataDrivenClassify/DataDrivenClassify.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/DataDrivenClassify/classify.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | void RemovePoints(pcl::PointCloud::Ptr cloud_in, std::vector& indices,
15 | pcl::PointCloud::Ptr cloud_out) {
16 | cloud_out->width = cloud_in->width - indices.size();
17 | cloud_out->height = cloud_in->height;
18 | bool* remove = new bool[cloud_in->points.size()];
19 | for (int i = 0; i < cloud_in->points.size(); ++i)
20 | {
21 | remove[i] = false;
22 | }
23 | for (int i = 0; i < indices.size(); ++i)
24 | {
25 | remove[indices[i]] = true;
26 | }
27 |
28 | for (int i = 0; i < cloud_in->points.size(); ++i)
29 | {
30 | if (!remove[i])
31 | {
32 | pcl::PointXYZ point;
33 | point.x = cloud_in->points[i].x;
34 | point.y = cloud_in->points[i].y;
35 | point.z = cloud_in->points[i].z;
36 | cloud_out->points.push_back(point);
37 | }
38 | }
39 | delete[] remove;
40 | }
41 |
42 | void ExtractPlane(pcl::PointCloud::Ptr cloud)
43 | {
44 | std::vector inliers; // build plane indices in the raw building point cloud
45 | pcl::SampleConsensusModelPlane::Ptr
46 | PlaneModel(new pcl::SampleConsensusModelPlane(cloud)); // plane Model
47 | pcl::RandomSampleConsensus ransac(PlaneModel); // ransac
48 | std::ostringstream oss;
49 | int count = 0;
50 | ransac.setDistanceThreshold(0.01);
51 | std::cout << "compute model.\n";
52 | while (ransac.computeModel())
53 | {
54 | std::cout << "compute done.\n";
55 | ++count;
56 | oss << count << ".pcd";
57 |
58 | ransac.getInliers(inliers);
59 |
60 | std::cout << "plane " << oss.str() << " has " << inliers.size() << " inliers.\n";
61 |
62 | pcl::PointCloud::Ptr cloud_plane(new pcl::PointCloud);
63 | pcl::copyPointCloud(*cloud, inliers, *cloud_plane);
64 | pcl::io::savePCDFile(oss.str(), *cloud_plane);
65 | std::cout << oss.str() << " saved\n";
66 |
67 | std::cout << "remove the plane from cloud.\n";
68 | pcl::PointCloud::Ptr cloud_reduce(new pcl::PointCloud);
69 | RemovePoints(cloud, inliers, cloud_reduce);
70 | std::cout << "remove done.\n";
71 |
72 | inliers.clear();
73 | PlaneModel = pcl::SampleConsensusModelPlane::Ptr(new
74 | pcl::SampleConsensusModelPlane(cloud_reduce));
75 | ransac.setSampleConsensusModel(PlaneModel);
76 | ransac.setDistanceThreshold(0.01);
77 | std::cout << "compute model.\n";
78 | }
79 | }
80 |
81 | int main (int argc, char** argv)
82 | {
83 | pcl::visualization::PCLVisualizer viewer ("Cluster viewer");
84 | #if 1
85 | std::cout << "Reading pcd ... \n";
86 | pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
87 | pcl::PointCloud::Ptr cloud_reduce (new pcl::PointCloud);
88 | if ( pcl::io::loadPCDFile ("rt.pcd", *cloud) == -1)
89 | {
90 | std::cout << "Cloud reading failed." << std::endl;
91 | return (-1);
92 | }
93 |
94 |
95 | std::cout << "Extract plane ...\n";
96 | std::vector inliers; // build plane indices in the raw building point cloud
97 | pcl::SampleConsensusModelPlane::Ptr
98 | PlaneModel(new pcl::SampleConsensusModelPlane(cloud)); // plane Model
99 | pcl::RandomSampleConsensus ransac(PlaneModel); // ransac
100 | // set attributes...
101 | ransac.setDistanceThreshold(0.01);
102 | ransac.computeModel();
103 |
104 | Eigen::VectorXf build_plane_coeff(4);
105 | ransac.getModelCoefficients(build_plane_coeff);
106 |
107 | // get result
108 | ransac.getInliers(inliers);
109 |
110 | std::cout << "save building plane...\n";
111 | pcl::PointCloud::Ptr build_cloud_plane(new pcl::PointCloud);
112 | pcl::copyPointCloud(*cloud, inliers, *build_cloud_plane);
113 | pcl::io::savePCDFile("build_plane.pcd", *build_cloud_plane);
114 |
115 | std::cout << "Remove plane cloud ... \n";
116 | std::cout << "width = " << cloud->width << " height = " << cloud->height << std::endl;
117 | std::cout << "original #points = " << cloud->points.size() << std::endl;
118 | // remove the inliers from the cloud.
119 | RemovePoints(cloud, inliers, cloud_reduce);
120 | std::cout << "after remove, #points = " << cloud_reduce->points.size() << std::endl;
121 | pcl::io::savePCDFile("rt_reduce.pcd", *cloud_reduce);
122 | #endif
123 |
124 | /*pcl::PointCloud::Ptr cloud_reduce (new pcl::PointCloud);
125 | pcl::io::loadPCDFile ("rt.pcd", *cloud_reduce);*/
126 |
127 | std::cout << "Compute normal ... \n";
128 | pcl::search::Search::Ptr tree = boost::shared_ptr > (new pcl::search::KdTree);
129 | pcl::PointCloud ::Ptr normals (new pcl::PointCloud );
130 | pcl::NormalEstimation normal_estimator;
131 | normal_estimator.setSearchMethod (tree);
132 | normal_estimator.setInputCloud (cloud_reduce);
133 | normal_estimator.setKSearch (30);
134 | normal_estimator.compute (*normals);
135 |
136 | //pcl::IndicesPtr indices (new std::vector );
137 | //pcl::PassThrough pass;
138 | //pass.setInputCloud (cloud);
139 | //pass.setFilterFieldName ("z");
140 | //pass.setFilterLimits (0.0, 1.0);
141 | //pass.filter (*indices);
142 |
143 | std::cout << "Region growing ... \n";
144 | pcl::RegionGrowing reg;
145 | reg.setMinClusterSize (10);
146 | reg.setMaxClusterSize (10000000);
147 | reg.setSearchMethod (tree);
148 | reg.setNumberOfNeighbours (30);
149 | reg.setInputCloud (cloud_reduce);
150 | //reg.setIndices (indices);
151 | reg.setInputNormals (normals);
152 | reg.setSmoothnessThreshold (7.0 / 180.0 * M_PI);
153 | reg.setCurvatureThreshold (1.0);
154 |
155 | std::vector clusters;
156 | reg.extract (clusters);
157 |
158 | std::cout << "Number of clusters is equal to " << clusters.size () << std::endl;
159 | int count = 0;
160 | for (size_t i = 0; i < clusters.size(); ++i)
161 | {
162 | pcl::PointCloud::Ptr cluster_cloud(new pcl::PointCloud);
163 | pcl::copyPointCloud(*cloud_reduce, clusters[i], *cluster_cloud);
164 |
165 | std::vector cluster_inliers;
166 | pcl::SampleConsensusModelPlane::Ptr
167 | cluster_PlaneModel(new pcl::SampleConsensusModelPlane(cluster_cloud));
168 | pcl::RandomSampleConsensus cluster_ransac(cluster_PlaneModel);
169 | // set attributes...
170 | cluster_ransac.setDistanceThreshold(0.01);
171 | cluster_ransac.computeModel();
172 |
173 | Eigen::VectorXf cluster_plane_coeff(4);
174 | cluster_ransac.getModelCoefficients(cluster_plane_coeff);
175 |
176 | double coeff_a = cluster_plane_coeff(0) / build_plane_coeff(0);
177 | double coeff_b = cluster_plane_coeff(1) / build_plane_coeff(1);
178 | double coeff_c = cluster_plane_coeff(2) / build_plane_coeff(2);
179 | if (std::fabs(coeff_a - coeff_b) < 0.1 && std::fabs(coeff_a - coeff_c) < 0.1)
180 | {
181 | count++;
182 | std::ostringstream oss;
183 | oss << count << ".pcd";
184 | // get result
185 | cluster_ransac.getInliers(cluster_inliers);
186 | pcl::PointCloud::Ptr per_cloud(new pcl::PointCloud);
187 | pcl::copyPointCloud(*cluster_cloud, clusters[i], *per_cloud);
188 | pcl::io::savePCDFile(oss.str(), *per_cloud);
189 |
190 | viewer.addPointCloud(per_cloud, oss.str());
191 | }
192 |
193 | }
194 |
195 | //pcl::PointCloud ::Ptr colored_cloud = reg.getColoredCloud ();
196 | //viewer.showCloud(colored_cloud);
197 | while (!viewer.wasStopped ())
198 | {
199 | }
200 |
201 | std::cout << "Done.\n";
202 | return (0);
203 | }
--------------------------------------------------------------------------------
/Downsample/Downsample.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {2E19875D-4982-4E38-BA79-3771369E7448}
15 | Win32Proj
16 | Downsample
17 |
18 |
19 |
20 | Application
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
55 | true
56 | ..\CmdUtility;..\3rd\flann_build;..\3rd\VTK6.0.0\INCLUDE;..\3rd\VTK_BUILD\INCLUDE;..\3rd\boost_build\include\boost-1_54;..\3rd\eigen;..\3rd\pcl_lib\includes;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | ..\3rd\VTK_BUILD\lib\Debug;..\3rd\boost_build\lib;..\3rd\pcl_lib\lib;%(AdditionalLibraryDirectories)
62 | boost_thread-vc110-mt-gd-1_54.lib;boost_system-vc110-mt-gd-1_54.lib;boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;boost_date_time-vc110-mt-gd-1_54.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_visualization_debug.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {6ba776b1-cf6c-46b0-a735-647d7211b8d4}
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/Downsample/Downsample.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Downsample/downsample.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "pcl\io\pcd_io.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include "pcl\filters\\voxel_grid.h"
11 | #include "pcl\filters\statistical_outlier_removal.h"
12 | #include "pcl\filters\extract_indices.h"
13 | #include "pcl\filters\radius_outlier_removal.h"
14 | #include "pcl\filters\conditional_removal.h"
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 | #include
23 |
24 | CommandLineArgument cmd_arguments;
25 | pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
26 |
27 | //double size_x = 0.1;
28 | //double size_y = 0.1;
29 | //double size_z = 0.1;
30 |
31 | int main(int argc, char** argv) {
32 | /* Step 0 */
33 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
34 | return -1;
35 |
36 | /* Step 1 */
37 | std::cout << "Load pcd file ...\n";
38 | pcl::io::loadPCDFile(cmd_arguments.raw_pcd_, *cloud);
39 |
40 | std::cout << "Before resample, #points = " << cloud->points.size() << std::endl;
41 | std::cout << "Resample ...\n";
42 | pcl::PointCloud::Ptr sample(new pcl::PointCloud);
43 |
44 | // create the filtering object
45 | pcl::VoxelGrid grid;
46 | grid.setInputCloud(cloud);
47 | //grid.setLeafSize(size_x, size_y, size_z);
48 | grid.setLeafSize(cmd_arguments.resample_resolution_[0],cmd_arguments.resample_resolution_[1],
49 | cmd_arguments.resample_resolution_[2]);
50 |
51 | grid.filter(*sample);
52 |
53 | /* Step 2 */
54 | std::cout << "After resample, #points = " << sample->points.size() << std::endl;
55 | std::cout << "Saving ...\n";
56 | pcl::io::savePCDFile(cmd_arguments.raw_pcd_, *sample);
57 |
58 | return 0;
59 | }
--------------------------------------------------------------------------------
/OutlierRemover/outlier_remover.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "pcl\io\pcd_io.h"
3 | #include "pcl\filters\statistical_outlier_removal.h"
4 | #include "pcl\filters\radius_outlier_removal.h"
5 | #include
6 | #include
7 | using namespace std;
8 |
9 | CommandLineArgument cmd_arguments;
10 | pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
11 | pcl::PointCloud::Ptr cloud_remove_outlier;
12 |
13 | pcl::PointCloud::Ptr radius_outliers_removal(pcl::PointCloud::Ptr inputCloud,
14 | double radius, int min_neighbors);
15 |
16 | pcl::PointCloud::Ptr statiscal_outlier_removal(
17 | pcl::PointCloud::Ptr inputCloud,
18 | int num_neighbors, // The number of neighbors to analyze for each point
19 | double stddevmul, // all points who have a distance larger than @stddevmul@ standard deviation of the mean distance
20 | // to the query point will be marked as outliers and removed.
21 | bool inliers
22 | );
23 |
24 |
25 | int main(int argc, char** argv)
26 | {
27 | /* Step 0 */
28 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
29 | return -1;
30 |
31 | /* Step 1 */
32 | cout << "\n=========== Load raw building point cloud ... ==================\n";
33 | pcl::io::loadPCDFile(cmd_arguments.raw_pcd_ , *cloud);
34 |
35 | /* Step 2 */
36 | std::cout << "\n=============== Remove outliers ... =======================\n";
37 | if (cmd_arguments.ready_radius_outlier_remover_)
38 | cloud_remove_outlier = radius_outliers_removal(cloud, cmd_arguments.radius_outlier_remover_[0],
39 | cmd_arguments.radius_outlier_remover_[1]);
40 | else if(cmd_arguments.ready_statiscal_outlier_remover_)
41 | cloud_remove_outlier = statiscal_outlier_removal(cloud, cmd_arguments.statiscal_outlier_remover_[0],
42 | cmd_arguments.statiscal_outlier_remover_[1], true);
43 |
44 | // Step 3
45 | std::cout << "Save ... \n";
46 | pcl::io::savePCDFile(cmd_arguments.raw_pcd_, *cloud);
47 |
48 | return 0;
49 | }
50 |
51 | pcl::PointCloud::Ptr radius_outliers_removal(pcl::PointCloud::Ptr inputCloud, double radius, int min_neighbors)
52 | {
53 | pcl::PointCloud::Ptr filter(new pcl::PointCloud);
54 |
55 | pcl::RadiusOutlierRemoval outrem;
56 | outrem.setInputCloud(inputCloud);
57 | outrem.setRadiusSearch(radius);
58 | outrem.setMinNeighborsInRadius(min_neighbors);
59 | outrem.filter(*filter);
60 |
61 | return filter;
62 | }
63 |
64 | pcl::PointCloud::Ptr statiscal_outlier_removal(
65 | pcl::PointCloud::Ptr inputCloud,
66 | int num_neighbors, // The number of neighbors to analyze for each point
67 | double stddevmul, // all points who have a distance larger than @stddevmul@ standard deviation of the mean distance
68 | // to the query point will be marked as outliers and removed.
69 | bool inliers
70 | )
71 | {
72 | pcl::PointCloud::Ptr filterd(new pcl::PointCloud);
73 |
74 | // Create the filtering object
75 | pcl::StatisticalOutlierRemoval sor;
76 | sor.setInputCloud(inputCloud);
77 | sor.setMeanK(num_neighbors);
78 | sor.setStddevMulThresh(stddevmul);
79 | if(!inliers)
80 | sor.setNegative(true);
81 | sor.filter(*filterd);
82 |
83 | return (filterd);
84 | }
85 |
--------------------------------------------------------------------------------
/ParsingEngine.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2012
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TransformPointCloudTool", "TransformPointCloudTool\TransformPointCloudTool.vcxproj", "{E6ED19CE-C8C5-47B4-A85F-97201ECE910D}"
5 | EndProject
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReviseGridTool", "ReviseGridTool\ReviseGridTool.vcxproj", "{EB67A170-6AC7-4502-B536-CDD2A6412A9E}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ParsingFacadeTool", "ParsingFacadeTool\ParsingFacadeTool.vcxproj", "{212A3FA2-6107-4EE2-A8DC-24F851902237}"
9 | EndProject
10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CreateGridTool", "CreateGridTool\CreateGridTool.vcxproj", "{4E594CA7-F3CC-4682-832F-0510B9BF2B7B}"
11 | EndProject
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReinforcementLearningCore", "ReinforcementLearningCore\ReinforcementLearningCore.vcxproj", "{5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}"
13 | EndProject
14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShapeGrammarCore", "ShapeGrammarCore\ShapeGrammarCore.vcxproj", "{8EFEDE7A-BF56-4A5E-AF00-71DD489D8B15}"
15 | EndProject
16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestShapeGrammar", "TestShapeGrammar\TestShapeGrammarCore.vcxproj", "{46E40ADC-66F0-4070-BAC8-BEA9A197507B}"
17 | EndProject
18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CompareResultTool", "CompareResultTool\CompareResultTool.vcxproj", "{36586AFB-5C45-4C2E-AA5E-67A7FDB198BA}"
19 | EndProject
20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalculateFeature", "CalculateFeature\CalculateFeature.vcxproj", "{CD78F70E-05D9-430C-9C53-B1A108960802}"
21 | EndProject
22 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CmdUtility", "CmdUtility\CmdUtility.vcxproj", "{6BA776B1-CF6C-46B0-A735-647D7211B8D4}"
23 | EndProject
24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PassThroughFilter", "PassThroughFilter\PassThroughFilter.vcxproj", "{5CE9EFFE-F650-459E-A557-CFA4765FDF50}"
25 | EndProject
26 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Downsample", "Downsample\Downsample.vcxproj", "{2E19875D-4982-4E38-BA79-3771369E7448}"
27 | EndProject
28 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataDrivenClassify", "DataDrivenClassify\DataDrivenClassify.vcxproj", "{255F8377-9774-4264-8AFE-5E56E63279C8}"
29 | EndProject
30 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OutlierRemover", "OutlierRemover\OutlierRemover.vcxproj", "{6711EF17-CE76-42DA-BE2F-7A75F25B1B63}"
31 | EndProject
32 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Txt2Pcd", "Txt2Pcd\Txt2Pcd.vcxproj", "{48771D75-E9A3-44E4-A4B4-2877A60C2454}"
33 | EndProject
34 | Global
35 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
36 | Debug|Win32 = Debug|Win32
37 | Release|Win32 = Release|Win32
38 | EndGlobalSection
39 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
40 | {E6ED19CE-C8C5-47B4-A85F-97201ECE910D}.Debug|Win32.ActiveCfg = Debug|Win32
41 | {E6ED19CE-C8C5-47B4-A85F-97201ECE910D}.Debug|Win32.Build.0 = Debug|Win32
42 | {E6ED19CE-C8C5-47B4-A85F-97201ECE910D}.Release|Win32.ActiveCfg = Release|Win32
43 | {E6ED19CE-C8C5-47B4-A85F-97201ECE910D}.Release|Win32.Build.0 = Release|Win32
44 | {EB67A170-6AC7-4502-B536-CDD2A6412A9E}.Debug|Win32.ActiveCfg = Debug|Win32
45 | {EB67A170-6AC7-4502-B536-CDD2A6412A9E}.Debug|Win32.Build.0 = Debug|Win32
46 | {EB67A170-6AC7-4502-B536-CDD2A6412A9E}.Release|Win32.ActiveCfg = Release|Win32
47 | {EB67A170-6AC7-4502-B536-CDD2A6412A9E}.Release|Win32.Build.0 = Release|Win32
48 | {212A3FA2-6107-4EE2-A8DC-24F851902237}.Debug|Win32.ActiveCfg = Debug|Win32
49 | {212A3FA2-6107-4EE2-A8DC-24F851902237}.Debug|Win32.Build.0 = Debug|Win32
50 | {212A3FA2-6107-4EE2-A8DC-24F851902237}.Release|Win32.ActiveCfg = Release|Win32
51 | {212A3FA2-6107-4EE2-A8DC-24F851902237}.Release|Win32.Build.0 = Release|Win32
52 | {4E594CA7-F3CC-4682-832F-0510B9BF2B7B}.Debug|Win32.ActiveCfg = Debug|Win32
53 | {4E594CA7-F3CC-4682-832F-0510B9BF2B7B}.Debug|Win32.Build.0 = Debug|Win32
54 | {4E594CA7-F3CC-4682-832F-0510B9BF2B7B}.Release|Win32.ActiveCfg = Release|Win32
55 | {4E594CA7-F3CC-4682-832F-0510B9BF2B7B}.Release|Win32.Build.0 = Release|Win32
56 | {5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}.Debug|Win32.ActiveCfg = Debug|Win32
57 | {5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}.Debug|Win32.Build.0 = Debug|Win32
58 | {5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}.Release|Win32.ActiveCfg = Release|Win32
59 | {5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}.Release|Win32.Build.0 = Release|Win32
60 | {8EFEDE7A-BF56-4A5E-AF00-71DD489D8B15}.Debug|Win32.ActiveCfg = Debug|Win32
61 | {8EFEDE7A-BF56-4A5E-AF00-71DD489D8B15}.Debug|Win32.Build.0 = Debug|Win32
62 | {8EFEDE7A-BF56-4A5E-AF00-71DD489D8B15}.Release|Win32.ActiveCfg = Release|Win32
63 | {8EFEDE7A-BF56-4A5E-AF00-71DD489D8B15}.Release|Win32.Build.0 = Release|Win32
64 | {46E40ADC-66F0-4070-BAC8-BEA9A197507B}.Debug|Win32.ActiveCfg = Debug|Win32
65 | {46E40ADC-66F0-4070-BAC8-BEA9A197507B}.Debug|Win32.Build.0 = Debug|Win32
66 | {46E40ADC-66F0-4070-BAC8-BEA9A197507B}.Release|Win32.ActiveCfg = Release|Win32
67 | {46E40ADC-66F0-4070-BAC8-BEA9A197507B}.Release|Win32.Build.0 = Release|Win32
68 | {36586AFB-5C45-4C2E-AA5E-67A7FDB198BA}.Debug|Win32.ActiveCfg = Debug|Win32
69 | {36586AFB-5C45-4C2E-AA5E-67A7FDB198BA}.Debug|Win32.Build.0 = Debug|Win32
70 | {36586AFB-5C45-4C2E-AA5E-67A7FDB198BA}.Release|Win32.ActiveCfg = Release|Win32
71 | {36586AFB-5C45-4C2E-AA5E-67A7FDB198BA}.Release|Win32.Build.0 = Release|Win32
72 | {CD78F70E-05D9-430C-9C53-B1A108960802}.Debug|Win32.ActiveCfg = Debug|Win32
73 | {CD78F70E-05D9-430C-9C53-B1A108960802}.Debug|Win32.Build.0 = Debug|Win32
74 | {CD78F70E-05D9-430C-9C53-B1A108960802}.Release|Win32.ActiveCfg = Release|Win32
75 | {CD78F70E-05D9-430C-9C53-B1A108960802}.Release|Win32.Build.0 = Release|Win32
76 | {6BA776B1-CF6C-46B0-A735-647D7211B8D4}.Debug|Win32.ActiveCfg = Debug|Win32
77 | {6BA776B1-CF6C-46B0-A735-647D7211B8D4}.Debug|Win32.Build.0 = Debug|Win32
78 | {6BA776B1-CF6C-46B0-A735-647D7211B8D4}.Release|Win32.ActiveCfg = Release|Win32
79 | {6BA776B1-CF6C-46B0-A735-647D7211B8D4}.Release|Win32.Build.0 = Release|Win32
80 | {5CE9EFFE-F650-459E-A557-CFA4765FDF50}.Debug|Win32.ActiveCfg = Debug|Win32
81 | {5CE9EFFE-F650-459E-A557-CFA4765FDF50}.Debug|Win32.Build.0 = Debug|Win32
82 | {5CE9EFFE-F650-459E-A557-CFA4765FDF50}.Release|Win32.ActiveCfg = Release|Win32
83 | {5CE9EFFE-F650-459E-A557-CFA4765FDF50}.Release|Win32.Build.0 = Release|Win32
84 | {2E19875D-4982-4E38-BA79-3771369E7448}.Debug|Win32.ActiveCfg = Debug|Win32
85 | {2E19875D-4982-4E38-BA79-3771369E7448}.Debug|Win32.Build.0 = Debug|Win32
86 | {2E19875D-4982-4E38-BA79-3771369E7448}.Release|Win32.ActiveCfg = Release|Win32
87 | {2E19875D-4982-4E38-BA79-3771369E7448}.Release|Win32.Build.0 = Release|Win32
88 | {255F8377-9774-4264-8AFE-5E56E63279C8}.Debug|Win32.ActiveCfg = Debug|Win32
89 | {255F8377-9774-4264-8AFE-5E56E63279C8}.Debug|Win32.Build.0 = Debug|Win32
90 | {255F8377-9774-4264-8AFE-5E56E63279C8}.Release|Win32.ActiveCfg = Release|Win32
91 | {255F8377-9774-4264-8AFE-5E56E63279C8}.Release|Win32.Build.0 = Release|Win32
92 | {6711EF17-CE76-42DA-BE2F-7A75F25B1B63}.Debug|Win32.ActiveCfg = Debug|Win32
93 | {6711EF17-CE76-42DA-BE2F-7A75F25B1B63}.Debug|Win32.Build.0 = Debug|Win32
94 | {6711EF17-CE76-42DA-BE2F-7A75F25B1B63}.Release|Win32.ActiveCfg = Release|Win32
95 | {6711EF17-CE76-42DA-BE2F-7A75F25B1B63}.Release|Win32.Build.0 = Release|Win32
96 | {48771D75-E9A3-44E4-A4B4-2877A60C2454}.Debug|Win32.ActiveCfg = Debug|Win32
97 | {48771D75-E9A3-44E4-A4B4-2877A60C2454}.Debug|Win32.Build.0 = Debug|Win32
98 | {48771D75-E9A3-44E4-A4B4-2877A60C2454}.Release|Win32.ActiveCfg = Release|Win32
99 | {48771D75-E9A3-44E4-A4B4-2877A60C2454}.Release|Win32.Build.0 = Release|Win32
100 | EndGlobalSection
101 | GlobalSection(SolutionProperties) = preSolution
102 | HideSolutionNode = FALSE
103 | EndGlobalSection
104 | EndGlobal
105 |
--------------------------------------------------------------------------------
/ParsingFacadeTool/ParsingFacadeTool.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {212A3FA2-6107-4EE2-A8DC-24F851902237}
15 | Win32Proj
16 | ParsingFacadeTool
17 |
18 |
19 |
20 | Application
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
55 | true
56 | ..\3rd\rapidjson_lib;..\CmdUtility;..\3rd\VTK6.0.0\INCLUDE;..\3rd\VTK_BUILD\INCLUDE;..\3rd\pcl_lib\includes;..\3rd\opencv\build\include;..\3rd\flann_build;..\3rd\eigen;..\3rd\boost_build\include\boost-1_54;..\ReinforcementLearningCore;..\ShapeGrammarCore;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | ..\3rd\VTK_BUILD\lib\Debug;..\3rd\pcl_lib\lib;..\3rd\opencv\build\x86\vc11\lib;..\3rd\boost_build\lib;%(AdditionalLibraryDirectories)
62 | boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;opencv_core246d.lib;opencv_highgui246d.lib;opencv_imgproc246d.lib;opencv_video246d.lib;opencv_videostab246d.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_recognition_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_stereo_debug.lib;pcl_surface_debug.lib;pcl_visualization_debug.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {6ba776b1-cf6c-46b0-a735-647d7211b8d4}
89 |
90 |
91 | {8efede7a-bf56-4a5e-af00-71dd489d8b15}
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/ParsingFacadeTool/ParsingFacadeTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ParsingFacadeTool/parse_facade_tool.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "facade_grammar.h"
3 | #include "facade_model.h"
4 |
5 | #include "pcl\io\pcd_io.h"
6 | #include "opencv2/opencv.hpp"
7 | #include "boost/program_options.hpp"
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | using namespace std;
17 |
18 | CommandLineArgument cmd_arguments;
19 |
20 | std::shared_ptr facade_grammar;
21 | std::shared_ptr facade_model;
22 |
23 | // Main function
24 | int main(int argc, char** argv)
25 | {
26 | // Step 0
27 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
28 | return -1;
29 |
30 | // Step 1
31 | cout << "\nLoad the shape grammar.\n";
32 | facade_grammar = std::shared_ptr(new FacadeGrammar);
33 | facade_grammar->ReadGrammar(cmd_arguments.grammar_);
34 |
35 | // Step 2
36 | cout << "\nInitialize the facade model, ";
37 | facade_model = std::shared_ptr(new FacadeModel(facade_grammar));
38 |
39 | // Step 3
40 | cout << "\nLoad the facade grid ...\n";
41 | facade_model->LoadGrids(cmd_arguments.revise_grid_);
42 |
43 | // Step 4
44 | std::cout << "\nRunning algorithm ... \n";
45 | facade_model->set_action_parameter_file(cmd_arguments.action_parameters_);
46 | facade_model->InitModel();
47 | facade_model->set_qtable_path(cmd_arguments.qtable_.c_str());
48 |
49 | if (cmd_arguments.load_qtable_)
50 | {
51 | facade_model->LoadQTable();
52 | }
53 | facade_model->RunParsingAlgorithm(cmd_arguments.episodes_);
54 |
55 | // Step 5
56 | std::cout << "\nRendering result ...\n";
57 | facade_model->RenderResult(cmd_arguments.result_png_);
58 | facade_model->SaveLearningResult(cmd_arguments.result_txt_);
59 |
60 | return 0;
61 | }
--------------------------------------------------------------------------------
/PassThroughFilter/PassThroughFilter.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {5CE9EFFE-F650-459E-A557-CFA4765FDF50}
15 | Win32Proj
16 | PassThroughFilter
17 |
18 |
19 |
20 | Application
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
55 | true
56 | ..\CmdUtility;..\3rd\flann_build;..\3rd\VTK6.0.0\INCLUDE;..\3rd\VTK_BUILD\INCLUDE;..\3rd\boost_build\include\boost-1_54;..\3rd\eigen;..\3rd\pcl_lib\includes;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | ..\3rd\VTK_BUILD\lib\Debug;..\3rd\boost_build\lib;..\3rd\pcl_lib\lib;%(AdditionalLibraryDirectories)
62 | boost_thread-vc110-mt-gd-1_54.lib;boost_system-vc110-mt-gd-1_54.lib;boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;boost_date_time-vc110-mt-gd-1_54.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_visualization_debug.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {6ba776b1-cf6c-46b0-a735-647d7211b8d4}
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/PassThroughFilter/PassThroughFilter.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/PassThroughFilter/pass_through_filter.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "pcl\io\pcd_io.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | #include "pcl\filters\\voxel_grid.h"
11 | #include "pcl\filters\statistical_outlier_removal.h"
12 | #include "pcl\filters\extract_indices.h"
13 | #include "pcl\filters\radius_outlier_removal.h"
14 | #include "pcl\filters\conditional_removal.h"
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 |
21 | #include
22 | #include
23 |
24 | CommandLineArgument cmd_arguments;
25 | boost::shared_ptr viewer;
26 | pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
27 | pcl::search::KdTree search;
28 |
29 | bool filter = true;
30 | int pick_time = 0;
31 | std::vector picked_points;
32 |
33 | void pp_callback (const pcl::visualization::PointPickingEvent& event, void* cookie);
34 | void FindPickedPoint(const pcl::visualization::PointPickingEvent& event);
35 | void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* cookie);
36 | void ShowCloud();
37 |
38 | pcl::PointCloud::Ptr passThrough_filter(
39 | pcl::PointCloud::Ptr inputCloud, // input cloud
40 | const std::string& axe, // filter field name is which coordinate? can be: "x", "y" or "z"
41 | double minLimits, // min range
42 | double maxLimits, // max range
43 | bool inside // inside or outside a given user range.
44 | );
45 |
46 |
47 | int main(int argc, char** argv) {
48 | /* Step 0 */
49 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
50 | return -1;
51 |
52 | /* Step 1 */
53 | cout << "\n=========== Load raw building point cloud ... ==================\n";
54 | pcl::io::loadPCDFile(cmd_arguments.pt_pcd_, *cloud);
55 |
56 | /* Step 2 */
57 | cout << "\n=========== Showing the building plane ... ==================\n";
58 | ShowCloud();
59 |
60 |
61 | return 0;
62 | }
63 |
64 | void FindPickedPoint(const pcl::visualization::PointPickingEvent& event) {
65 | int idx = event.getPointIndex ();
66 | if (idx == -1)
67 | {
68 | std::cout << "Invalid pick!\n;";
69 | return;
70 | }
71 | search.setInputCloud(cloud);
72 |
73 | // Return the correct index in the cloud instead of the index on the screen
74 | std::vector indices (1);
75 | std::vector distances (1);
76 |
77 | // Because VTK/OpenGL stores data without NaN, we lose the 1-1 correspondence, so we must search for the real point
78 | pcl::PointXYZ picked_pt;
79 | event.getPoint (picked_pt.x, picked_pt.y, picked_pt.z);
80 | search.nearestKSearch (picked_pt, 1, indices, distances);
81 | picked_points.push_back(picked_pt);
82 | }
83 |
84 | void pp_callback(const pcl::visualization::PointPickingEvent& event, void* cookie)
85 | {
86 | if(pick_time == 0)
87 | {
88 | FindPickedPoint(event);
89 | pick_time = 1;
90 |
91 | cout << "Lower bottom point Chosen! [" << picked_points[0].x << ", "
92 | << picked_points[0].y << ", " << picked_points[0].z << "]\n";
93 | }
94 | else
95 | {
96 | FindPickedPoint(event);
97 |
98 | pick_time = 0;
99 | cout << "Upper right point chosen! And it's ready to filter.[" << picked_points[1].x << ", "
100 | << picked_points[1].y << ", " << picked_points[1].z << "]\n";
101 | }
102 | }
103 |
104 | void keyboardEventOccurred (const pcl::visualization::KeyboardEvent &event, void* cookie) {
105 | if(event.getKeySym() == "f" && filter)
106 | {
107 | std::cout << "original #points = " << cloud->points.size() << std::endl;
108 | cout << "Filter x axe ... \n";
109 |
110 | pcl::PointCloud::Ptr x_filtered_cloud =
111 | passThrough_filter(cloud, "x", picked_points[0].x, picked_points[1].x, true);
112 | std::cout << "now #points = " << x_filtered_cloud->points.size() << std::endl;
113 |
114 | cout << "Filter y axe ...\n";
115 | pcl::PointCloud::Ptr xy_filtered_cloud =
116 | passThrough_filter(x_filtered_cloud, "y", picked_points[0].y, picked_points[1].y, true);
117 | std::cout << "now #points = " << xy_filtered_cloud->points.size() << std::endl;
118 | cout << "Filter Done.\n";
119 |
120 | cout << "Save filtered clouds ...\n";
121 | pcl::io::savePCDFile(cmd_arguments.pt_pcd_, *xy_filtered_cloud);
122 | cout << "Save Done.\n";
123 | filter = false;
124 | }
125 | }
126 |
127 | void ShowCloud() {
128 | viewer.reset (new pcl::visualization::PCLVisualizer());
129 | viewer->addPointCloud (cloud, "build plane cloud");
130 | viewer->setBackgroundColor (0, 0, 0);
131 | viewer->registerPointPickingCallback(&pp_callback);
132 | viewer->registerKeyboardCallback(&keyboardEventOccurred);
133 | viewer->spin ();
134 | }
135 |
136 | pcl::PointCloud::Ptr passThrough_filter(
137 | pcl::PointCloud::Ptr inputCloud, // input cloud
138 | const std::string& axe, // filter field name is which coordinate? can be: "x", "y" or "z"
139 | double minLimits, // min range
140 | double maxLimits, // max range
141 | bool inside // inside or outside a given user range.
142 | )
143 | {
144 | pcl::PointCloud::Ptr filtered (new pcl::PointCloud);
145 |
146 | // Create the filtering object
147 | pcl::PassThrough pass;
148 | pass.setInputCloud(inputCloud);
149 | pass.setFilterFieldName(axe);
150 | pass.setFilterLimits(minLimits, maxLimits);
151 | if(!inside)
152 | pass.setFilterLimitsNegative(true);
153 | pass.filter(*filtered);
154 |
155 | return (filtered);
156 | }
--------------------------------------------------------------------------------
/PclCore/PclCore.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {86C0F119-73EB-400C-9F16-F0E1B91BD66D}
15 | Win32Proj
16 | PclCore
17 |
18 |
19 |
20 | StaticLibrary
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)
55 | true
56 | D:\3rd\flann_build;D:\3rd\VTK6.0.0\INCLUDE;D:\3rd\VTK_BUILD\INCLUDE;D:\3rd\boost_build\include\boost-1_54;D:\3rd\eigen;D:\3rd\pcl_lib\includes;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | D:\3rd\boost_build\lib;D:\3rd\VTK_BUILD\lib\Debug;D:\3rd\pcl_lib\lib;%(AdditionalLibraryDirectories)
62 | pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_visualization_debug.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/PclCore/PclCore.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
23 |
24 | 头文件
25 |
26 |
27 |
--------------------------------------------------------------------------------
/PclCore/pclib.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cartosquare/FacadeParsing/d1ef9d7c14c168c713598351dc74fca11e1c63d3/PclCore/pclib.cpp
--------------------------------------------------------------------------------
/PclCore/pclib.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cartosquare/FacadeParsing/d1ef9d7c14c168c713598351dc74fca11e1c63d3/PclCore/pclib.h
--------------------------------------------------------------------------------
/ReadMe:
--------------------------------------------------------------------------------
1 | |- ParsingEngine: The Root Directory.
2 | |- 3rd: Contains third party libraries.
3 | |- CalculateFeature: Tool for calculating point cloud features.
4 | |- CmdUtility: Tool for Parsing command line arguments and initialize algorithm parameters.
5 | |- CompareResultTool: Tool for comparing the parsing result and original point cloud.
6 | |- CreateGridTool: Tool for creating the building grid using the transformed build point cloud plane.
7 | |- Debug: Contains the .exe programs.
8 | |- Doc: Contains the Doxygen documents.
9 | |- Experiments: Contains all the experiments data.
10 | |- ParsingFacadeTool: Tool Using the reforcement learning and shape grammar to parse the building facade.
11 | |- PclCore: Wrap of the PCL lib for some often used functions.
12 | |- RawData: This folder contains the original point cloud data.
13 | |- ReinforcementLearningCore: The reforcement learning lib.
14 | |- ResultGallery: Contains the parsing result of each experiment.
15 | |- ReviseGridTool: Tool to refine the grid manually.
16 | |- ShapeGrammarCore: The shape grammar lib.
17 | |- TestResults: The unit test result.
18 | |- TestShapeGrammar: A project to test the shape grammar lib.
19 | |- TransformPointCloudTool: Tool to alin the point cloud to X-Y plane.
20 | |- ParsingEngine.sln: The Project Solution.
21 | |- key guid.txt: The key short cut when open a viewer in either program.
22 | |- ReadMe: Contains the describle of the directory tree.
23 |
--------------------------------------------------------------------------------
/ReinforcementLearningCore/ReinforcementLearningCore.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 头文件
20 |
21 |
22 | 头文件
23 |
24 |
25 |
26 |
27 | 源文件
28 |
29 |
30 | 源文件
31 |
32 |
33 |
--------------------------------------------------------------------------------
/ReinforcementLearningCore/ReinforcementLearningCore.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {5CA03A65-4F4E-4A9A-B9C2-7A80E231867B}
15 | Win32Proj
16 | ParsingEngineCore
17 | ReinforcementLearningCore
18 |
19 |
20 |
21 | StaticLibrary
22 | true
23 | v110
24 | Unicode
25 |
26 |
27 | Application
28 | false
29 | v110
30 | true
31 | Unicode
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | true
45 |
46 |
47 | false
48 |
49 |
50 |
51 |
52 |
53 | Level3
54 | Disabled
55 | WIN32;_DEBUG;_CONSOLE;_TRACE_LOG;%(PreprocessorDefinitions)
56 | true
57 | MultiThreadedDebugDLL
58 | 4099;%(DisableSpecificWarnings)
59 |
60 |
61 | Console
62 | true
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/ReinforcementLearningCore/ReinforcementLearningCore.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 源文件
6 |
7 |
8 | 源文件
9 |
10 |
11 |
12 |
13 | 头文件
14 |
15 |
16 | 头文件
17 |
18 |
19 |
20 |
21 | {bbf21654-185c-4a5b-a484-97e9ca6d6531}
22 | h;hpp;hxx;hm;inl;inc;xsd
23 |
24 |
25 | {c3bf8948-7672-4210-af44-e098c080cdab}
26 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
27 |
28 |
29 |
--------------------------------------------------------------------------------
/ReinforcementLearningCore/rl_algorithm.cpp:
--------------------------------------------------------------------------------
1 | #include "rl_algorithm.h"
2 | #include "rl_utility.h"
3 | #include
4 | #include
5 |
6 | RLAlgorithm::RLAlgorithm(int states_number, int actions_number) {
7 | Init(states_number, actions_number);
8 | }
9 |
10 | void RLAlgorithm::Init(int states_number, int actions_number) {
11 | #ifdef _TRACE_LOG
12 | std::cout << "Init q table: " << states_number << " * " << actions_number << std::endl;
13 | #endif
14 |
15 | state_number_ = states_number;
16 | action_number_ = actions_number;
17 |
18 | // q table stores state - action values
19 | q_ = new double*[state_number_];
20 | for (int i = 0; i < state_number_; ++i)
21 | {
22 | q_[i] = new double[actions_number];
23 | for (int j = 0; j < action_number_; ++j)
24 | {
25 | q_[i][j] = 0.0;
26 | }
27 | }
28 |
29 | // policy_ = new double[action_number_];
30 | }
31 |
32 | RLAlgorithm::~RLAlgorithm() {
33 | }
34 |
35 | void RLAlgorithm::Explore(const int state, int& action,
36 | const double exploration_rate, const std::vector& action_index) {
37 | egreedy(state, action, exploration_rate, action_index);
38 | }
39 |
40 | //void RLAlgorithm::MaxExplore(const int state, int& action, const std::vector& action_index) {
41 | // GetMaxActionRandom(state, action, action_index);
42 | //}
43 |
44 | void RLAlgorithm::egreedy(const int state, int& action, const double epsilon, const std::vector& action_index) {
45 | if (RL::RLUtility::RandUnit() < epsilon)
46 | {
47 | GetMaxAction(state, action, action_index);
48 | }
49 | else
50 | {
51 | GetRandomAction(state, action, action_index) ;
52 | }
53 | }
54 | void RLAlgorithm::GetMaxAction(const int state, int& action, const std::vector& action_index) {
55 | GetMaxActionRandom(state, action, action_index);
56 | }
57 |
58 | void RLAlgorithm::GetMaxActionRandom(const int state, int& action, const std::vector& action_index) {
59 | double* q_values = q_[state];
60 | std::vector max_all = RL::RLUtility::ArgMaxAll(q_values, action_index);
61 | action = max_all[RL::RLUtility::Rand0A(max_all.size())];
62 | }
63 |
64 | void RLAlgorithm::GetMaxActionFirst(const int state, int& action, const std::vector& action_index) {
65 | double* q_values = q_[state];
66 | action = RL::RLUtility::ArgMax(q_values, action_index);
67 | }
68 |
69 | void RLAlgorithm::GetRandomAction(const int state, int& action, const std::vector& action_index) {
70 | int index = RL::RLUtility::Rand0A(action_index.size());
71 | action = action_index[index];
72 | }
73 |
74 | void RLAlgorithm::Update(const int state, const int action, const double reward,
75 | const int next_state, const bool end_of_episode,
76 | const double learning_rate, const double gamma ) {
77 | if (end_of_episode)
78 | {
79 | q_[state][action] += learning_rate * (reward - q_[state][action]);
80 | }
81 | else
82 | {
83 | double max_q_value = RL::RLUtility::Max(q_[next_state], action_number_) ;
84 | q_[state][action] += learning_rate * (reward + gamma * max_q_value - q_[state][action]);
85 | }
86 | }
87 |
88 | void RLAlgorithm::SaveQTable() {
89 | std::ofstream ofs(qtable_path.c_str(), std::ofstream::out) ;
90 |
91 | for ( int i = 0; i < state_number_; ++i)
92 | {
93 | for ( int j = 0; j < action_number_; ++j)
94 | {
95 | ofs << q_[i][j] << " ";
96 | }
97 | ofs << std::endl;
98 | }
99 |
100 | ofs.close();
101 | }
102 |
103 | void RLAlgorithm::LoadQTable()
104 | {
105 | std::ifstream ifs(qtable_path.c_str(), std::ifstream::in);
106 |
107 | double tmp;
108 | for ( int i = 0; i < state_number_; ++i)
109 | {
110 | for ( int j = 0; j < action_number_; ++j)
111 | {
112 | ifs >> tmp;
113 | q_[i][j] = tmp;
114 | }
115 | }
116 | ifs.close();
117 | }
118 |
119 |
120 | void RLAlgorithm::PrintQTable() {
121 |
122 | }
--------------------------------------------------------------------------------
/ReinforcementLearningCore/rl_algorithm.h:
--------------------------------------------------------------------------------
1 | #ifndef RL_ALGORITHM_H
2 | #define RL_ALGORITHM_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | //! This is the reinforcement learning algorithm
9 | /*!
10 | This class is used to learn a q table.
11 | */
12 | class RLAlgorithm {
13 | public:
14 | //! Constructor
15 | RLAlgorithm() {}
16 |
17 | //! Constructor
18 | /*!
19 | Initialize the algorithm with the number of states and actions.
20 | */
21 | RLAlgorithm(int states_number, int actions_number);
22 |
23 | //! Constructor
24 | /*!
25 | Initialize the algorithm with the number of states and actions.
26 | */
27 | void Init(int states_number, int actions_number);
28 |
29 | ~RLAlgorithm();
30 |
31 | //! Given a state, explore an action with a exploration rate.
32 | /*!
33 | \param state current state.
34 | \param action explored action.
35 | \param exploration_rate exploration rate.
36 | \param action_index suitable actions for current state.
37 | */
38 | void Explore(const int state, int& action, const double exploration_rate, const std::vector& action_index);
39 |
40 | //void MaxExplore(const int state, int& action, const std::vector& action_index);
41 |
42 | //! Update the state-action value
43 | /*!
44 | \param state current state.
45 | \param action chosen action.
46 | \param reward reward executing chosen action under current state.
47 | \param next_state next state.
48 | \param end_of_episode whether the episode is end.
49 | \param learning_rate the learning rate.
50 | \param gamma learning parameter.
51 | */
52 | void Update(const int state, const int action, const double reward, const int next_state,
53 | const bool end_of_episode, const double learning_rate, const double gamma);
54 |
55 | //! Save the q table to a file.
56 | void SaveQTable();
57 |
58 | //! Load the q table from a file.
59 | void LoadQTable();
60 |
61 | //! Get the state-action value.
62 | inline double GetQValue(int state, int action) { return q_[state][action]; }
63 |
64 | //! Set the qtable file
65 | inline void set_qtable_path(std::string path) { qtable_path = path; }
66 |
67 | //! Print q table.
68 | static void PrintQTable();
69 |
70 | protected:
71 | //! Epsilon greedy algorithm used to explore an action under a state with a exploration rate.
72 | /*!
73 | \param state current state.
74 | \param action explored action.
75 | \param epsilon exploration rate.
76 | \param action_index suitable actions for current state.
77 | */
78 | void egreedy(const int state, int& action, const double epsilon, const std::vector& action_index);
79 |
80 |
81 | void GetMaxAction(const int state, int& action, const std::vector& action_index);
82 | void GetMaxActionFirst(const int state, int& action, const std::vector& action_index);
83 | void GetMaxActionRandom(const int state, int& action, const std::vector& action_index);
84 | void GetRandomAction(const int state, int& action, const std::vector& action_index);
85 |
86 | double** q_; /*!< Q table. */
87 | std::string qtable_path; /*!< q table path. */
88 | //double* policy_ ;
89 | //double q_target_;
90 | int state_number_, action_number_; /*< Number of state and action. */
91 | };
92 |
93 |
94 | #endif // ! RL_ALGORITHM_H
--------------------------------------------------------------------------------
/ReinforcementLearningCore/rl_utility.cpp:
--------------------------------------------------------------------------------
1 | #include "rl_utility.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | namespace RL
9 | {
10 | double RLUtility::Max( double * array, int n ) {
11 | double max = array[0];
12 |
13 | for (int i = 1; i < n; ++i)
14 | {
15 | if (max < array[i])
16 | max = array[i];
17 | }
18 | return max;
19 | }
20 |
21 | double RLUtility::Max(double* array, std::vector index) {
22 | double max = array[index[0]];
23 |
24 | for (size_t i = 1; i < index.size(); ++i)
25 | {
26 | if (max < array[index[i]])
27 | {
28 | max = array[index[i]];
29 | }
30 | }
31 | return max;
32 | }
33 |
34 | int RLUtility::ArgMax(double* array, int n) {
35 | double max = array[0];
36 | int IMax = 0;
37 |
38 | for (int i = 1; i < n; ++i)
39 | {
40 | if (max < array[i])
41 | {
42 | max = array[i];
43 | IMax = i;
44 | }
45 | }
46 | return IMax;
47 | }
48 |
49 | int RLUtility::ArgMax(double* array, std::vector index) {
50 | double max = array[index[0]];
51 | int IMax = index[0];
52 |
53 | for (size_t i = 1; i < index.size(); ++i)
54 | {
55 | if (max < array[index[i]])
56 | {
57 | max = array[index[i]];
58 | IMax = index[i];
59 | }
60 | }
61 | return IMax;
62 | }
63 |
64 | std::vector RLUtility::MaxAll(double* array, int n) {
65 | double max = array[0];
66 | std::vector max_all;
67 | max_all.push_back(max);
68 |
69 | for (int i = 1; i < n; ++i)
70 | {
71 | if (max < array[i])
72 | {
73 | max = array[i];
74 | max_all.clear();
75 | max_all.push_back(array[i]);
76 | }
77 | else if (max == array[i])
78 | {
79 | max_all.push_back(array[i]);
80 | }
81 | }
82 |
83 | return max_all;
84 | }
85 |
86 | std::vector RLUtility::MaxAll(double* array, std::vector index) {
87 | double max = array[index[0]];
88 | std::vector max_all;
89 | max_all.push_back(max);
90 |
91 | for (size_t i = 1; i < index.size(); ++i)
92 | {
93 | if (max < array[index[i]])
94 | {
95 | max = array[index[i]];
96 |
97 | max_all.clear();
98 | max_all.push_back(max);
99 | }
100 | else if (max == array[index[i]])
101 | {
102 | max_all.push_back(max);
103 | }
104 | }
105 |
106 | return max_all;
107 | }
108 |
109 | std::vector RLUtility::ArgMaxAll(double* array, int n) {
110 | double max = array[0];
111 |
112 | std::vector arg_all;
113 | arg_all.push_back(0);
114 |
115 | for (int i = 1; i < n; ++i)
116 | {
117 | if (max < array[i])
118 | {
119 | max = array[i];
120 | arg_all.clear();
121 | arg_all.push_back(i);
122 | }
123 | else if (max == array[i])
124 | {
125 | arg_all.push_back(i);
126 | }
127 | }
128 |
129 | return arg_all;
130 | }
131 |
132 | std::vector RLUtility::ArgMaxAll(double* array, std::vector index) {
133 | double max = array[index[0]];
134 |
135 | std::vector max_all;
136 | max_all.push_back(index[0]);
137 |
138 | for (size_t i = 1; i < index.size(); ++i)
139 | {
140 | if (max < array[index[i]])
141 | {
142 | max = array[index[i]];
143 |
144 | max_all.clear();
145 | max_all.push_back(index[i]);
146 | }
147 | else if (max == array[index[i]])
148 | {
149 | max_all.push_back(index[i]);
150 | }
151 | }
152 |
153 | return max_all;
154 | }
155 |
156 | int RLUtility::Rand0A(int A) {
157 | return (std::rand() % A);
158 | }
159 |
160 | int RLUtility::RandAB(int A, int B) {
161 | assert(B > A);
162 | int cut = std::rand() % (B - A);
163 | return (A + cut);
164 | }
165 |
166 | double RLUtility::RandUnit() {
167 | return (static_cast(std::rand()) / static_cast(RAND_MAX));
168 | }
169 | }
170 |
171 |
172 |
--------------------------------------------------------------------------------
/ReinforcementLearningCore/rl_utility.h:
--------------------------------------------------------------------------------
1 | #ifndef RL_UTILITY_H
2 | #define RL_UTILITY_H
3 |
4 | #include
5 |
6 | //! Reinforcement Learning Algorithm namespace.
7 | namespace RL
8 | {
9 | //! Utility functions for Reinforcement Learning.
10 | class RLUtility {
11 | public:
12 | RLUtility() {}
13 | ~RLUtility() {}
14 |
15 | //! Get first max element in the array.
16 | /*!
17 | \param array the array.
18 | \param n the array size.
19 | \return the first max element in the array.
20 | \sa ArgMax(), MaxAll(), ArgMaxAll()
21 | */
22 | static double Max(double* array, int n);
23 |
24 | //! Get first max element in the sub-array of an array.
25 | /*!
26 | \param array the array.
27 | \param index the sub-array's index in the array.
28 | \return the first max element in the sub-array.
29 | */
30 | static double Max(double* array, std::vector index);
31 |
32 | //! Get first max element's index in the array.
33 | /*!
34 | \param array the array.
35 | \param n the array size.
36 | \return the first max element in the array.
37 | */
38 | static int ArgMax(double* array, int n);
39 |
40 | //! Get first max element's index in the sub-array of an array.
41 | /*!
42 | \param array the array.
43 | \param index the sub-array's index in the array.
44 | \return the first max element's index in the sub-array.
45 | */
46 | static int ArgMax(double* array, std::vector index);
47 |
48 | //! Get all the max elements' indexes in the array.
49 | /*!
50 | \param array the array.
51 | \param n array size.
52 | \return all the max elements' indexes in the array.
53 | */
54 | static std::vector MaxAll(double* array, int n);
55 |
56 | //! Get all the max elements in the sub-array of an array.
57 | /*!
58 | \param array the array.
59 | \param index the sub-array's index in the array.
60 | \return all the max elements in the sub-array of an array.
61 | */
62 | static std::vector MaxAll(double* array, std::vector index);
63 |
64 | //! Get all the max elements' indexes in the array.
65 | /*!
66 | \param array the array.
67 | \param n array size.
68 | \return all the max elements' indexes in the array.
69 | */
70 | static std::vector ArgMaxAll(double* array, int n);
71 |
72 | //! Get all the max elements' indexes in the sub-array of an array.
73 | /*!
74 | \param array the array.
75 | \param index the sub-array's index in the array.
76 | \return all the max elements' indexes in the sub-array of an array.
77 | */
78 | static std::vector ArgMaxAll(double* array, std::vector index);
79 |
80 | //! Generate an int in [0, A)
81 | static int Rand0A(int A);
82 |
83 | //! Generate an int in [A, B)
84 | static int RandAB(int A, int B);
85 |
86 | //! Generate a double in [0, 1]
87 | static double RandUnit();
88 | };
89 | }
90 |
91 | #endif
--------------------------------------------------------------------------------
/ReviseGridTool/ReviseGridTool.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {EB67A170-6AC7-4502-B536-CDD2A6412A9E}
15 | Win32Proj
16 | ReviseGridTool
17 |
18 |
19 |
20 | Application
21 | true
22 | v110
23 | Unicode
24 |
25 |
26 | Application
27 | false
28 | v110
29 | true
30 | Unicode
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | true
44 |
45 |
46 | false
47 |
48 |
49 |
50 |
51 |
52 | Level3
53 | Disabled
54 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
55 | true
56 | ..\CmdUtility;..\ReinforcementLearningCore;..\3rd\opencv\build\include;..\3rd\eigen;..\3rd\pcl_lib\includes;..\3rd\boost_build\include\boost-1_54;..\ShapeGrammarCore;%(AdditionalIncludeDirectories)
57 |
58 |
59 | Console
60 | true
61 | ..\3rd\pcl_lib\lib;..\3rd\VTK_BUILD\lib\Debug;..\3rd\opencv\build\x86\vc11\lib;..\3rd\boost_build\lib;%(AdditionalLibraryDirectories)
62 | boost_chrono-vc110-mt-gd-1_54.lib;boost_filesystem-vc110-mt-gd-1_54.lib;opencv_core246d.lib;opencv_highgui246d.lib;opencv_imgproc246d.lib;opencv_video246d.lib;opencv_videostab246d.lib;QVTKWidgetPlugin.lib;vtkalglib-6.0.lib;vtkChartsCore-6.0.lib;vtkCommonColor-6.0.lib;vtkCommonComputationalGeometry-6.0.lib;vtkCommonCore-6.0.lib;vtkCommonCoreCxxTests.lib;vtkCommonDataModel-6.0.lib;vtkCommonExecutionModel-6.0.lib;vtkCommonMath-6.0.lib;vtkCommonMisc-6.0.lib;vtkCommonSystem-6.0.lib;vtkCommonTransforms-6.0.lib;vtkDICOMParser-6.0.lib;vtkDomainsChemistry-6.0.lib;vtkexoIIc-6.0.lib;vtkexpat-6.0.lib;vtkFiltersAMR-6.0.lib;vtkFiltersCore-6.0.lib;vtkFiltersExtraction-6.0.lib;vtkFiltersFlowPaths-6.0.lib;vtkFiltersGeneral-6.0.lib;vtkFiltersGeneric-6.0.lib;vtkFiltersGeometry-6.0.lib;vtkFiltersHybrid-6.0.lib;vtkFiltersHyperTree-6.0.lib;vtkFiltersImaging-6.0.lib;vtkFiltersModeling-6.0.lib;vtkFiltersParallel-6.0.lib;vtkFiltersParallelImaging-6.0.lib;vtkFiltersProgrammable-6.0.lib;vtkFiltersSelection-6.0.lib;vtkFiltersSources-6.0.lib;vtkFiltersStatistics-6.0.lib;vtkFiltersTexture-6.0.lib;vtkFiltersVerdict-6.0.lib;vtkfreetype-6.0.lib;vtkftgl-6.0.lib;vtkGeovisCore-6.0.lib;vtkgl2ps-6.0.lib;vtkGUISupportQt-6.0.lib;vtkGUISupportQtOpenGL-6.0.lib;vtkGUISupportQtSQL-6.0.lib;vtkGUISupportQtWebkit-6.0.lib;vtkhdf5_hl-6.0.lib;vtkhdf5-6.0.lib;vtkImagingColor-6.0.lib;vtkImagingCore-6.0.lib;vtkImagingFourier-6.0.lib;vtkImagingGeneral-6.0.lib;vtkImagingHybrid-6.0.lib;vtkImagingMath-6.0.lib;vtkImagingMorphological-6.0.lib;vtkImagingSources-6.0.lib;vtkImagingStatistics-6.0.lib;vtkImagingStencil-6.0.lib;vtkInfovisCore-6.0.lib;vtkInfovisLayout-6.0.lib;vtkInteractionImage-6.0.lib;vtkInteractionStyle-6.0.lib;vtkInteractionWidgets-6.0.lib;vtkIOAMR-6.0.lib;vtkIOCore-6.0.lib;vtkIOEnSight-6.0.lib;vtkIOExodus-6.0.lib;vtkIOExport-6.0.lib;vtkIOGeometry-6.0.lib;vtkIOImage-6.0.lib;vtkIOImport-6.0.lib;vtkIOInfovis-6.0.lib;vtkIOLegacy-6.0.lib;vtkIOLSDyna-6.0.lib;vtkIOMINC-6.0.lib;vtkIOMovie-6.0.lib;vtkIONetCDF-6.0.lib;vtkIOParallel-6.0.lib;vtkIOPLY-6.0.lib;vtkIOSQL-6.0.lib;vtkIOVideo-6.0.lib;vtkIOXML-6.0.lib;vtkIOXMLParser-6.0.lib;vtkjpeg-6.0.lib;vtkjsoncpp-6.0.lib;vtklibxml2-6.0.lib;vtkLocalExample-6.0.lib;vtkmetaio-6.0.lib;vtkNetCDF_cxx-6.0.lib;vtkNetCDF-6.0.lib;vtkoggtheora-6.0.lib;vtkParallelCore-6.0.lib;vtkpng-6.0.lib;vtkproj4-6.0.lib;vtkRenderingAnnotation-6.0.lib;vtkRenderingContext2D-6.0.lib;vtkRenderingCore-6.0.lib;vtkRenderingFreeType-6.0.lib;vtkRenderingFreeTypeOpenGL-6.0.lib;vtkRenderingGL2PS-6.0.lib;vtkRenderingHybridOpenGL-6.0.lib;vtkRenderingImage-6.0.lib;vtkRenderingLabel-6.0.lib;vtkRenderingLOD-6.0.lib;vtkRenderingOpenGL-6.0.lib;vtkRenderingQt-6.0.lib;vtkRenderingVolume-6.0.lib;vtkRenderingVolumeAMR-6.0.lib;vtkRenderingVolumeOpenGL-6.0.lib;vtksqlite-6.0.lib;vtksys-6.0.lib;vtkTestingGenericBridge-6.0.lib;vtkTestingIOSQL-6.0.lib;vtkTestingRendering-6.0.lib;vtktiff-6.0.lib;vtkverdict-6.0.lib;vtkViewsContext2D-6.0.lib;vtkViewsCore-6.0.lib;vtkViewsGeovis-6.0.lib;vtkViewsInfovis-6.0.lib;vtkViewsQt-6.0.lib;vtkzlib-6.0.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_ml_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_visualization_debug.lib;%(AdditionalDependencies)
63 |
64 |
65 |
66 |
67 | Level3
68 |
69 |
70 | MaxSpeed
71 | true
72 | true
73 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
74 | true
75 |
76 |
77 | Console
78 | true
79 | true
80 | true
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {6ba776b1-cf6c-46b0-a735-647d7211b8d4}
89 |
90 |
91 | {8efede7a-bf56-4a5e-af00-71dd489d8b15}
92 |
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/ReviseGridTool/ReviseGridTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ReviseGridTool/revise_grid_tool.cpp:
--------------------------------------------------------------------------------
1 | #include "cmd_utility.h"
2 | #include "facade_model.h"
3 | #include "boost/program_options.hpp"
4 | using namespace std;
5 |
6 | CommandLineArgument cmd_arguments;
7 |
8 | std::shared_ptr facade_grammar;
9 | std::shared_ptr facade_model;
10 |
11 | bool ParseCommandLine(int argc, char** argv);
12 |
13 | int main(int argc, char** argv) {
14 | // Step 0
15 | if (!cmd_arguments.ParseCommandLineArgument(argc, argv))
16 | return -1;
17 |
18 | // Step 1
19 | cout << "\nLoad the shape grammar.\n";
20 | facade_grammar = std::shared_ptr(new FacadeGrammar);
21 | facade_grammar->ReadGrammar(cmd_arguments.grammar_);
22 |
23 | // Step 2
24 | cout << "\nInitialize the facade model, ";
25 | facade_model = std::shared_ptr(new FacadeModel(facade_grammar));
26 |
27 | cout << "\nLoad grids.\n";
28 | facade_model->LoadGrids(cmd_arguments.grid_);
29 |
30 | cout << "\nRevise grids.\n";
31 | for (int i = 0; i < facade_model->get_width(); ++i)
32 | {
33 | // up
34 | for (int j = 0; j < cmd_arguments.margin_[0]; ++j)
35 | {
36 | facade_model->SetProperty(i, j, 0, 1.0);
37 | facade_model->SetProperty(i, j, 1, 0.0);
38 | }
39 |
40 | // down
41 | int start = facade_model->get_height() - cmd_arguments.margin_[1];
42 | for (int j = start; j < facade_model->get_height(); ++j)
43 | {
44 | facade_model->SetProperty(i, j, 0, 1.0);
45 | facade_model->SetProperty(i, j, 1, 0.0);
46 | }
47 | }
48 |
49 | for (int i = 0; i < facade_model->get_height(); ++i)
50 | {
51 | // left
52 | for (int j = 0; j < cmd_arguments.margin_[2]; ++j)
53 | {
54 | facade_model->SetProperty(j, i, 0, 1.0);
55 | facade_model->SetProperty(j, i, 1, 0.0);
56 | }
57 |
58 | // right
59 | int start = facade_model->get_width() - cmd_arguments.margin_[3];
60 | for (int j = start; j < facade_model->get_width(); ++j)
61 | {
62 | facade_model->SetProperty(j, i, 0, 1.0);
63 | facade_model->SetProperty(j, i, 1, 0.0);
64 | }
65 | }
66 |
67 | cout << "\nRender grids.\n";
68 | facade_model->RenderGrd(cmd_arguments.revise_grid_);
69 | cout << "\nSave grids.\n";
70 | facade_model->SaveGrids(cmd_arguments.revise_grid_);
71 |
72 | cout << "\nDone.\n";
73 | return 0;
74 | }
--------------------------------------------------------------------------------
/SampleInput/cofigure.json:
--------------------------------------------------------------------------------
1 | {
2 | "episodes": 10000,
3 | "resolution": 0.2,
4 | "resample": [
5 | 0.1,
6 | 0.1,
7 | 0.1
8 | ],
9 | "radius_outlier_remover": [radius, neighbers],
10 | "static_outlier_remover": [neighbers, stddev],
11 |
12 | "margin": [
13 | 5,
14 | 5,
15 | 5,
16 | 5
17 | ],
18 | "load_qtable": 0
19 | }
--------------------------------------------------------------------------------
/SampleInput/grammar.json:
--------------------------------------------------------------------------------
1 | {
2 | "atom": "facade",
3 | "terminal": [
4 | {
5 | "name": "wall",
6 | "color": [
7 | 120,
8 | 120,
9 | 120
10 | ]
11 | },
12 | {
13 | "name": "window",
14 | "color": [
15 | 0,
16 | 0,
17 | 255
18 | ]
19 | }
20 | ],
21 | "unterminal": [
22 | "facadeWall",
23 | "facadeFloor",
24 | "floorWall",
25 | "floorWindow"
26 | ],
27 | "grammar": [
28 | {
29 | "name": "facade -> wall + facadeFloor",
30 | "direction": 0,
31 | "parent": "facade",
32 | "child1": "wall",
33 | "child2": "facadeFloor",
34 | "parameter": [
35 | 1,
36 | 50
37 | ],
38 | "exception": "wall"
39 | },
40 | {
41 | "name": "facade -> floorWall + facadeWall",
42 | "direction": 0,
43 | "parent": "facade",
44 | "child1": "floorWall",
45 | "child2": "facadeWall",
46 | "parameter": [
47 | 1,
48 | 50
49 | ],
50 | "exception": "wall"
51 | },
52 | {
53 | "name": "facadeFloor -> floorWall + facadeWall",
54 | "direction": 0,
55 | "parent": "facadeFloor",
56 | "child1": "floorWall",
57 | "child2": "facadeWall",
58 | "parameter": [
59 | 1,
60 | 50
61 | ],
62 | "exception": "wall"
63 | },
64 | {
65 | "name": "facadeWall -> wall + facadeFloor",
66 | "direction": 0,
67 | "parent": "facadeWall",
68 | "child1": "wall",
69 | "child2": "facadeFloor",
70 | "parameter": [
71 | 1,
72 | 50
73 | ],
74 | "exception": "wall"
75 | },
76 | {
77 | "name": "floorWall -> wall + floorWindow",
78 | "direction": 1,
79 | "parent": "floorWall",
80 | "child1": "wall",
81 | "child2": "floorWindow",
82 | "parameter": [
83 | 1,
84 | 50
85 | ],
86 | "exception": "wall"
87 | },
88 | {
89 | "name": "floorWindow -> window + floorWall",
90 | "direction": 1,
91 | "parent": "floorWindow",
92 | "child1": "window",
93 | "child2": "floorWall",
94 | "parameter": [
95 | 1,
96 | 50
97 | ],
98 | "exception": "wall"
99 | }
100 | ]
101 | }
--------------------------------------------------------------------------------
/ShapeGrammarCore/ShapeGrammarCore.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 | 源文件
23 |
24 |
25 | 源文件
26 |
27 |
28 | 源文件
29 |
30 |
31 | 源文件
32 |
33 |
34 |
35 |
36 | 头文件
37 |
38 |
39 | 头文件
40 |
41 |
42 | 头文件
43 |
44 |
45 | 头文件
46 |
47 |
48 | 头文件
49 |
50 |
51 | 头文件
52 |
53 |
54 | 头文件
55 |
56 |
57 |
--------------------------------------------------------------------------------
/ShapeGrammarCore/facade_geography.h:
--------------------------------------------------------------------------------
1 | /*=========================================================================================
2 | * Facade geography define
3 | * CopyRight Xiang Xu, 2013
4 | * xuxiang@mail.bnu.edu.cn
5 | * =========================================================================================*/
6 | #ifndef FACADE_GEOGRAPHY_H
7 | #define FACADE_GEOGRAPHY_H
8 |
9 | #include "pcl\point_types.h"
10 | #include "pcl\point_cloud.h"
11 | #include "opencv2/opencv.hpp"
12 | #include
13 | #include
14 | #include
15 | #include