MCPcopy Create free account
hub / github.com/alibaba/MNN / run

Method run

test/cv/ImageProcessTest.cpp:123–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121public:
122 virtual ~ImageProcessGrayToGrayTest() = default;
123 virtual bool run(int precision) {
124 int w = 27, h = 1, size = w * h;
125 auto integers = genSourceData(h, w, 1);
126 std::vector<float> floats(size * 4);
127 std::shared_ptr<MNN::Tensor> tensor(
128 MNN::Tensor::create<float>(std::vector<int>{1, 1, h, w}, floats.data(), Tensor::CAFFE_C4));
129
130 ImageProcess::Config config;
131 config.sourceFormat = GRAY;
132 config.destFormat = GRAY;
133 std::shared_ptr<ImageProcess> process(ImageProcess::create(config));
134 process->convert(integers.data(), w, h, 0, tensor.get());
135 for (int i = 0; i < floats.size() / 4; ++i) {
136 int s = floats[4 * i + 0];
137 if (s != integers[i]) {
138 MNN_ERROR("Error for turn gray to float:%d, %d -> %f\n", i, integers[i], floats[4 * i]);
139 return false;
140 }
141 }
142 return true;
143 }
144};
145MNNTestSuiteRegister(ImageProcessGrayToGrayTest, "cv/image_process/gray_to_gray");
146

Callers

nothing calls this directly

Calls 6

genSourceDataFunction · 0.85
createFunction · 0.50
dataMethod · 0.45
convertMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected