Skip to content
Snippets Groups Projects
Commit 14ed9577 authored by Thibault Allenet's avatar Thibault Allenet
Browse files

Update Tests_Utils

parent 8c2b45e9
No related branches found
No related tags found
2 merge requests!10Update backend_opencv with modifications from aidge_core,!9Remove dependency of backend CPU and fix CI
Pipeline #39412 failed
......@@ -65,21 +65,17 @@ TEMPLATE_TEST_CASE("Opencv Utils", "[Utils][OpenCV]", signed char, unsigned char
REQUIRE(mat.cols == tensorOcv->dims()[0]);
REQUIRE(mat.channels() == tensorOcv->dims()[2]);
// Check the matrix inside the tensor coorresponds to the matrix
//Get the matrix inside the tensor
TensorImpl_opencv_* tImpl_opencv = dynamic_cast<TensorImpl_opencv_*>(tensorOcv->getImpl().get());
auto mat_tensor = tImpl_opencv->data();
REQUIRE(mat_tensor.size() == mat.size());
REQUIRE(cv::countNonZero(mat_tensor != mat) == 0);
// Convert opencv tensor to cpu tensor
auto tensorCpu = convertCpu(tensorOcv);
// Split the mat from tensor opencv into channels
std::vector<cv::Mat> channels_split;
cv::split(mat_tensor, channels_split);
// Get the ptr to the std::vector<TestType> as a void * with rawPtr()
// Convert opencv tensor to cpu tensor
auto tensorCpu = convertCpu(tensorOcv);
// Get the cpu ptr of the converted tensor
auto cpu_ptr = static_cast<TestType*>(tensorCpu->getImpl()->rawPtr());
// Compare the tensor cpu values with the cv mat in an elementwise fashion
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment