-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathmodel_normal_estimation.cpp
More file actions
40 lines (32 loc) · 1.15 KB
/
Copy pathmodel_normal_estimation.cpp
File metadata and controls
40 lines (32 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
#include <iostream>
#include "surface_matching.hpp"
#include "surface_matching/ppf_helpers.hpp"
using namespace std;
static void help(const string& errorMessage)
{
cout << "Program init error : " << errorMessage << endl;
cout << "\nUsage : ppf_normal_computation [input model file] [output model file]" << endl;
cout << "\nPlease start again with new parameters" << endl;
}
int main(int argc, char** argv)
{
if (argc < 3)
{
help("Not enough input arguments");
exit(1);
}
string modelFileName = (string)argv[1];
string outputFileName = (string)argv[2];
cv::Mat points, pointsAndNormals;
cout << "Loading points\n";
cv::ppf_match_3d::loadPLYSimple(modelFileName.c_str(), 1).copyTo(points);
cout << "Computing normals\n";
cv::Vec3d viewpoint(0, 0, 0);
cv::ppf_match_3d::computeNormalsPC3d(points, pointsAndNormals, 8, false, viewpoint);
std::cout << "Writing points\n";
cv::ppf_match_3d::writePLY(pointsAndNormals, outputFileName.c_str());
//the following function can also be used for debugging purposes
//cv::ppf_match_3d::writePLYVisibleNormals(pointsAndNormals, outputFileName.c_str());
std::cout << "Done\n";
return 0;
}