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

Merge branch 'layout' into 'dev'

Fix layout from [H,W,C] to [C,H,W]

See merge request !8
parents 516846ea 60b8533d
No related branches found
No related tags found
2 merge requests!10Update backend_opencv with modifications from aidge_core,!8Fix layout from [H,W,C] to [C,H,W]
Pipeline #39423 passed
......@@ -61,9 +61,9 @@ static Aidge::DataType CVtoAidge(const int matDepth) {
std::shared_ptr<Aidge::Tensor> Aidge::tensorOpencv(cv::Mat mat) {
// Get Mat dims
const std::vector<DimSize_t> matDims = std::vector<DimSize_t>({static_cast<DimSize_t>(mat.cols),
const std::vector<DimSize_t> matDims = std::vector<DimSize_t>({static_cast<DimSize_t>(mat.channels()),
static_cast<DimSize_t>(mat.rows),
static_cast<DimSize_t>(mat.channels())});
static_cast<DimSize_t>(mat.cols)});
// Get the correct Data Type
Aidge::DataType type;
type = CVtoAidge(mat.depth());
......
......@@ -61,9 +61,10 @@ TEMPLATE_TEST_CASE("Opencv Utils", "[Utils][OpenCV]", signed char, unsigned char
auto tensorOcv = tensorOpencv(mat);
// Check the size of the tensor
REQUIRE(mat.channels() == tensorOcv->dims()[0]);
REQUIRE(mat.rows == tensorOcv->dims()[1]);
REQUIRE(mat.cols == tensorOcv->dims()[0]);
REQUIRE(mat.channels() == tensorOcv->dims()[2]);
REQUIRE(mat.cols == tensorOcv->dims()[2]);
//Get the matrix inside the tensor
TensorImpl_opencv_* tImpl_opencv = dynamic_cast<TensorImpl_opencv_*>(tensorOcv->getImpl().get());
......
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