| 203 | } |
| 204 | |
| 205 | void ImageBatchVarShape::Export(py::module &m) |
| 206 | { |
| 207 | using namespace py::literals; |
| 208 | |
| 209 | py::class_<ImageBatchVarShape, std::shared_ptr<ImageBatchVarShape>, Container>(m, "ImageBatchVarShape", |
| 210 | "Batch of Images.") |
| 211 | .def(py::init(&ImageBatchVarShape::Create), "capacity"_a, |
| 212 | "Create a new ImageBatchVarShape object with the specified capacity.") |
| 213 | .def_property_readonly("uniqueformat", &ImageBatchVarShape::uniqueFormat, |
| 214 | "Return True if all the images have the same format, False otherwise.") |
| 215 | .def_property_readonly("maxsize", &ImageBatchVarShape::maxSize, |
| 216 | "Return the maximum size of the ImageBatchVarShape in bytes.") |
| 217 | .def_property_readonly("capacity", &ImageBatchVarShape::capacity, |
| 218 | "Return the capacity of the ImageBatchVarShape in number of images.") |
| 219 | .def("__len__", &ImageBatchVarShape::numImages, "Return the number of images in the ImageBatchVarShape.") |
| 220 | .def( |
| 221 | "__iter__", [](const ImageBatchVarShape &list) { return py::make_iterator(list); }, |
| 222 | "Return an iterator over the images in the ImageBatchVarShape.") |
| 223 | .def("pushback", &ImageBatchVarShape::pushBack, "Add a new image to the end of the ImageBatchVarShape.") |
| 224 | .def("pushback", &ImageBatchVarShape::pushBackMany, "Add multiple images to the end of the ImageBatchVarShape.") |
| 225 | .def("popback", &ImageBatchVarShape::popBack, "count"_a = 1, |
| 226 | "Remove one or more images from the end of the ImageBatchVarShape.") |
| 227 | .def("clear", &ImageBatchVarShape::clear, "Remove all images from the ImageBatchVarShape."); |
| 228 | |
| 229 | m.def("as_images", &ImageBatchVarShape::WrapExternalBufferVector, py::arg_v("buffers", std::vector<py::object>{}), |
| 230 | "format"_a = nvcv::FMT_NONE, py::keep_alive<0, 1>(), |
| 231 | "Wrap a vector of external buffers as a batch of images, and tie the buffers lifetime to it"); |
| 232 | } |
| 233 | |
| 234 | } // namespace nvcvpy::priv |
nothing calls this directly
no outgoing calls
no test coverage detected