nndeploy C++ API  0.2.0
nndeploy C++ API
opencv_convert.h
Go to the documentation of this file.
1 #ifndef _NNDEPLOY_PREPROCESS_OPENCV_CONVERT_H_
2 #define _NNDEPLOY_PREPROCESS_OPENCV_CONVERT_H_
3 
4 #include "nndeploy/base/any.h"
5 #include "nndeploy/base/common.h"
7 #include "nndeploy/base/log.h"
8 #include "nndeploy/base/macro.h"
9 #include "nndeploy/base/object.h"
11 #include "nndeploy/base/status.h"
12 #include "nndeploy/base/string.h"
13 #include "nndeploy/dag/edge.h"
14 #include "nndeploy/dag/node.h"
15 #include "nndeploy/device/buffer.h"
16 #include "nndeploy/device/device.h"
18 #include "nndeploy/device/tensor.h"
20 
21 namespace nndeploy {
22 namespace preprocess {
23 
25  public:
27 
29 
31 
32  static cv::Scalar convertFromScalar(const base::Scalar2d &src);
33 
35 
48  static bool normalize(const cv::Mat &src, cv::Mat &dst,
49  base::DataType data_type, float *scale, float *mean,
50  float *std);
51 
58  static bool convertToTensor(const cv::Mat &src, device::Tensor *dst,
59  bool normalize, float *scale, float *mean,
60  float *std);
61  static bool convertToBatchTensor(const cv::Mat &src, device::Tensor *dst,
62  bool normalize, float *scale, float *mean,
63  float *std, int batch);
64 };
65 
66 } // namespace preprocess
67 } // namespace nndeploy
68 
69 #endif
Template class for a 4-element vector. Scalar_ and Scalar can be used just as typical 4-element vecto...
Definition: type.h:421
Tensorē±»
Definition: tensor.h:26
static int convertFromDataType(base::DataType src)
static bool convertToBatchTensor(const cv::Mat &src, device::Tensor *dst, bool normalize, float *scale, float *mean, float *std, int batch)
static bool convertToTensor(const cv::Mat &src, device::Tensor *dst, bool normalize, float *scale, float *mean, float *std)
cast + normalize + premute
static cv::Scalar convertFromScalar(const base::Scalar2d &src)
static int convertFromBorderType(base::BorderType src)
static bool normalize(const cv::Mat &src, cv::Mat &dst, base::DataType data_type, float *scale, float *mean, float *std)
static int convertFromInterpType(base::InterpType src)
static int convertFromCvtColorType(base::CvtColorType src)
#define NNDEPLOY_CC_API
api
Definition: macro.h:29