Программы на C++. Форум разработчиков
Anonymous
Как в cpp исправить ошибку «использование удаленной функции Ort::Value::Value(const Ort::Value&)»
Сообщение
Anonymous » 20 май 2024, 18:38
Я использую следующий код
Код: Выделить всё
const Ort::Value &img_file_to_tensor(std::string input_img_path) {
// Load the image using OpenCV
cv::Mat input_mat = cv::imread(input_img_path);
// Convert to float
cv::cvtColor(input_mat, input_mat, cv::COLOR_BGR2RGB);
input_mat.convertTo(input_mat, CV_32F);
// Normalize
input_mat /= 255.0;
// Convert the preprocessed image to a vector of floats
Ndarray input_img = mat_to_ndarray(input_mat);
// std::string r = xarr_to_str(xa);
input_img.transpose({2, 0, 1});
// const std::string &xa_str1 = xarr_to_str(xa);
// std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78507510/in-cpp-what-is-way-to-fix-err-use-of-deleted-function-ortvaluevalueconst[/url]
1716219482
Anonymous
Я использую следующий код [code]const Ort::Value &img_file_to_tensor(std::string input_img_path) { // Load the image using OpenCV cv::Mat input_mat = cv::imread(input_img_path); // Convert to float cv::cvtColor(input_mat, input_mat, cv::COLOR_BGR2RGB); input_mat.convertTo(input_mat, CV_32F); // Normalize input_mat /= 255.0; // Convert the preprocessed image to a vector of floats Ndarray input_img = mat_to_ndarray(input_mat); // std::string r = xarr_to_str(xa); input_img.transpose({2, 0, 1}); // const std::string &xa_str1 = xarr_to_str(xa); // std::cout Подробнее здесь: [url]https://stackoverflow.com/questions/78507510/in-cpp-what-is-way-to-fix-err-use-of-deleted-function-ortvaluevalueconst[/url]