diff --git a/modules/core/test/test_mat.cpp b/modules/core/test/test_mat.cpp index 8471eae49..3693c2dcb 100644 --- a/modules/core/test/test_mat.cpp +++ b/modules/core/test/test_mat.cpp @@ -869,7 +869,7 @@ int calcDiffElemCountImpl(const vector& mv, const Mat& m) for(int x = 0; x < m.cols; x++) { const ElemType* mElem = &m.at(y,x*mChannels); - int loc = 0; + size_t loc = 0; for(size_t i = 0; i < mv.size(); i++) { const size_t mvChannel = mv[i].channels(); @@ -879,7 +879,7 @@ int calcDiffElemCountImpl(const vector& mv, const Mat& m) diffElemCount++; loc += mvChannel; } - CV_Assert(loc == mChannels); + CV_Assert(loc == (size_t)mChannels); } } return diffElemCount; diff --git a/modules/imgproc/src/demosaicing.cpp b/modules/imgproc/src/demosaicing.cpp index f5cbde95b..14bcea61f 100644 --- a/modules/imgproc/src/demosaicing.cpp +++ b/modules/imgproc/src/demosaicing.cpp @@ -1306,7 +1306,7 @@ public: int dcn = dst.channels(); int dcn2 = dcn<<1; int start_with_green = Start_with_green, blue = Blue; - int sstep = src.step / src.elemSize1(), dstep = dst.step / dst.elemSize1(); + int sstep = int(src.step / src.elemSize1()), dstep = int(dst.step / dst.elemSize1()); SIMDInterpolator vecOp; const T* S = reinterpret_cast(src.data + (range.start + 1) * src.step) + 1; @@ -1415,7 +1415,7 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code) } size = dst.size(); size.width *= dst.channels(); - int dstep = dst.step / dst.elemSize1(); + size_t dstep = dst.step / dst.elemSize1(); T* firstRow = reinterpret_cast(dst.data); T* lastRow = reinterpret_cast(dst.data) + (size.height-1) * dstep; @@ -1423,8 +1423,8 @@ static void Bayer2RGB_EdgeAware_T(const Mat& src, Mat& dst, int code) { for (int x = 0; x < size.width; ++x) { - firstRow[x] = firstRow[dstep+x]; - lastRow[x] = lastRow[-dstep+x]; + firstRow[x] = (firstRow+dstep)[x]; + lastRow[x] = (lastRow-dstep)[x]; } } else diff --git a/modules/imgproc/src/floodfill.cpp b/modules/imgproc/src/floodfill.cpp index 54a58513e..5436c7b02 100644 --- a/modules/imgproc/src/floodfill.cpp +++ b/modules/imgproc/src/floodfill.cpp @@ -505,14 +505,15 @@ int cv::floodFill( InputOutputArray _image, InputOutputArray _mask, if( is_simple ) { - int elem_size = img.elemSize(); + size_t elem_size = img.elemSize(); const uchar* seed_ptr = img.data + img.step*seedPoint.y + elem_size*seedPoint.x; - for(i = 0; i < elem_size; i++) - if (seed_ptr[i] != nv_buf.b[i]) + size_t k = 0; + for(; k < elem_size; k++) + if (seed_ptr[k] != nv_buf.b[k]) break; - if( i != elem_size ) + if( k != elem_size ) { if( type == CV_8UC1 ) floodFill_CnIR(img, seedPoint, nv_buf.b[0], &comp, flags, &buffer); diff --git a/modules/imgproc/src/samplers.cpp b/modules/imgproc/src/samplers.cpp index 34f0eb3dd..80e2706ba 100644 --- a/modules/imgproc/src/samplers.cpp +++ b/modules/imgproc/src/samplers.cpp @@ -46,7 +46,7 @@ namespace cv { static const uchar* -adjustRect( const uchar* src, int src_step, int pix_size, +adjustRect( const uchar* src, size_t src_step, int pix_size, Size src_size, Size win_size, Point ip, Rect* pRect ) { @@ -127,8 +127,8 @@ struct nop template -void getRectSubPix_Cn_(const _Tp* src, int src_step, Size src_size, - _DTp* dst, int dst_step, Size win_size, Point2f center, int cn ) +void getRectSubPix_Cn_(const _Tp* src, size_t src_step, Size src_size, + _DTp* dst, size_t dst_step, Size win_size, Point2f center, int cn ) { ScaleOp scale_op; CastOp cast_op; @@ -217,8 +217,8 @@ void getRectSubPix_Cn_(const _Tp* src, int src_step, Size src_size, static void getRectSubPix_8u32f -( const uchar* src, int src_step, Size src_size, - float* dst, int dst_step, Size win_size, Point2f center0, int cn ) +( const uchar* src, size_t src_step, Size src_size, + float* dst, size_t dst_step, Size win_size, Point2f center0, int cn ) { Point2f center = center0; Point ip; @@ -269,8 +269,8 @@ static void getRectSubPix_8u32f static void -getQuadrangleSubPix_8u32f_CnR( const uchar* src, int src_step, Size src_size, - float* dst, int dst_step, Size win_size, +getQuadrangleSubPix_8u32f_CnR( const uchar* src, size_t src_step, Size src_size, + float* dst, size_t dst_step, Size win_size, const double *matrix, int cn ) { int x, y, k; diff --git a/modules/imgproc/src/segmentation.cpp b/modules/imgproc/src/segmentation.cpp index 9679add1c..e4cd43401 100644 --- a/modules/imgproc/src/segmentation.cpp +++ b/modules/imgproc/src/segmentation.cpp @@ -148,9 +148,9 @@ void cv::watershed( InputArray _src, InputOutputArray _markers ) CV_Assert( src.size() == dst.size() ); const uchar* img = src.data; - int istep = src.step/sizeof(img[0]); + int istep = int(src.step/sizeof(img[0])); int* mask = dst.ptr(); - int mstep = dst.step / sizeof(mask[0]); + int mstep = int(dst.step / sizeof(mask[0])); for( i = 0; i < 256; i++ ) subs_tab[i] = 0; diff --git a/modules/softcascade/CMakeLists.txt b/modules/softcascade/CMakeLists.txt index ef38c3ad7..fb48814cf 100644 --- a/modules/softcascade/CMakeLists.txt +++ b/modules/softcascade/CMakeLists.txt @@ -1,2 +1,3 @@ set(the_description "Soft Cascade detection and training") -ocv_define_module(softcascade opencv_core opencv_imgproc opencv_ml) \ No newline at end of file +ocv_define_module(softcascade opencv_core opencv_imgproc opencv_ml) +ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4310) \ No newline at end of file diff --git a/modules/softcascade/src/_random.hpp b/modules/softcascade/src/_random.hpp index cf12037aa..63fa2565f 100644 --- a/modules/softcascade/src/_random.hpp +++ b/modules/softcascade/src/_random.hpp @@ -52,6 +52,7 @@ namespace cv { namespace softcascade { namespace internal struct Random { typedef std::mt19937 engine; + typedef engine::result_type seed_type; typedef std::uniform_int uniform; }; @@ -67,6 +68,7 @@ namespace cv { namespace softcascade { namespace internal struct Random { typedef std::mt19937 engine; + typedef engine::result_type seed_type; // True if we're using C++11. #if __cplusplus >= 201103L // C++11 removes uniform_int. @@ -86,6 +88,7 @@ namespace cv { namespace softcascade { namespace internal struct Random { typedef std::tr1::mt19937 engine; + typedef engine::result_type seed_type; typedef std::tr1::uniform_int uniform; }; @@ -125,6 +128,7 @@ private: struct Random { typedef rnd::engine engine; + typedef uint64 seed_type; typedef rnd::uniform_int uniform; }; diff --git a/modules/softcascade/src/integral_channel_builder.cpp b/modules/softcascade/src/integral_channel_builder.cpp index 7c1a846e0..bffc596ff 100644 --- a/modules/softcascade/src/integral_channel_builder.cpp +++ b/modules/softcascade/src/integral_channel_builder.cpp @@ -217,7 +217,7 @@ void ChannelFeaturePool::fill(int desired) int nfeatures = std::min(desired, maxPoolSize); pool.reserve(nfeatures); - Random::engine eng(FEATURE_RECT_SEED); + Random::engine eng((Random::seed_type)FEATURE_RECT_SEED); Random::engine eng_ch(DCHANNELS_SEED); Random::uniform chRand(0, N_CHANNELS - 1); diff --git a/modules/softcascade/src/soft_cascade_octave.cpp b/modules/softcascade/src/soft_cascade_octave.cpp index 30deb4cc8..f7b3b3fb0 100644 --- a/modules/softcascade/src/soft_cascade_octave.cpp +++ b/modules/softcascade/src/soft_cascade_octave.cpp @@ -116,7 +116,7 @@ BoostedSoftCascadeOctave::BoostedSoftCascadeOctave(cv::Rect bb, int np, int nn, _params.truncate_pruned_tree = false; _params.use_surrogates = false; _params.use_1se_rule = false; - _params.regression_accuracy = 1.0e-6; + _params.regression_accuracy = 1.0e-6f; // boost params _params.boost_type = CvBoost::GENTLE; @@ -221,7 +221,7 @@ void BoostedSoftCascadeOctave::generateNegatives(const Dataset* dataset) using namespace cv::softcascade::internal; // ToDo: set seed, use offsets Random::engine eng(DX_DY_SEED); - Random::engine idxEng(INDEX_ENGINE_SEED); + Random::engine idxEng((Random::seed_type)INDEX_ENGINE_SEED); int h = boundingBox.height; diff --git a/modules/softcascade/src/softcascade.cpp b/modules/softcascade/src/softcascade.cpp index b7a3d0cca..635494bea 100644 --- a/modules/softcascade/src/softcascade.cpp +++ b/modules/softcascade/src/softcascade.cpp @@ -180,7 +180,7 @@ struct ChannelStorage cv::Mat hog; int shrinkage; int offset; - int step; + size_t step; int model_height; cv::Ptr builder; @@ -398,7 +398,7 @@ struct Detector::Fields fns = (*st)[SC_INTERNAL]; FileNodeIterator inIt = fns.begin(), inIt_end = fns.end(); for (; inIt != inIt_end;) - nodes.push_back(Node(features.size(), inIt)); + nodes.push_back(Node((int)features.size(), inIt)); fns = (*st)[SC_LEAF]; inIt = fns.begin(), inIt_end = fns.end(); @@ -504,7 +504,7 @@ void Detector::detectNoRoi(const cv::Mat& image, std::vector& objects { for (int dx = 0; dx < level.workRect.width; ++dx) { - storage.offset = dy * storage.step + dx; + storage.offset = (int)(dy * storage.step + dx); fld.detectAt(dx, dy, level, storage, objects); } } @@ -555,7 +555,7 @@ void Detector::detect(cv::InputArray _image, cv::InputArray _rois, std::vector objects; detect( _image, _rois, objects); - _rects.create(1, objects.size(), CV_32SC4); + _rects.create(1, (int)objects.size(), CV_32SC4); cv::Mat_ rects = (cv::Mat_)_rects.getMat(); cv::Rect* rectPtr = rects.ptr(0); - _confs.create(1, objects.size(), CV_32F); + _confs.create(1, (int)objects.size(), CV_32F); cv::Mat confs = _confs.getMat(); float* confPtr = confs.ptr(0);