From 41c9377db02c233a31b05e9df3093ded88b6738c Mon Sep 17 00:00:00 2001 From: Vladislav Vinogradov Date: Tue, 18 Dec 2012 18:03:54 +0400 Subject: [PATCH] fixed warnings under windows --- modules/gpu/src/cascadeclassifier.cpp | 2 +- modules/gpu/src/element_operations.cpp | 8 ++++---- modules/gpu/src/fgd_bgfg.cpp | 6 +++--- modules/gpu/src/hough.cpp | 2 +- modules/gpu/src/softcascade.cpp | 6 +++--- modules/gpu/test/test_hough.cpp | 2 +- modules/gpu/test/test_labeling.cpp | 2 +- modules/gpu/test/test_video.cpp | 4 ++-- samples/gpu/houghlines.cpp | 6 +++--- samples/gpu/optical_flow.cpp | 22 +++++++++++----------- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/modules/gpu/src/cascadeclassifier.cpp b/modules/gpu/src/cascadeclassifier.cpp index 07e174e..3603933 100644 --- a/modules/gpu/src/cascadeclassifier.cpp +++ b/modules/gpu/src/cascadeclassifier.cpp @@ -623,7 +623,7 @@ private: } // copy data structures on gpu - stage_mat.upload(cv::Mat(1, stages.size() * sizeof(Stage), CV_8UC1, (uchar*)&(stages[0]) )); + stage_mat.upload(cv::Mat(1, (int) (stages.size() * sizeof(Stage)), CV_8UC1, (uchar*)&(stages[0]) )); trees_mat.upload(cv::Mat(cl_trees).reshape(1,1)); nodes_mat.upload(cv::Mat(cl_nodes).reshape(1,1)); leaves_mat.upload(cv::Mat(cl_leaves).reshape(1,1)); diff --git a/modules/gpu/src/element_operations.cpp b/modules/gpu/src/element_operations.cpp index 1943b31..3d6cde3 100644 --- a/modules/gpu/src/element_operations.cpp +++ b/modules/gpu/src/element_operations.cpp @@ -2086,7 +2086,7 @@ void cv::gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, St cudaStream_t stream = StreamAccessor::getStream(s); - const int bcols = src.cols * src.elemSize(); + const int bcols = (int) (src.cols * src.elemSize()); if ((bcols & 3) == 0) { @@ -2139,7 +2139,7 @@ void cv::gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c cudaStream_t stream = StreamAccessor::getStream(s); - const int bcols = src1.cols * src1.elemSize(); + const int bcols = (int) (src1.cols * src1.elemSize()); if ((bcols & 3) == 0) { @@ -2186,7 +2186,7 @@ void cv::gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, co cudaStream_t stream = StreamAccessor::getStream(s); - const int bcols = src1.cols * src1.elemSize(); + const int bcols = (int) (src1.cols * src1.elemSize()); if ((bcols & 3) == 0) { @@ -2233,7 +2233,7 @@ void cv::gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, c cudaStream_t stream = StreamAccessor::getStream(s); - const int bcols = src1.cols * src1.elemSize(); + const int bcols = (int) (src1.cols * src1.elemSize()); if ((bcols & 3) == 0) { diff --git a/modules/gpu/src/fgd_bgfg.cpp b/modules/gpu/src/fgd_bgfg.cpp index e0f695d..1576f69 100644 --- a/modules/gpu/src/fgd_bgfg.cpp +++ b/modules/gpu/src/fgd_bgfg.cpp @@ -523,15 +523,15 @@ namespace size_t total = all_contours.size(); - _contours.create(total, 1, 0, -1, true); + _contours.create((int) total, 1, 0, -1, true); cv::SeqIterator it = all_contours.begin(); for (size_t i = 0; i < total; ++i, ++it) { CvSeq* c = *it; ((CvContour*)c)->color = (int)i; - _contours.create((int)c->total, 1, CV_32SC2, i, true); - cv::Mat ci = _contours.getMat(i); + _contours.create((int)c->total, 1, CV_32SC2, (int)i, true); + cv::Mat ci = _contours.getMat((int)i); CV_Assert( ci.isContinuous() ); cvCvtSeqToArray(c, ci.data); } diff --git a/modules/gpu/src/hough.cpp b/modules/gpu/src/hough.cpp index 1b9c786..09cf018 100644 --- a/modules/gpu/src/hough.cpp +++ b/modules/gpu/src/hough.cpp @@ -579,7 +579,7 @@ namespace const func_t func = funcs[dx.depth()]; CV_Assert(func != 0); - edgePointList.cols = edgePointList.step / sizeof(int); + edgePointList.cols = (int) (edgePointList.step / sizeof(int)); ensureSizeIsEnough(2, edges.size().area(), CV_32SC1, edgePointList); edgePointList.cols = func(edges, dx, dy, edgePointList.ptr(0), edgePointList.ptr(1)); diff --git a/modules/gpu/src/softcascade.cpp b/modules/gpu/src/softcascade.cpp index 9c9132b..695fab5 100644 --- a/modules/gpu/src/softcascade.cpp +++ b/modules/gpu/src/softcascade.cpp @@ -235,13 +235,13 @@ struct cv::gpu::SCascade::Fields ++octIndex; } - cv::Mat hoctaves(1, voctaves.size() * sizeof(Octave), CV_8UC1, (uchar*)&(voctaves[0])); + cv::Mat hoctaves(1, (int) (voctaves.size() * sizeof(Octave)), CV_8UC1, (uchar*)&(voctaves[0])); CV_Assert(!hoctaves.empty()); cv::Mat hstages(cv::Mat(vstages).reshape(1,1)); CV_Assert(!hstages.empty()); - cv::Mat hnodes(1, vnodes.size() * sizeof(Node), CV_8UC1, (uchar*)&(vnodes[0]) ); + cv::Mat hnodes(1, (int) (vnodes.size() * sizeof(Node)), CV_8UC1, (uchar*)&(vnodes[0]) ); CV_Assert(!hnodes.empty()); cv::Mat hleaves(cv::Mat(vleaves).reshape(1,1)); @@ -296,7 +296,7 @@ struct cv::gpu::SCascade::Fields scale = ::std::min(maxScale, ::expf(::log(scale) + logFactor)); } - cv::Mat hlevels = cv::Mat(1, vlevels.size() * sizeof(Level), CV_8UC1, (uchar*)&(vlevels[0]) ); + cv::Mat hlevels = cv::Mat(1, (int) (vlevels.size() * sizeof(Level)), CV_8UC1, (uchar*)&(vlevels[0]) ); CV_Assert(!hlevels.empty()); levels.upload(hlevels); downscales = dcs; diff --git a/modules/gpu/test/test_hough.cpp b/modules/gpu/test/test_hough.cpp index 9c4a974..76ed0c6 100644 --- a/modules/gpu/test/test_hough.cpp +++ b/modules/gpu/test/test_hough.cpp @@ -89,7 +89,7 @@ TEST_P(HoughLines, Accuracy) const bool useRoi = GET_PARAM(2); const float rho = 1.0f; - const float theta = 1.5f * CV_PI / 180.0f; + const float theta = (float) (1.5 * CV_PI / 180.0); const int threshold = 100; cv::Mat src(size, CV_8UC1); diff --git a/modules/gpu/test/test_labeling.cpp b/modules/gpu/test/test_labeling.cpp index f5e79cd..21ee03b 100644 --- a/modules/gpu/test/test_labeling.cpp +++ b/modules/gpu/test/test_labeling.cpp @@ -82,7 +82,7 @@ namespace { int cc = -1; int* dist_labels = (int*)labels.data; - int pitch = labels.step1(); + int pitch = (int) labels.step1(); unsigned char* source = (unsigned char*)image.data; int width = image.cols; diff --git a/modules/gpu/test/test_video.cpp b/modules/gpu/test/test_video.cpp index 6162ee2..d1332ce 100644 --- a/modules/gpu/test/test_video.cpp +++ b/modules/gpu/test/test_video.cpp @@ -606,8 +606,8 @@ static void FastOpticalFlowBM_gold(const cv::Mat_& I0, const cv::Mat_ lines_cpu; { - const double start = getTickCount(); + const int64 start = getTickCount(); HoughLinesP(mask, lines_cpu, 1, CV_PI / 180, 50, 60, 5); @@ -57,9 +57,9 @@ int main(int argc, const char* argv[]) GpuMat d_lines; HoughLinesBuf d_buf; { - const double start = getTickCount(); + const int64 start = getTickCount(); - gpu::HoughLinesP(d_src, d_lines, d_buf, 1, CV_PI / 180, 50, 5); + gpu::HoughLinesP(d_src, d_lines, d_buf, 1.0f, (float) (CV_PI / 180.0f), 50, 5); const double timeSec = (getTickCount() - start) / getTickFrequency(); cout << "GPU Time : " << timeSec * 1000 << " ms" << endl; diff --git a/samples/gpu/optical_flow.cpp b/samples/gpu/optical_flow.cpp index 8afff89..3f74d1b 100644 --- a/samples/gpu/optical_flow.cpp +++ b/samples/gpu/optical_flow.cpp @@ -57,7 +57,7 @@ static Vec3b computeColor(float fx, float fy) } const float rad = sqrt(fx * fx + fy * fy); - const float a = atan2(-fy, -fx) / CV_PI; + const float a = atan2(-fy, -fx) / (float) CV_PI; const float fk = (a + 1.0f) / 2.0f * (NCOLS - 1); const int k0 = static_cast(fk); @@ -68,8 +68,8 @@ static Vec3b computeColor(float fx, float fy) for (int b = 0; b < 3; b++) { - const float col0 = colorWheel[k0][b] / 255.0; - const float col1 = colorWheel[k1][b] / 255.0; + const float col0 = colorWheel[k0][b] / 255.0f; + const float col1 = colorWheel[k1][b] / 255.0f; float col = (1 - f) * col0 + f * col1; @@ -78,7 +78,7 @@ static Vec3b computeColor(float fx, float fy) else col *= .75; // out of range - pix[2 - b] = static_cast(255.0 * col); + pix[2 - b] = static_cast(255.0 * col); } return pix; @@ -166,7 +166,7 @@ int main(int argc, const char* argv[]) GpuMat d_flowx(frame0.size(), CV_32FC1); GpuMat d_flowy(frame0.size(), CV_32FC1); - BroxOpticalFlow brox(0.197, 50.0, 0.8, 10, 77, 10); + BroxOpticalFlow brox(0.197f, 50.0f, 0.8f, 10, 77, 10); PyrLKOpticalFlow lk; lk.winSize = Size(7, 7); FarnebackOpticalFlow farn; OpticalFlowDual_TVL1_GPU tvl1; @@ -179,7 +179,7 @@ int main(int argc, const char* argv[]) d_frame0.convertTo(d_frame0f, CV_32F, 1.0 / 255.0); d_frame1.convertTo(d_frame1f, CV_32F, 1.0 / 255.0); - const double start = getTickCount(); + const int64 start = getTickCount(); brox(d_frame0f, d_frame1f, d_flowx, d_flowy); @@ -190,7 +190,7 @@ int main(int argc, const char* argv[]) } { - const double start = getTickCount(); + const int64 start = getTickCount(); lk.dense(d_frame0, d_frame1, d_flowx, d_flowy); @@ -201,7 +201,7 @@ int main(int argc, const char* argv[]) } { - const double start = getTickCount(); + const int64 start = getTickCount(); farn(d_frame0, d_frame1, d_flowx, d_flowy); @@ -212,7 +212,7 @@ int main(int argc, const char* argv[]) } { - const double start = getTickCount(); + const int64 start = getTickCount(); tvl1(d_frame0, d_frame1, d_flowx, d_flowy); @@ -223,7 +223,7 @@ int main(int argc, const char* argv[]) } { - const double start = getTickCount(); + const int64 start = getTickCount(); GpuMat buf; calcOpticalFlowBM(d_frame0, d_frame1, Size(7, 7), Size(1, 1), Size(21, 21), false, d_flowx, d_flowy, buf); @@ -235,7 +235,7 @@ int main(int argc, const char* argv[]) } { - const double start = getTickCount(); + const int64 start = getTickCount(); fastBM(d_frame0, d_frame1, d_flowx, d_flowy); -- 2.7.4