From: edgarriba Date: Wed, 30 Jul 2014 10:54:49 +0000 (+0200) Subject: Code tutorial X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3003^2~79 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2848f43acc0a1cb81cf4ec9cda5a7fcd90a2a880;p=platform%2Fupstream%2Fopencv.git Code tutorial --- diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/CsvReader.h b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/CsvReader.h new file mode 100644 index 0000000..1df3835 --- /dev/null +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/CsvReader.h @@ -0,0 +1,41 @@ +#ifndef CSVREADER_H +#define CSVREADER_H + +#include +#include + +#include +#include "Mesh.h" + +using namespace std; +using namespace cv; + +class CsvReader { +public: + /** + * The default constructor of the CSV reader Class. + * The default separator is ' ' (empty space) + * + * @param path - The path of the file to read + * @param separator - The separator character between words per line + * @return + */ + CsvReader(const std::string &path, const char &separator = ' '); + + /** + * Read a plane text file with .ply format + * + * @param list_vertex - The container of the vertices list of the mesh + * @param list_triangle - The container of the triangles list of the mesh + * @return + */ + void readPLY(std::vector &list_vertex, std::vector > &list_triangles); + +private: + /** The current stream file for the reader */ + ifstream _file; + /** The separator character between words for each line */ + char _separator; +}; + +#endif diff --git a/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/ModelRegistration.h b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/ModelRegistration.h new file mode 100644 index 0000000..f1e7aca --- /dev/null +++ b/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/include/ModelRegistration.h @@ -0,0 +1,43 @@ +/* + * ModelRegistration.h + * + * Created on: Apr 18, 2014 + * Author: edgar + */ + +#ifndef MODELREGISTRATION_H_ +#define MODELREGISTRATION_H_ + +#include +#include + +class ModelRegistration +{ +public: + + ModelRegistration(); + virtual ~ModelRegistration(); + + void setNumMax(int n) { max_registrations_ = n; } + + std::vector get_points2d() const { return list_points2d_; } + std::vector get_points3d() const { return list_points3d_; } + int getNumMax() const { return max_registrations_; } + int getNumRegist() const { return n_registrations_; } + + bool is_registrable() const { return (n_registrations_ < max_registrations_); } + void registerPoint(const cv::Point2f &point2d, const cv::Point3f &point3d); + void reset(); + +private: +/** The current number of registered points */ +int n_registrations_; +/** The total number of points to register */ +int max_registrations_; +/** The list of 2D points to register the model */ +std::vector list_points2d_; +/** The list of 3D points to register the model */ +std::vector list_points3d_; +}; + +#endif /* MODELREGISTRATION_H_ */