Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix arguments parsing. Add possibility to choose between different fe…
…atures type. Add keypoints matching visualization. Auto format code.
- Loading branch information
Showing
18 changed files
with
1,490 additions
and
1,334 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/CsvReader.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 27 additions & 30 deletions
57
samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/CsvWriter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,45 @@ | ||
#include "CsvWriter.h" | ||
|
||
CsvWriter::CsvWriter(const string &path, const string &separator){ | ||
_file.open(path.c_str(), ofstream::out); | ||
_isFirstTerm = true; | ||
_separator = separator; | ||
_file.open(path.c_str(), ofstream::out); | ||
_isFirstTerm = true; | ||
_separator = separator; | ||
} | ||
|
||
CsvWriter::~CsvWriter() { | ||
_file.flush(); | ||
_file.close(); | ||
_file.flush(); | ||
_file.close(); | ||
} | ||
|
||
void CsvWriter::writeXYZ(const vector<Point3f> &list_points3d) | ||
{ | ||
string x, y, z; | ||
for(unsigned int i = 0; i < list_points3d.size(); ++i) | ||
{ | ||
x = FloatToString(list_points3d[i].x); | ||
y = FloatToString(list_points3d[i].y); | ||
z = FloatToString(list_points3d[i].z); | ||
|
||
_file << x << _separator << y << _separator << z << std::endl; | ||
} | ||
for(size_t i = 0; i < list_points3d.size(); ++i) | ||
{ | ||
string x = FloatToString(list_points3d[i].x); | ||
string y = FloatToString(list_points3d[i].y); | ||
string z = FloatToString(list_points3d[i].z); | ||
|
||
_file << x << _separator << y << _separator << z << std::endl; | ||
} | ||
} | ||
|
||
void CsvWriter::writeUVXYZ(const vector<Point3f> &list_points3d, const vector<Point2f> &list_points2d, const Mat &descriptors) | ||
{ | ||
string u, v, x, y, z, descriptor_str; | ||
for(unsigned int i = 0; i < list_points3d.size(); ++i) | ||
{ | ||
u = FloatToString(list_points2d[i].x); | ||
v = FloatToString(list_points2d[i].y); | ||
x = FloatToString(list_points3d[i].x); | ||
y = FloatToString(list_points3d[i].y); | ||
z = FloatToString(list_points3d[i].z); | ||
|
||
_file << u << _separator << v << _separator << x << _separator << y << _separator << z; | ||
|
||
for(int j = 0; j < 32; ++j) | ||
for(size_t i = 0; i < list_points3d.size(); ++i) | ||
{ | ||
descriptor_str = FloatToString(descriptors.at<float>(i,j)); | ||
_file << _separator << descriptor_str; | ||
string u = FloatToString(list_points2d[i].x); | ||
string v = FloatToString(list_points2d[i].y); | ||
string x = FloatToString(list_points3d[i].x); | ||
string y = FloatToString(list_points3d[i].y); | ||
string z = FloatToString(list_points3d[i].z); | ||
|
||
_file << u << _separator << v << _separator << x << _separator << y << _separator << z; | ||
|
||
for(int j = 0; j < 32; ++j) | ||
{ | ||
string descriptor_str = FloatToString(descriptors.at<float>((int)i,j)); | ||
_file << _separator << descriptor_str; | ||
} | ||
_file << std::endl; | ||
} | ||
_file << std::endl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.