TNN
TNN copied to clipboard
TNN的mat和opencv的mat如何互转呢?
好像没看到太多的example?
好像没看到太多的example?
路过,顺便答一下,👉 https://github.com/DefTruth/lite.ai.toolkit/tree/main/lite/tnn/cv ,这里也写了很多TNN应用的examples哦,基于opencv和tnn。
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);