Back to Mnn

MNN: include/ImageProcess.hpp 源文件

doc/API/html/_image_process_8hpp_source.html

3.5.010.8 KB
Original Source

| MNN 1.0 |

ImageProcess.hpp

浏览该文件的文档.

1 //

2 // ImageProcess.hpp

3 // MNN

4 //

5 // Created by MNN on 2018/09/19.

6 // Copyright © 2018, Alibaba Group Holding Limited

7 //

8

9 #ifndef ImageProcess_hpp

10 #define ImageProcess_hpp

11

12 #include "ErrorCode.hpp"

13 #include "Matrix.h"

14 #include "Tensor.hpp"

15

16 namespace MNN {

17 namespace CV {

18 enum ImageFormat {

19RGBA = 0,

20RGB,

21BGR,

22GRAY,

23BGRA,

24YUV_NV21 = 11,

25 };

26

27 enum Filter { NEAREST = 0, BILINEAR = 1, BICUBIC = 2 };

28

29 enum Wrap { CLAMP_TO_EDGE = 0, ZERO = 1, REPEAT = 2 };

30

38 class MNN_PUBLIC ImageProcess {

39 public:

40struct Inside;

41struct Config {

43Filter filterType = NEAREST;

45ImageFormat sourceFormat = RGBA;

47ImageFormat destFormat = RGBA;

48

49// Only valid if the dest type is float

50float mean[4] = {0.0f, 0.0f, 0.0f, 0.0f};

51float normal[4] = {1.0f, 1.0f, 1.0f, 1.0f};

52

54Wrap wrap = CLAMP_TO_EDGE;

55 };

56

57 public:

64static ImageProcess* create(const Config& config, const Tensor* dstTensor = nullptr);

65

77static ImageProcess* create(const ImageFormat sourceFormat = RGBA, const ImageFormat destFormat = RGBA,

78const float* means = nullptr, const int meanCount = 0, const float* normals = nullptr,

79const int normalCount = 0, const Tensor* dstTensor = nullptr);

80

81 ~ImageProcess();

82

87inline const Matrix& matrix() const {

88return mTransform;

89 }

90void setMatrix(const Matrix& matrix);

91

101ErrorCode convert(const uint8_t* source, int iw, int ih, int stride, Tensor* dest);

102

111template <typename T>

112static Tensor* createImageTensor(int w, int h, int bpp, void* p = nullptr) {

113return createImageTensor(halide_type_of<T>(), w, h, bpp, p);

114 }

115static Tensor* createImageTensor([halide_type_t](structhalide type t.html) type, int w, int h, int bpp, void* p = nullptr);

116

117 private:

118ImageProcess(const Config& config);

119Matrix mTransform;

120Matrix mTransformInvert;

121 Inside* mInside;

122 };

123 } // namespace CV

124 } // namespace MNN

125

126 #endif /* ImageProcess_hpp */

MNN::CV::Filter

Filter

Definition: ImageProcess.hpp:27

MNN::CV::ImageProcess

Definition: ImageProcess.hpp:38

MNN::CV::BGR

Definition: ImageProcess.hpp:21

MNN::CV::GRAY

Definition: ImageProcess.hpp:22

ErrorCode.hpp

MNN::CV::YUV_NV21

Definition: ImageProcess.hpp:24

Matrix.h

MNN::CV::CLAMP_TO_EDGE

Definition: ImageProcess.hpp:29

MNN::CV::Wrap

Wrap

Definition: ImageProcess.hpp:29

MNN::CV::REPEAT

Definition: ImageProcess.hpp:29

MNN::CV::ImageProcess::createImageTensor

static Tensor * createImageTensor(int w, int h, int bpp, void *p=nullptr)

create tensor with given data.

Definition: ImageProcess.hpp:112

MNN::CV::NEAREST

Definition: ImageProcess.hpp:27

MNN::Tensor

Definition: Tensor.hpp:25

MNN::CV::BILINEAR

Definition: ImageProcess.hpp:27

MNN_PUBLIC

#define MNN_PUBLIC

Definition: MNNDefine.h:53

MNN::CV::Matrix

Definition: Matrix.h:48

[halide_type_t](structhalide type t.html)

Definition: HalideRuntime.h:82

MNN

Definition: AutoTime.hpp:16

MNN::CV::RGB

Definition: ImageProcess.hpp:20

MNN::CV::ImageProcess::Config

Definition: ImageProcess.hpp:41

MNN::CV::ZERO

Definition: ImageProcess.hpp:29

Tensor.hpp

MNN::CV::RGBA

Definition: ImageProcess.hpp:19

MNN::CV::BGRA

Definition: ImageProcess.hpp:23

MNN::ErrorCode

ErrorCode

Definition: ErrorCode.hpp:13

MNN::CV::ImageFormat

ImageFormat

Definition: ImageProcess.hpp:18

MNN::CV::BICUBIC

Definition: ImageProcess.hpp:27

MNN::CV::ImageProcess::matrix

const Matrix & matrix() const

get affine transform matrix.

Definition: ImageProcess.hpp:87


制作者 1.8.15