diff --git a/modules/dnn/include/opencv2/dnn/shape_utils.hpp b/modules/dnn/include/opencv2/dnn/shape_utils.hpp index d0a16a1b25..c0c8ce47f4 100644 --- a/modules/dnn/include/opencv2/dnn/shape_utils.hpp +++ b/modules/dnn/include/opencv2/dnn/shape_utils.hpp @@ -60,7 +60,7 @@ inline std::ostream &operator<< (std::ostream &s, cv::Range &r) struct _Range : public cv::Range { _Range(const Range &r) : cv::Range(r) {} - _Range(int start, int size = 1) : cv::Range(start, start + size) {} + _Range(int start_, int size_ = 1) : cv::Range(start_, start_ + size_) {} }; static inline Mat slice(const Mat &m, const _Range &r0) @@ -148,13 +148,13 @@ static inline MatShape shape(int a0, int a1=-1, int a2=-1, int a3=-1) static inline int total(const MatShape& shape, int start = -1, int end = -1) { if (start == -1) start = 0; - if (end == -1) end = shape.size(); + if (end == -1) end = (int)shape.size(); if (shape.empty()) return 0; int elems = 1; - CV_Assert(start < shape.size() && end <= shape.size() && + CV_Assert(start < (int)shape.size() && end <= (int)shape.size() && start <= end); for(int i = start; i < end; i++) { @@ -187,7 +187,7 @@ inline int clamp(int ax, int dims) inline int clamp(int ax, const MatShape& shape) { - return clamp(ax, shape.size()); + return clamp(ax, (int)shape.size()); } } diff --git a/samples/dnn/caffe_googlenet.cpp b/samples/dnn/caffe_googlenet.cpp index 59579863f3..f7f325ba70 100644 --- a/samples/dnn/caffe_googlenet.cpp +++ b/samples/dnn/caffe_googlenet.cpp @@ -50,7 +50,7 @@ using namespace cv::dnn; using namespace std; /* Find best class for the blob (i. e. class with maximal probability) */ -void getMaxClass(const Mat &probBlob, int *classId, double *classProb) +static void getMaxClass(const Mat &probBlob, int *classId, double *classProb) { Mat probMat = probBlob.reshape(1, 1); //reshape the blob to 1x1000 matrix Point classNumber; @@ -59,7 +59,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb) *classId = classNumber.x; } -std::vector readClassNames(const char *filename = "synset_words.txt") +static std::vector readClassNames(const char *filename = "synset_words.txt") { std::vector classNames; diff --git a/samples/dnn/fcn_semsegm.cpp b/samples/dnn/fcn_semsegm.cpp index 6706050743..062144af3c 100644 --- a/samples/dnn/fcn_semsegm.cpp +++ b/samples/dnn/fcn_semsegm.cpp @@ -33,9 +33,9 @@ static vector readColors(const string &filename = "pascal-classes.txt string name; ss >> name; int temp; cv::Vec3b color; - ss >> temp; color[0] = temp; - ss >> temp; color[1] = temp; - ss >> temp; color[2] = temp; + ss >> temp; color[0] = (uchar)temp; + ss >> temp; color[1] = (uchar)temp; + ss >> temp; color[2] = (uchar)temp; colors.push_back(color); } } @@ -64,7 +64,7 @@ static void colorizeSegmentation(const Mat &score, const vector &colo if (ptrScore[col] > ptrMaxVal[col]) { ptrMaxVal[col] = ptrScore[col]; - ptrMaxCl[col] = ch; + ptrMaxCl[col] = (uchar)ch; } } } diff --git a/samples/dnn/squeezenet_halide.cpp b/samples/dnn/squeezenet_halide.cpp index b0b553593e..ddb01ba187 100644 --- a/samples/dnn/squeezenet_halide.cpp +++ b/samples/dnn/squeezenet_halide.cpp @@ -19,7 +19,7 @@ using namespace cv::dnn; #include /* Find best class for the blob (i. e. class with maximal probability) */ -void getMaxClass(const Mat &probBlob, int *classId, double *classProb) +static void getMaxClass(const Mat &probBlob, int *classId, double *classProb) { Mat probMat = probBlob.reshape(1, 1); //reshape the blob to 1x1000 matrix Point classNumber; @@ -28,7 +28,7 @@ void getMaxClass(const Mat &probBlob, int *classId, double *classProb) *classId = classNumber.x; } -std::vector readClassNames(const char *filename = "synset_words.txt") +static std::vector readClassNames(const char *filename = "synset_words.txt") { std::vector classNames; diff --git a/samples/dnn/ssd_object_detection.cpp b/samples/dnn/ssd_object_detection.cpp index 016357c4b3..2c564e056f 100644 --- a/samples/dnn/ssd_object_detection.cpp +++ b/samples/dnn/ssd_object_detection.cpp @@ -13,22 +13,22 @@ using namespace std; const size_t width = 300; const size_t height = 300; -Mat getMean(const size_t& imageHeight, const size_t& imageWidth) +static Mat getMean(const size_t& imageHeight, const size_t& imageWidth) { Mat mean; const int meanValues[3] = {104, 117, 123}; vector meanChannels; - for(size_t i = 0; i < 3; i++) + for(int i = 0; i < 3; i++) { - Mat channel(imageHeight, imageWidth, CV_32F, Scalar(meanValues[i])); + Mat channel((int)imageHeight, (int)imageWidth, CV_32F, Scalar(meanValues[i])); meanChannels.push_back(channel); } cv::merge(meanChannels, mean); return mean; } -Mat preprocess(const Mat& frame) +static Mat preprocess(const Mat& frame) { Mat preprocessed; frame.convertTo(preprocessed, CV_32F); @@ -124,7 +124,7 @@ int main(int argc, char** argv) if(confidence > confidenceThreshold) { - size_t objectClass = detectionMat.at(i, 1); + size_t objectClass = (size_t)(detectionMat.at(i, 1)); float xLeftBottom = detectionMat.at(i, 3) * frame.cols; float yLeftBottom = detectionMat.at(i, 4) * frame.rows; @@ -139,9 +139,9 @@ int main(int argc, char** argv) << " " << xRightTop << " " << yRightTop << std::endl; - Rect object(xLeftBottom, yLeftBottom, - xRightTop - xLeftBottom, - yRightTop - yLeftBottom); + Rect object((int)xLeftBottom, (int)yLeftBottom, + (int)(xRightTop - xLeftBottom), + (int)(yRightTop - yLeftBottom)); rectangle(frame, object, Scalar(0, 255, 0)); } diff --git a/samples/dnn/torch_enet.cpp b/samples/dnn/torch_enet.cpp index 1b46e5a058..e27dd16de3 100644 --- a/samples/dnn/torch_enet.cpp +++ b/samples/dnn/torch_enet.cpp @@ -141,7 +141,7 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto if (ptrScore[col] > ptrMaxVal[col]) { ptrMaxVal[col] = ptrScore[col]; - ptrMaxCl[col] = ch; + ptrMaxCl[col] = (uchar)ch; } } } @@ -161,8 +161,8 @@ static void colorizeSegmentation(const Mat &score, Mat &segm, Mat &legend, vecto if (classNames.size() == colors.size()) { int blockHeight = 30; - legend.create(blockHeight*classNames.size(), 200, CV_8UC3); - for(int i = 0; i < classNames.size(); i++) + legend.create(blockHeight*(int)classNames.size(), 200, CV_8UC3); + for(int i = 0; i < (int)classNames.size(); i++) { cv::Mat block = legend.rowRange(i*blockHeight, (i+1)*blockHeight); block = colors[i]; @@ -194,9 +194,9 @@ static vector readColors(const String &filename, vector& classNam string name; ss >> name; int temp; cv::Vec3b color; - ss >> temp; color[0] = temp; - ss >> temp; color[1] = temp; - ss >> temp; color[2] = temp; + ss >> temp; color[0] = (uchar)temp; + ss >> temp; color[1] = (uchar)temp; + ss >> temp; color[2] = (uchar)temp; classNames.push_back(name); colors.push_back(color); }