diff --git a/modules/core/include/opencv2/core/check.hpp b/modules/core/include/opencv2/core/check.hpp index d975223cc5..a32b8111ce 100644 --- a/modules/core/include/opencv2/core/check.hpp +++ b/modules/core/include/opencv2/core/check.hpp @@ -13,7 +13,7 @@ namespace cv { CV_EXPORTS const char* depthToString(int depth); /** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or "" */ -CV_EXPORTS const String typeToString(int type); +CV_EXPORTS String typeToString(int type); //! @cond IGNORED @@ -23,7 +23,7 @@ namespace detail { CV_EXPORTS const char* depthToString_(int depth); /** Returns string of cv::Mat depth value: CV_8UC3 -> "CV_8UC3" or cv::String() */ -CV_EXPORTS const cv::String typeToString_(int type); +CV_EXPORTS cv::String typeToString_(int type); enum TestOp { TEST_CUSTOM = 0, diff --git a/modules/core/include/opencv2/core/utils/plugin_loader.private.hpp b/modules/core/include/opencv2/core/utils/plugin_loader.private.hpp index d6390fc74a..53b8c48c38 100644 --- a/modules/core/include/opencv2/core/utils/plugin_loader.private.hpp +++ b/modules/core/include/opencv2/core/utils/plugin_loader.private.hpp @@ -147,7 +147,7 @@ public: return handle != NULL; } void* getSymbol(const char* symbolName) const; - const std::string getName() const; + std::string getName() const; private: void libraryLoad(const FileSystemPath_t& filename); void libraryRelease(); diff --git a/modules/core/src/check.cpp b/modules/core/src/check.cpp index 90df841e63..7f1310ad0a 100644 --- a/modules/core/src/check.cpp +++ b/modules/core/src/check.cpp @@ -14,7 +14,7 @@ const char* depthToString(int depth) return s ? s : ""; } -const cv::String typeToString(int type) +cv::String typeToString(int type) { cv::String s = detail::typeToString_(type); if (s.empty()) @@ -47,7 +47,7 @@ const char* depthToString_(int depth) return (depth <= CV_16F && depth >= 0) ? depthNames[depth] : NULL; } -const cv::String typeToString_(int type) +cv::String typeToString_(int type) { int depth = CV_MAT_DEPTH(type); int cn = CV_MAT_CN(type); diff --git a/modules/core/src/ocl.cpp b/modules/core/src/ocl.cpp index 1c8d578fda..51acc68879 100644 --- a/modules/core/src/ocl.cpp +++ b/modules/core/src/ocl.cpp @@ -231,7 +231,7 @@ static const bool CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS = utils::getConfigura #endif ); -static const String getBuildExtraOptions() +static String getBuildExtraOptions() { static String param_buildExtraOptions; static bool initialized = false; diff --git a/modules/core/src/utils/plugin_loader.impl.hpp b/modules/core/src/utils/plugin_loader.impl.hpp index 4173c9d802..be04b4c131 100644 --- a/modules/core/src/utils/plugin_loader.impl.hpp +++ b/modules/core/src/utils/plugin_loader.impl.hpp @@ -56,7 +56,7 @@ void* DynamicLib::getSymbol(const char* symbolName) const return res; } -const std::string DynamicLib::getName() const +std::string DynamicLib::getName() const { return toPrintablePath(fname); } diff --git a/modules/dnn/src/onnx/onnx_importer.cpp b/modules/dnn/src/onnx/onnx_importer.cpp index 4d4783805b..f06ff32dbe 100644 --- a/modules/dnn/src/onnx/onnx_importer.cpp +++ b/modules/dnn/src/onnx/onnx_importer.cpp @@ -205,7 +205,7 @@ private: bool param = utils::getConfigurationParameterBool("OPENCV_DNN_ONNX_USE_LEGACY_NAMES", false); return param; } - const std::string extractNodeName(const opencv_onnx::NodeProto& node_proto); + std::string extractNodeName(const opencv_onnx::NodeProto& node_proto); }; @@ -922,7 +922,7 @@ const ONNXImporter::DispatchMap& ONNXImporter::getDispatchMap(const opencv_onnx: return it->second; } -const std::string ONNXImporter::extractNodeName(const opencv_onnx::NodeProto& node_proto) +std::string ONNXImporter::extractNodeName(const opencv_onnx::NodeProto& node_proto) { // We need to rework DNN outputs API, this is a workaround for #21698 if (node_proto.has_name() && !node_proto.name().empty()) diff --git a/modules/dnn/src/tensorflow/tf_importer.cpp b/modules/dnn/src/tensorflow/tf_importer.cpp index b6d6a73013..cd413c1ad7 100644 --- a/modules/dnn/src/tensorflow/tf_importer.cpp +++ b/modules/dnn/src/tensorflow/tf_importer.cpp @@ -568,7 +568,7 @@ private: typedef std::map DispatchMap; const DispatchMap dispatch; - static const DispatchMap buildDispatchMap(); + static DispatchMap buildDispatchMap(); void parseConvolution (tensorflow::GraphDef& net, const tensorflow::NodeDef& layer, LayerParams& layerParams); void parseBias (tensorflow::GraphDef& net, const tensorflow::NodeDef& layer, LayerParams& layerParams); @@ -645,7 +645,7 @@ protected: TFImporter* importer; }; -const TFImporter::DispatchMap TFImporter::buildDispatchMap() +TFImporter::DispatchMap TFImporter::buildDispatchMap() { static DispatchMap dispatch; dispatch["Conv2D"] = dispatch["SpaceToBatchND"] = dispatch["DepthwiseConv2dNative"] = diff --git a/modules/features2d/include/opencv2/features2d.hpp b/modules/features2d/include/opencv2/features2d.hpp index 26c2b950c9..952d24ca0c 100644 --- a/modules/features2d/include/opencv2/features2d.hpp +++ b/modules/features2d/include/opencv2/features2d.hpp @@ -1143,8 +1143,8 @@ protected: virtual void clear(); const Mat& getDescriptors() const; - const Mat getDescriptor( int imgIdx, int localDescIdx ) const; - const Mat getDescriptor( int globalDescIdx ) const; + Mat getDescriptor( int imgIdx, int localDescIdx ) const; + Mat getDescriptor( int globalDescIdx ) const; void getLocalIdx( int globalDescIdx, int& imgIdx, int& localDescIdx ) const; int size() const; diff --git a/modules/features2d/src/matchers.cpp b/modules/features2d/src/matchers.cpp index 97875d4095..97d0a02417 100644 --- a/modules/features2d/src/matchers.cpp +++ b/modules/features2d/src/matchers.cpp @@ -475,7 +475,7 @@ void DescriptorMatcher::DescriptorCollection::clear() mergedDescriptors.release(); } -const Mat DescriptorMatcher::DescriptorCollection::getDescriptor( int imgIdx, int localDescIdx ) const +Mat DescriptorMatcher::DescriptorCollection::getDescriptor( int imgIdx, int localDescIdx ) const { CV_Assert( imgIdx < (int)startIdxs.size() ); int globalIdx = startIdxs[imgIdx] + localDescIdx; @@ -489,7 +489,7 @@ const Mat& DescriptorMatcher::DescriptorCollection::getDescriptors() const return mergedDescriptors; } -const Mat DescriptorMatcher::DescriptorCollection::getDescriptor( int globalDescIdx ) const +Mat DescriptorMatcher::DescriptorCollection::getDescriptor( int globalDescIdx ) const { CV_Assert( globalDescIdx < size() ); return mergedDescriptors.row( globalDescIdx ); diff --git a/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp b/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp index 53b68c4e21..92f1ccc87f 100644 --- a/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp +++ b/modules/gapi/include/opencv2/gapi/fluid/gfluidkernel.hpp @@ -181,7 +181,7 @@ template<> struct fluid_get_in template<> struct fluid_get_in { // FIXME: change to return by reference when moved to own::Scalar - static const cv::Scalar get(const cv::GArgs &in_args, int idx) + static cv::Scalar get(const cv::GArgs &in_args, int idx) { return in_args[idx].unsafe_get(); } diff --git a/modules/gapi/include/opencv2/gapi/own/types.hpp b/modules/gapi/include/opencv2/gapi/own/types.hpp index 38143660bc..3ec9787839 100644 --- a/modules/gapi/include/opencv2/gapi/own/types.hpp +++ b/modules/gapi/include/opencv2/gapi/own/types.hpp @@ -89,7 +89,7 @@ inline Rect& operator&=(Rect& lhs, const Rect& rhs) return lhs; } -inline const Rect operator&(const Rect& lhs, const Rect& rhs) +inline Rect operator&(const Rect& lhs, const Rect& rhs) { Rect result = lhs; return result &= rhs; diff --git a/modules/stitching/include/opencv2/stitching.hpp b/modules/stitching/include/opencv2/stitching.hpp index fb0ebe929d..3d1dbbd044 100644 --- a/modules/stitching/include/opencv2/stitching.hpp +++ b/modules/stitching/include/opencv2/stitching.hpp @@ -205,12 +205,12 @@ public: void setWaveCorrectKind(detail::WaveCorrectKind kind) { wave_correct_kind_ = kind; } Ptr featuresFinder() { return features_finder_; } - const Ptr featuresFinder() const { return features_finder_; } + Ptr featuresFinder() const { return features_finder_; } void setFeaturesFinder(Ptr features_finder) { features_finder_ = features_finder; } Ptr featuresMatcher() { return features_matcher_; } - const Ptr featuresMatcher() const { return features_matcher_; } + Ptr featuresMatcher() const { return features_matcher_; } void setFeaturesMatcher(Ptr features_matcher) { features_matcher_ = features_matcher; } diff --git a/modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp b/modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp index ad21ee1277..95919ea009 100644 --- a/modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp +++ b/modules/stitching/include/opencv2/stitching/detail/motion_estimators.hpp @@ -133,7 +133,7 @@ private: class CV_EXPORTS_W BundleAdjusterBase : public Estimator { public: - CV_WRAP const Mat refinementMask() const { return refinement_mask_.clone(); } + CV_WRAP Mat refinementMask() const { return refinement_mask_.clone(); } CV_WRAP void setRefinementMask(const Mat &mask) { CV_Assert(mask.type() == CV_8U && mask.size() == Size(3, 3));