From aa1a9494b5e696c4ede0c549cba6ccb9a53aea3b Mon Sep 17 00:00:00 2001 From: Roman Juranek Date: Tue, 18 Aug 2020 14:21:19 +0200 Subject: [PATCH] vs compatibility improvement --- src/autorectify.cpp | 20 ++++++++++---------- src/line_pencil.cpp | 8 ++++---- src/transform.cpp | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/autorectify.cpp b/src/autorectify.cpp index 69a613f..8ad2e16 100644 --- a/src/autorectify.cpp +++ b/src/autorectify.cpp @@ -102,9 +102,9 @@ void draw_lines(II first, II last, Mat & image) clr = colors[(g)%12]; w = 3; } - line(image, cv::Point(l.x1, l.y1), cv::Point(l.x2, l.y2), clr, w); - circle(image, cv::Point(l.x1, l.y1), 5, clr, -1); - circle(image, cv::Point(l.x2, l.y2), 5, clr, -1); + line(image, cv::Point(int(l.x1), int(l.y1)), cv::Point(int(l.x2), int(l.y2)), clr, w); + circle(image, cv::Point(int(l.x1), int(l.y1)), 5, clr, -1); + circle(image, cv::Point(int(l.x2), int(l.y2)), 5, clr, -1); ++first; } } @@ -131,7 +131,7 @@ LineSegment * detect_line_groups( int w = image_f.cols; int h = image_f.rows; int stride = w; - int min_length = float(max(h,w)) / 100.0f; + float min_length = float(max(h,w)) / 100.0f; LineSegment * lines = find_line_segment_groups(buffer, w, h, stride, min_length, refine, num_threads, n_lines); @@ -172,15 +172,15 @@ void homography_from_corners(const ImageTransform & t, float clip, Mat & H, Size dst_size = Size(int(width), int(height)); // New zero coordinate - xmin = xc - 0.5*width; - ymin = yc - 0.5*height; + xmin = xc - 0.5f*width; + ymin = yc - 0.5f*height; // Calc the transform vector src; - src.push_back(Point2f(0, 0)); - src.push_back(Point2f(t.width, 0)); - src.push_back(Point2f(0, t.height)); - src.push_back(Point2f(t.width, t.height)); + src.push_back(Point2f(0.f, 0.f)); + src.push_back(Point2f(float(t.width), 0.f)); + src.push_back(Point2f(0.f, float(t.height))); + src.push_back(Point2f(float(t.width), float(t.height))); vector dst; dst.push_back(Point2f(t.top_left.x - xmin, t.top_left.y - ymin)); diff --git a/src/line_pencil.cpp b/src/line_pencil.cpp index f34e7ea..209ddcf 100644 --- a/src/line_pencil.cpp +++ b/src/line_pencil.cpp @@ -34,7 +34,7 @@ LinePencilModel::LinePencilModel(const vector & lines) int LinePencilModel::size() const { - return h.rows(); + return int(h.rows()); } @@ -63,8 +63,8 @@ ArrayXf LinePencilModel::get_weights(const ArrayXi & indices) const x.normalize(); if (x.z() < 0.f) x = -x; - int u = k1*x(0) + k; - int v = k1*x(1) + k; + int u = round(k1*x(0) + k); + int v = round(k1*x(1) + k); //accumulator.block<3,3>(u-1,v-1) += length(a) + length(b); accumulator(u,v) += length(a) + length(b); } @@ -142,7 +142,7 @@ float LinePencilModel::inlier_score(const hypothesis_type & h, float tol, const float cos_threshold(float deg) { - return 1.0f - cos(deg / 180 * M_PI); + return 1.0f - cos(deg / 180.f * float(M_PI)); } void estimate_line_pencils( diff --git a/src/transform.cpp b/src/transform.cpp index 321b3e5..7fbc7fb 100644 --- a/src/transform.cpp +++ b/src/transform.cpp @@ -144,7 +144,7 @@ Vector3f select_vertical_point( clog << "select_vertical_point: min distance=" << min_distance << endl; clog << "select_vertical_point: threshold=" << cos_threshold << endl; #endif - for (size_t i = 0; i < vps.rows(); ++i) + for (Index i = 0; i < vps.rows(); ++i) { auto & v = vps.row(i); bool angular_filter = abs((direction(v,center).adjoint() * Vector2f(0,1))) > cos_threshold; @@ -181,7 +181,7 @@ Vector3f select_horizontal_point( clog << "select_horizontal_point: min distance=" << min_distance << endl; #endif - for (size_t i = 0; i < vps.rows(); ++i) + for (Index i = 0; i < vps.rows(); ++i) { auto & v = vps.row(i); if (Vector3f(v) == vertical)