-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreconstruction.h
More file actions
47 lines (41 loc) · 1.43 KB
/
reconstruction.h
File metadata and controls
47 lines (41 loc) · 1.43 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
41
42
43
44
45
46
47
#ifndef RECONSTRUCTION_H
#define RECONSTRUCTION_H
#include <vector>
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "opencv2/core.hpp"
#include "calibration_data.pb.h"
namespace sfm {
class Reconstruction {
public:
// Initialize camera intrinsict and initial camera pose.
Reconstruction(const proto::CameraMatrix& camera_matrix);
absl::Status Run(const std::vector<std::string>& image_paths,
absl::string_view file_path);
absl::Status VisualizeMatches(int image_idx1 = 0, int image_idx2 = 1) const;
cv::Mat GetPointColors() const;
std::vector<cv::Mat> GetCameraPoses() const;
cv::Mat GetPointCloud() const;
private:
enum class DescriptorType {
kSift,
kOrb,
};
absl::Status LoadImages(const std::vector<std::string>& image_paths);
absl::StatusOr<std::vector<int32_t>> DetectFeatures(
DescriptorType descriptor_type = DescriptorType::kSift);
std::vector<int32_t> MatchFeatures(float ratio_threshold = 0.75f);
absl::Status EstimateCameraPoses();
absl::Status TriangulatePoints();
absl::Status SavePointCloud(absl::string_view file_path);
cv::Mat camera_matrix_;
std::vector<cv::Mat> images_;
std::vector<cv::Mat> camera_poses_;
std::vector<std::vector<cv::KeyPoint>> keypoints_;
std::vector<cv::Mat> descriptors_;
std::vector<std::vector<cv::DMatch>> feature_matches_;
cv::Mat point_cloud_;
cv::Mat point_colors_;
};
} // namespace sfm
#endif // RECONSTRUCTION_H