37 if (nav->getShape().size() < 3)
40 __PRETTY_FUNCTION__,
"The size of an NDArray does not match.", nav->getPath());
42 auto dims = nav->getShape();
44 cv::Mat
ret(std::vector<int>({dims.begin(), std::prev(dims.end())}),
45 std::stoi(nav->getType()));
46 auto size = std::accumulate(std::begin(dims), std::end(dims), 1, std::multiplies<int>());
47 memcpy(
reinterpret_cast<unsigned char*
>(
ret.data), nav->getData(), size);
54 std::vector<int> dims;
55 for (
int i = 0; i < mat.dims; ++i)
57 dims.push_back(mat.size[i]);
59 dims.push_back(mat.elemSize());
61 auto ret = std::make_shared<data::NDArray>(p);
64 ret->setData(std::accumulate(std::begin(dims), std::end(dims), 1, std::multiplies<int>()),
65 reinterpret_cast<const unsigned char*
>(mat.data));