TNN icon indicating copy to clipboard operation
TNN copied to clipboard

TNN的mat和opencv的mat如何互转呢?

Open HongChow opened this issue 3 years ago • 2 comments

好像没看到太多的example?

HongChow avatar Jan 24 '22 01:01 HongChow

好像没看到太多的example?

路过,顺便答一下,👉 https://github.com/DefTruth/lite.ai.toolkit/tree/main/lite/tnn/cv ,这里也写了很多TNN应用的examples哦,基于opencv和tnn。

DefTruth avatar Jan 24 '22 04:01 DefTruth

cv::Mat mat_rs; cv::resize(mat, mat_rs, cv::Size(input_width, input_height)); cv::cvtColor(mat_rs, mat_rs, cv::COLOR_BGR2RGB); // push into input_mat (1,3,224,224) input_mat = std::make_sharedtnn::Mat(input_device_type, tnn::N8UC3, input_shape, (void *) mat_rs.data);

ouclbc avatar Feb 08 '22 02:02 ouclbc