diff --git a/modules/dnn/include/opencv2/dnn/all_layers.hpp b/modules/dnn/include/opencv2/dnn/all_layers.hpp index b5416142c9..cd4cca4c28 100644 --- a/modules/dnn/include/opencv2/dnn/all_layers.hpp +++ b/modules/dnn/include/opencv2/dnn/all_layers.hpp @@ -45,7 +45,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN //! @addtogroup dnn //! @{ @@ -617,7 +617,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN //! @} //! @} -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } #endif diff --git a/modules/dnn/include/opencv2/dnn/dict.hpp b/modules/dnn/include/opencv2/dnn/dict.hpp index 69287dc1cc..64ef2f7a22 100644 --- a/modules/dnn/include/opencv2/dnn/dict.hpp +++ b/modules/dnn/include/opencv2/dnn/dict.hpp @@ -50,7 +50,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN //! @addtogroup dnn //! @{ @@ -149,7 +149,7 @@ public: }; //! @} -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } diff --git a/modules/dnn/include/opencv2/dnn/dnn.hpp b/modules/dnn/include/opencv2/dnn/dnn.hpp index e99f8448fd..a50c50cd05 100644 --- a/modules/dnn/include/opencv2/dnn/dnn.hpp +++ b/modules/dnn/include/opencv2/dnn/dnn.hpp @@ -45,20 +45,13 @@ #include #include -#if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_EXPERIMENTAL_NS -#define CV__DNN_EXPERIMENTAL_NS_BEGIN namespace experimental_dnn_34_v7 { -#define CV__DNN_EXPERIMENTAL_NS_END } -namespace cv { namespace dnn { namespace experimental_dnn_34_v7 { } using namespace experimental_dnn_34_v7; }} -#else -#define CV__DNN_EXPERIMENTAL_NS_BEGIN -#define CV__DNN_EXPERIMENTAL_NS_END -#endif +#include "../dnn/version.hpp" #include namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN //! @addtogroup dnn //! @{ @@ -906,7 +899,7 @@ CV__DNN_EXPERIMENTAL_NS_BEGIN const float eta = 1.f, const int top_k = 0); //! @} -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } diff --git a/modules/dnn/include/opencv2/dnn/dnn.inl.hpp b/modules/dnn/include/opencv2/dnn/dnn.inl.hpp index d2317fc44e..4be49bcc90 100644 --- a/modules/dnn/include/opencv2/dnn/dnn.inl.hpp +++ b/modules/dnn/include/opencv2/dnn/dnn.inl.hpp @@ -46,7 +46,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN template DictValue DictValue::arrayInt(TypeIter begin, int size) @@ -379,7 +379,7 @@ inline std::map::const_iterator Dict::end() const return dict.end(); } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } diff --git a/modules/dnn/include/opencv2/dnn/layer.details.hpp b/modules/dnn/include/opencv2/dnn/layer.details.hpp index 619514e827..1133da562e 100644 --- a/modules/dnn/include/opencv2/dnn/layer.details.hpp +++ b/modules/dnn/include/opencv2/dnn/layer.details.hpp @@ -9,7 +9,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN /** @brief Registers layer constructor in runtime. * @param type string, containing type name of the layer. @@ -72,7 +72,7 @@ public: }; } // namespace -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace #endif diff --git a/modules/dnn/include/opencv2/dnn/layer.hpp b/modules/dnn/include/opencv2/dnn/layer.hpp index c4712b8e7a..8500599371 100644 --- a/modules/dnn/include/opencv2/dnn/layer.hpp +++ b/modules/dnn/include/opencv2/dnn/layer.hpp @@ -45,7 +45,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN //! @addtogroup dnn //! @{ //! @@ -79,7 +79,7 @@ private: //! @} //! @} -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } #endif diff --git a/modules/dnn/include/opencv2/dnn/shape_utils.hpp b/modules/dnn/include/opencv2/dnn/shape_utils.hpp index b0ed3afc54..98adcc382d 100644 --- a/modules/dnn/include/opencv2/dnn/shape_utils.hpp +++ b/modules/dnn/include/opencv2/dnn/shape_utils.hpp @@ -50,7 +50,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN //Slicing @@ -213,7 +213,7 @@ inline Range clamp(const Range& r, int axisSize) return clamped; } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END } } #endif diff --git a/modules/dnn/include/opencv2/dnn/version.hpp b/modules/dnn/include/opencv2/dnn/version.hpp new file mode 100644 index 0000000000..6d1568cb45 --- /dev/null +++ b/modules/dnn/include/opencv2/dnn/version.hpp @@ -0,0 +1,21 @@ +// This file is part of OpenCV project. +// It is subject to the license terms in the LICENSE file found in the top-level directory +// of this distribution and at http://opencv.org/license.html. + +#ifndef OPENCV_DNN_VERSION_HPP +#define OPENCV_DNN_VERSION_HPP + +/// Use with major OpenCV version only. +#define OPENCV_DNN_API_VERSION 20180903 + +#if !defined CV_DOXYGEN && !defined CV_DNN_DONT_ADD_INLINE_NS +#define CV__DNN_INLINE_NS __CV_CAT(dnn4_v, OPENCV_DNN_API_VERSION) +#define CV__DNN_INLINE_NS_BEGIN namespace CV__DNN_INLINE_NS { +#define CV__DNN_INLINE_NS_END } +namespace cv { namespace dnn { namespace CV__DNN_INLINE_NS { } using namespace CV__DNN_INLINE_NS; }} +#else +#define CV__DNN_INLINE_NS_BEGIN +#define CV__DNN_INLINE_NS_END +#endif + +#endif // OPENCV_DNN_VERSION_HPP diff --git a/modules/dnn/src/caffe/caffe_importer.cpp b/modules/dnn/src/caffe/caffe_importer.cpp index 24e918d7dc..c09b5b20a0 100644 --- a/modules/dnn/src/caffe/caffe_importer.cpp +++ b/modules/dnn/src/caffe/caffe_importer.cpp @@ -54,7 +54,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN #ifdef HAVE_PROTOBUF using ::google::protobuf::RepeatedField; @@ -464,5 +464,5 @@ Net readNetFromCaffe(const std::vector& bufferProto, const std::vector& bufferCfg, const std::vector -namespace cv -{ -namespace dnn -{ -CV__DNN_EXPERIMENTAL_NS_BEGIN +namespace cv { namespace dnn { +CV__DNN_INLINE_NS_BEGIN static inline float rectOverlap(const Rect& a, const Rect& b) { @@ -51,6 +48,6 @@ void NMSBoxes(const std::vector& bboxes, const std::vector& NMSFast_(bboxes, scores, score_threshold, nms_threshold, eta, top_k, indices, rotatedRectIOU); } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }// dnn }// cv diff --git a/modules/dnn/src/precomp.hpp b/modules/dnn/src/precomp.hpp index f6230c4c6d..6266e1e9f8 100644 --- a/modules/dnn/src/precomp.hpp +++ b/modules/dnn/src/precomp.hpp @@ -63,9 +63,9 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN #define IS_DNN_OPENCL_TARGET(id) (id == DNN_TARGET_OPENCL || id == DNN_TARGET_OPENCL_FP16) Mutex& getInitializationMutex(); void initializeLayerFactory(); -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace diff --git a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp index a766d2a024..51a249e73c 100644 --- a/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp +++ b/modules/dnn/src/tensorflow/tf_graph_simplifier.cpp @@ -12,7 +12,7 @@ #include "tf_graph_simplifier.hpp" namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN using ::google::protobuf::RepeatedField; using ::google::protobuf::MapPair; @@ -782,7 +782,7 @@ void releaseTensor(tensorflow::TensorProto* tensor) } } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace dnn, namespace cv #endif // HAVE_PROTOBUF diff --git a/modules/dnn/src/tensorflow/tf_graph_simplifier.hpp b/modules/dnn/src/tensorflow/tf_graph_simplifier.hpp index d60ced7894..8b76052014 100644 --- a/modules/dnn/src/tensorflow/tf_graph_simplifier.hpp +++ b/modules/dnn/src/tensorflow/tf_graph_simplifier.hpp @@ -15,7 +15,7 @@ #include "tf_io.hpp" namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN void RemoveIdentityOps(tensorflow::GraphDef& net); @@ -25,7 +25,7 @@ Mat getTensorContent(const tensorflow::TensorProto &tensor); void releaseTensor(tensorflow::TensorProto* tensor); -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace dnn, namespace cv #endif // HAVE_PROTOBUF diff --git a/modules/dnn/src/tensorflow/tf_importer.cpp b/modules/dnn/src/tensorflow/tf_importer.cpp index 264d3cbc86..86596c1b37 100644 --- a/modules/dnn/src/tensorflow/tf_importer.cpp +++ b/modules/dnn/src/tensorflow/tf_importer.cpp @@ -24,7 +24,7 @@ Implementation of Tensorflow models parser namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN #if HAVE_PROTOBUF @@ -1950,5 +1950,5 @@ Net readNetFromTensorflow(const std::vector& bufferModel, const std::vect bufferConfigPtr, bufferConfig.size()); } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace diff --git a/modules/dnn/src/torch/torch_importer.cpp b/modules/dnn/src/torch/torch_importer.cpp index 2338c73d96..4f0041eeb6 100644 --- a/modules/dnn/src/torch/torch_importer.cpp +++ b/modules/dnn/src/torch/torch_importer.cpp @@ -51,7 +51,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN using namespace TH; @@ -1240,5 +1240,5 @@ Net readNetFromTorch(const String &model, bool isBinary) return net; } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace diff --git a/modules/dnn/test/test_precomp.hpp b/modules/dnn/test/test_precomp.hpp index a0a46ab271..d74e0bf9af 100644 --- a/modules/dnn/test/test_precomp.hpp +++ b/modules/dnn/test/test_precomp.hpp @@ -51,7 +51,7 @@ namespace cv { namespace dnn { -CV__DNN_EXPERIMENTAL_NS_BEGIN +CV__DNN_INLINE_NS_BEGIN static inline void PrintTo(const cv::dnn::Backend& v, std::ostream* os) { @@ -75,7 +75,7 @@ static inline void PrintTo(const cv::dnn::Target& v, std::ostream* os) *os << "DNN_TARGET_UNKNOWN(" << v << ")"; } -CV__DNN_EXPERIMENTAL_NS_END +CV__DNN_INLINE_NS_END }} // namespace namespace opencv_test {