6 #include "../lib/misc.h" 7 #include "../lib/json.h" 8 #include "../lib/dataset.h" 9 #include "../lib/opencv.h" 10 #include "../lib/intrinsics.h" 15 std::vector<cv::Vec2f> points;
16 for(
const auto& kv : feature.
points) {
23 cv::Vec4f line_parameters;
24 cv::fitLine(points, line_parameters, CV_DIST_L2, 0.0, 0.01, 0.01);
26 return line_parameters[1] / line_parameters[0];
30 std::vector<cv::Vec2f> points;
31 for(
const auto& kv : feature.
points) {
38 cv::Vec4f line_parameters;
39 cv::fitLine(points, line_parameters, CV_DIST_L2, 0.0, 0.01, 0.01);
41 return line_parameters[0] / line_parameters[1];
45 int main(
int argc,
const char* argv[]) {
46 get_args(argc, argv,
"dataset_parameters.json image_correspondences.json intrinsics.json out_slopes.json");
53 std::cout <<
"undistorting image correspondences (if applicable)" << std::endl;
56 std::cout <<
"measuring slopes" << std::endl;
57 std::map<std::string, real> feature_horizontal_slopes, feature_vertical_slopes;
58 for(
const auto& kv : cors.
features) {
59 const std::string& feature_name = kv.first;
65 std::cout <<
'.' << std::flush;
67 std::cout << std::endl;
70 std::cout <<
"saving slopes" << std::endl;
78 const std::string& feature_name = kv.first;
80 fslope.
horizontal = feature_horizontal_slopes.at(feature_name);
81 fslope.
vertical = feature_vertical_slopes.at(feature_name);
json encode_feature_slopes(const feature_slopes &fslopes)
real measure_horizontal_slope(const image_correspondence_feature &feature, int y_outreach)
int main(int argc, const char *argv[])
feature_points undistorted_feature_points_for_view(const image_correspondences &cors, view_index idx, const intrinsics &intr)
image_correspondences image_correspondences_with_reference(const image_correspondences &cors, const view_index &reference_view)
Set of features, each on set of views.
Points of different features, on one view.
std::map< std::string, image_correspondence_feature > features
intrinsics intrinsics_arg()
std::vector< view_index > get_reference_views(const relative_camera_positions &rcpos)
void export_json_file(const json &j, const std::string &filename, bool compact)
view_index reference_view
image_correspondences image_correspondences_arg()
feature_points undistort(const feature_points &dist_fpoints, const intrinsics &intr)
std::string out_filename_arg()
std::map< std::string, feature_slope > slopes
Feature on set of views. Optionally one view is "reference".
feature_slopes merge_multiview_feature_slopes(const feature_slopes &a, const feature_slopes &b)
std::map< view_index, feature_point > points
real measure_vertical_slope(const image_correspondence_feature &feature)
void get_args(int argc, const char *argv[], const std::string &usage)