Код: Выделить всё
#include "gtest/gtest.h"
#include "onnx_helper.h"
#include "ndarray.h"
#include "opencv_helper.h"
#include "vector_helper.h"
#include
#include
#include
class OnnxHelper2Test : public testing::Test {
protected:
// static void SetUpTestCase() {
// }
};
std::pair handle_input_img(const 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/78487258/in-cpp-extract-code-block-to-meth-cause-sigsegv[/url]