mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 04:12:52 +08:00
G-API: "deownification" corrections
- moved "standalone" aliases of cv types to "opencv_includes.hpp" to keep responsibility principle aplied - introduced correct aliasing for "descr_of(Mat)" function for standalone case - added missing include in `gapi/own/mat.hpp`
This commit is contained in:
parent
713577b257
commit
7386d8523b
@ -209,15 +209,20 @@ static inline GMatDesc empty_gmat_desc() { return GMatDesc{-1,-1,{-1,-1}}; }
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::UMat &mat);
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat);
|
||||
/** @} */
|
||||
|
||||
// FIXME: WHY??? WHY it is under different namespace?
|
||||
//Fwd declarations
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
GAPI_EXPORTS GMatDesc descr_of(const Mat &mat);
|
||||
}}//gapi::own
|
||||
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
GAPI_EXPORTS GMatDesc descr_of(const cv::Mat &mat);
|
||||
#else
|
||||
using gapi::own::descr_of;
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
GAPI_EXPORTS std::ostream& operator<<(std::ostream& os, const cv::GMatDesc &desc);
|
||||
|
||||
} // namespace cv
|
||||
|
@ -16,6 +16,17 @@
|
||||
# include <opencv2/core/base.hpp>
|
||||
#else // Without OpenCV
|
||||
# include <opencv2/gapi/own/cvdefs.hpp>
|
||||
# include <opencv2/gapi/own/types.hpp> // cv::gapi::own::Rect/Size/Point
|
||||
# include <opencv2/gapi/own/scalar.hpp> // cv::gapi::own::Scalar
|
||||
# include <opencv2/gapi/own/mat.hpp>
|
||||
// replacement of cv's structures:
|
||||
namespace cv {
|
||||
using Rect = gapi::own::Rect;
|
||||
using Size = gapi::own::Size;
|
||||
using Point = gapi::own::Point;
|
||||
using Scalar = gapi::own::Scalar;
|
||||
using Mat = gapi::own::Mat;
|
||||
} // namespace cv
|
||||
#endif // !defined(GAPI_STANDALONE)
|
||||
|
||||
#endif // OPENCV_GAPI_OPENCV_INCLUDES_HPP
|
||||
|
@ -9,9 +9,6 @@
|
||||
#define OPENCV_GAPI_CV_DEFS_HPP
|
||||
|
||||
#if defined(GAPI_STANDALONE)
|
||||
#include <opencv2/gapi/own/types.hpp> // cv::gapi::own::Rect/Size/Point
|
||||
#include <opencv2/gapi/own/scalar.hpp> // cv::gapi::own::Scalar
|
||||
|
||||
// Simulate OpenCV definitions taken from various
|
||||
// OpenCV interface headers if G-API is built in a
|
||||
// standalone mode.
|
||||
@ -139,15 +136,6 @@ enum InterpolationFlags{
|
||||
INTER_LINEAR_EXACT = 5,
|
||||
INTER_MAX = 7,
|
||||
};
|
||||
// replacement of cv's structures:
|
||||
namespace gapi { namespace own {
|
||||
class Mat;
|
||||
}} // namespace gapi::own
|
||||
using Rect = gapi::own::Rect;
|
||||
using Size = gapi::own::Size;
|
||||
using Point = gapi::own::Point;
|
||||
using Scalar = gapi::own::Scalar;
|
||||
using Mat = gapi::own::Mat;
|
||||
} // namespace cv
|
||||
|
||||
static inline int cvFloor( double value )
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <memory> //std::shared_ptr
|
||||
#include <cstring> //std::memcpy
|
||||
#include <numeric> //std::accumulate
|
||||
#include <vector>
|
||||
#include <opencv2/gapi/util/throw.hpp>
|
||||
|
||||
namespace cv { namespace gapi { namespace own {
|
||||
|
@ -48,9 +48,9 @@ namespace{
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
cv::GMatDesc cv::descr_of(const cv::Mat &mat)
|
||||
{
|
||||
#if !defined(GAPI_STANDALONE)
|
||||
const auto mat_dims = mat.size.dims();
|
||||
|
||||
if (mat_dims == 2)
|
||||
@ -62,12 +62,8 @@ cv::GMatDesc cv::descr_of(const cv::Mat &mat)
|
||||
dims[i] = mat.size[i];
|
||||
}
|
||||
return GMatDesc{mat.depth(), std::move(dims)};
|
||||
#else
|
||||
return (mat.dims.empty())
|
||||
? GMatDesc{mat.depth(), mat.channels(), {mat.cols, mat.rows}}
|
||||
: GMatDesc{mat.depth(), mat.dims};
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
cv::GMatDesc cv::gapi::own::descr_of(const Mat &mat)
|
||||
{
|
||||
|
@ -46,6 +46,8 @@ const cv::GOrigin& cv::GScalar::priv() const
|
||||
return *m_priv;
|
||||
}
|
||||
|
||||
//N.B. if we ever need more complicated logic for desc_of(cv::(gapi::own::)Scalar)
|
||||
//dispatching should be done in the same way as for cv::(gapi::own)::Mat
|
||||
cv::GScalarDesc cv::descr_of(const cv::Scalar &)
|
||||
{
|
||||
return empty_scalar_desc();
|
||||
|
Loading…
Reference in New Issue
Block a user