Skip to content

Commit

Permalink
Merge branch 'master' of github.com:RomanJuranek/librectify
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanJuranek committed Aug 18, 2020
2 parents da8e806 + aa1a949 commit 8d71d87
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/autorectify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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);

Expand Down Expand Up @@ -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<Point2f> 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<Point2f> dst;
dst.push_back(Point2f(t.top_left.x - xmin, t.top_left.y - ymin));
Expand Down
8 changes: 4 additions & 4 deletions src/line_pencil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LinePencilModel::LinePencilModel(const vector<LineSegment> & lines)

int LinePencilModel::size() const
{
return h.rows();
return int(h.rows());
}


Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8d71d87

Please sign in to comment.