| 711 | } |
| 712 | |
| 713 | std::shared_ptr<Image> Image::CreateHostVector(std::vector<py::buffer> buffers, nvcv::ImageFormat fmt, int rowAlign) |
| 714 | { |
| 715 | std::vector<DLPackTensor> dlTensorList; |
| 716 | |
| 717 | for (size_t i = 0; i < buffers.size(); ++i) |
| 718 | { |
| 719 | dlTensorList.emplace_back(buffers[i].request(), DLDevice{kDLCPU, 0}); |
| 720 | } |
| 721 | |
| 722 | nvcv::ImageDataStridedHost imgData = CreateNVCVImageDataHost(std::move(dlTensorList), fmt); |
| 723 | |
| 724 | // We take this opportunity to remove all wrappers from cache. |
| 725 | // They aren't reusable anyway. |
| 726 | Image::Key key; |
| 727 | Cache::Instance().removeAllNotInUseMatching(key); |
| 728 | |
| 729 | std::shared_ptr<Image> img(new Image(std::move(buffers), imgData, rowAlign)); |
| 730 | Cache::Instance().add(*img); |
| 731 | return img; |
| 732 | } |
| 733 | |
| 734 | Size2D Image::size() const |
| 735 | { |
nothing calls this directly
no test coverage detected