fix Mat_ release #8680
authorcDc <cdc.seacave@gmail.com>
Fri, 5 May 2017 13:37:22 +0000 (16:37 +0300)
committerVladislav Sovrasov <sovrasov.vlad@gmail.com>
Tue, 23 May 2017 09:19:57 +0000 (12:19 +0300)
modules/core/include/opencv2/core/mat.hpp
modules/core/include/opencv2/core/mat.inl.hpp

index e4f3f0b..2c91a99 100644 (file)
@@ -2185,6 +2185,8 @@ public:
     void create(Size _size);
     //! equivalent to Mat::create(_ndims, _sizes, DatType<_Tp>::type)
     void create(int _ndims, const int* _sizes);
+    //! equivalent to Mat::release()
+    void release();
     //! cross-product
     Mat_ cross(const Mat_& m) const;
     //! data type conversion
@@ -2676,11 +2678,11 @@ public:
     /*!
         @param [out] m - output matrix; if it does not have a proper size or type before the operation,
             it is reallocated
-        @param [in] rtype  desired output matrix type or, rather, the depth since the number of channels
+        @param [in] rtype - desired output matrix type or, rather, the depth since the number of channels
             are the same as the input has; if rtype is negative, the output matrix will have the
             same type as the input.
-        @param [in] alpha  optional scale factor
-        @param [in] beta  optional delta added to the scaled values
+        @param [in] alpha - optional scale factor
+        @param [in] beta - optional delta added to the scaled values
     */
     void convertTo( Mat& m, int rtype, double alpha=1, double beta=0 ) const;
 
index ce8f6e9..82a892d 100644 (file)
@@ -1626,6 +1626,15 @@ void Mat_<_Tp>::create(int _dims, const int* _sz)
 }
 
 template<typename _Tp> inline
+void Mat_<_Tp>::release()
+{
+    Mat::release();
+#ifdef _DEBUG
+    flags = (flags & ~CV_MAT_TYPE_MASK) | DataType<_Tp>::type;
+#endif
+}
+
+template<typename _Tp> inline
 Mat_<_Tp> Mat_<_Tp>::cross(const Mat_& m) const
 {
     return Mat_<_Tp>(Mat::cross(m));