fixed build errors and warnings on Windows

pull/31/head
Vadim Pisarevsky 12 years ago
parent d3501f1545
commit 932100c5a3
  1. 27
      modules/imgproc/test/test_imgwarp_strict.cpp
  2. 10
      modules/video/src/simpleflow.cpp

@ -176,8 +176,8 @@ interpolate_method inter_array[] = { &interpolateLinear, &interpolateCubic, &int
Size CV_ImageWarpBaseTest::randSize(RNG& rng) const Size CV_ImageWarpBaseTest::randSize(RNG& rng) const
{ {
Size size; Size size;
size.width = saturate_cast<uint>(std::exp(rng.uniform(0.0f, 7.0f))); size.width = saturate_cast<int>(std::exp(rng.uniform(0.0, 7.0)));
size.height = saturate_cast<uint>(std::exp(rng.uniform(0.0f, 7.0f))); size.height = saturate_cast<int>(std::exp(rng.uniform(0.0, 7.0)));
return size; return size;
} }
@ -347,7 +347,7 @@ void CV_Resize_Test::run_reference_func()
double CV_Resize_Test::getWeight(double a, double b, int x) double CV_Resize_Test::getWeight(double a, double b, int x)
{ {
float w = std::min<double>(x + 1, b) - std::max<double>(x, a); float w = std::min(x + 1., b) - std::max(x + 0., a);
CV_Assert(w >= 0); CV_Assert(w >= 0);
return w; return w;
} }
@ -435,6 +435,8 @@ void CV_Resize_Test::resize_1d(const Mat& _src, Mat& _dst, int dy, const dim& _d
ofs = 1, ksize = 4; ofs = 1, ksize = 4;
else if (interpolation == INTER_LANCZOS4) else if (interpolation == INTER_LANCZOS4)
ofs = 3, ksize = 8; ofs = 3, ksize = 8;
cv::AutoBuffer<float> _w(ksize);
float* w = _w;
Mat _extended_src_row(1, _src.cols + ksize * 2, _src.type()); Mat _extended_src_row(1, _src.cols + ksize * 2, _src.type());
uchar* srow = _src.data + dy * _src.step; uchar* srow = _src.data + dy * _src.step;
@ -453,7 +455,6 @@ void CV_Resize_Test::resize_1d(const Mat& _src, Mat& _dst, int dy, const dim& _d
float *xyD = yD + dx * cn; float *xyD = yD + dx * cn;
const float* xyS = _extended_src_row.ptr<float>(0) + (isx + ksize - ofs) * cn; const float* xyS = _extended_src_row.ptr<float>(0) + (isx + ksize - ofs) * cn;
float w[ksize];
inter_func(fsx, w); inter_func(fsx, w);
for (int r = 0; r < cn; ++r) for (int r = 0; r < cn; ++r)
@ -706,7 +707,7 @@ void CV_Remap_Test::generate_test_data()
{ {
MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>(); MatIterator_<ushort> begin_y = mapy.begin<ushort>(), end_y = mapy.end<ushort>();
for ( ; begin_y != end_y; ++begin_y) for ( ; begin_y != end_y; ++begin_y)
begin_y[0] = rng.uniform(0, 1024); begin_y[0] = (ushort)rng.uniform(0, 1024);
} }
break; break;
@ -714,7 +715,7 @@ void CV_Remap_Test::generate_test_data()
{ {
MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>(); MatIterator_<short> begin_y = mapy.begin<short>(), end_y = mapy.end<short>();
for ( ; begin_y != end_y; ++begin_y) for ( ; begin_y != end_y; ++begin_y)
begin_y[0] = rng.uniform(0, 1024); begin_y[0] = (short)rng.uniform(0, 1024);
} }
break; break;
} }
@ -862,7 +863,7 @@ void CV_Remap_Test::remap_nearest(const Mat& _src, Mat& _dst)
{ {
if (borderType == BORDER_CONSTANT) if (borderType == BORDER_CONSTANT)
for (int r = 0; r < cn; ++r) for (int r = 0; r < cn; ++r)
xyD[r] = borderValue[r]; xyD[r] = (float)borderValue[r];
else else
{ {
sx = borderInterpolate(sx, ssize.width, borderType); sx = borderInterpolate(sx, ssize.width, borderType);
@ -936,7 +937,7 @@ void CV_Remap_Test::remap_generic(const Mat& _src, Mat& _dst)
(isx >= ssize.width || isx + ksize <= 0 || (isx >= ssize.width || isx + ksize <= 0 ||
isy >= ssize.height || isy + ksize <= 0)) isy >= ssize.height || isy + ksize <= 0))
for (int r = 0; r < cn; ++r) for (int r = 0; r < cn; ++r)
xyD[r] = borderValue[r]; xyD[r] = (float)borderValue[r];
else else
{ {
int ar_x[8], ar_y[8]; int ar_x[8], ar_y[8];
@ -1244,11 +1245,11 @@ void CV_WarpPerspective_Test::generate_test_data()
// generating the M 3x3 matrix // generating the M 3x3 matrix
RNG& rng = ts->get_rng(); RNG& rng = ts->get_rng();
Point2f sp[] = { Point2f(0, 0), Point2f(src.cols, 0), Point2f(0, src.rows), Point2f(src.cols, src.rows) }; Point2f sp[] = { Point(0, 0), Point(src.cols, 0), Point(0, src.rows), Point(src.cols, src.rows) };
Point2f dp[] = { Point2f(rng.uniform(0, src.cols), rng.uniform(0, src.rows)), Point2f dp[] = { Point(rng.uniform(0, src.cols), rng.uniform(0, src.rows)),
Point2f(rng.uniform(0, src.cols), rng.uniform(0, src.rows)), Point(rng.uniform(0, src.cols), rng.uniform(0, src.rows)),
Point2f(rng.uniform(0, src.cols), rng.uniform(0, src.rows)), Point(rng.uniform(0, src.cols), rng.uniform(0, src.rows)),
Point2f(rng.uniform(0, src.cols), rng.uniform(0, src.rows)) }; Point(rng.uniform(0, src.cols), rng.uniform(0, src.rows)) };
M = getPerspectiveTransform(sp, dp); M = getPerspectiveTransform(sp, dp);
static const int depths[] = { CV_32F, CV_64F }; static const int depths[] = { CV_32F, CV_64F };

@ -216,10 +216,10 @@ static void calcOpticalFlowSingleScaleSF(const Mat& prev_extended,
// TODO: do smth with this creepy staff // TODO: do smth with this creepy staff
Vec2f flow_at_point = flow.at<Vec2f>(r0, c0); Vec2f flow_at_point = flow.at<Vec2f>(r0, c0);
int u0 = floor(flow_at_point[0] + 0.5); int u0 = cvRound(flow_at_point[0]);
if (r0 + u0 < 0) { u0 = -r0; } if (r0 + u0 < 0) { u0 = -r0; }
if (r0 + u0 >= rows) { u0 = rows - 1 - r0; } if (r0 + u0 >= rows) { u0 = rows - 1 - r0; }
int v0 = floor(flow_at_point[1] + 0.5); int v0 = cvRound(flow_at_point[1]);
if (c0 + v0 < 0) { v0 = -c0; } if (c0 + v0 < 0) { v0 = -c0; }
if (c0 + v0 >= cols) { v0 = cols - 1 - c0; } if (c0 + v0 >= cols) { v0 = cols - 1 - c0; }
@ -228,7 +228,7 @@ static void calcOpticalFlowSingleScaleSF(const Mat& prev_extended,
const int left_col_shift = -min(c0 + v0, max_flow); const int left_col_shift = -min(c0 + v0, max_flow);
const int right_col_shift = min(cols - 1 - (c0 + v0), max_flow); const int right_col_shift = min(cols - 1 - (c0 + v0), max_flow);
float min_cost = DBL_MAX, best_u = u0, best_v = v0; float min_cost = FLT_MAX, best_u = (float)u0, best_v = (float)v0;
wc(prev_extended, weight_window, r0 + averaging_radius, c0 + averaging_radius, wc(prev_extended, weight_window, r0 + averaging_radius, c0 + averaging_radius,
averaging_radius, averaging_radius, averaging_radius, averaging_radius, sigma_color); averaging_radius, averaging_radius, averaging_radius, averaging_radius, sigma_color);
@ -562,7 +562,7 @@ CV_EXPORTS_W void calcOpticalFlowSF(Mat& from,
selectPointsToRecalcFlow(flow, selectPointsToRecalcFlow(flow,
averaging_radius, averaging_radius,
speed_up_thr, (float)speed_up_thr,
curr_rows, curr_rows,
curr_cols, curr_cols,
speed_up, speed_up,
@ -571,7 +571,7 @@ CV_EXPORTS_W void calcOpticalFlowSF(Mat& from,
selectPointsToRecalcFlow(flow_inv, selectPointsToRecalcFlow(flow_inv,
averaging_radius, averaging_radius,
speed_up_thr, (float)speed_up_thr,
curr_rows, curr_rows,
curr_cols, curr_cols,
speed_up_inv, speed_up_inv,

Loading…
Cancel
Save