| 76 | } |
| 77 | |
| 78 | ImageBatchVarShape ResizeVarShape(ImageBatchVarShape &input, const std::vector<std::tuple<int, int>> &out_size, |
| 79 | NVCVInterpolationType interp, std::optional<Stream> pstream) |
| 80 | { |
| 81 | if (input.numImages() != (int)out_size.size()) |
| 82 | { |
| 83 | throw std::runtime_error("Number of input images must be equal to the number of elements in output size list "); |
| 84 | } |
| 85 | |
| 86 | ImageBatchVarShape output = ImageBatchVarShape::Create(input.capacity()); |
| 87 | |
| 88 | for (int i = 0; i < input.numImages(); ++i) |
| 89 | { |
| 90 | nvcv::ImageFormat format = input[i].format(); |
| 91 | auto size = out_size[i]; |
| 92 | auto image = Image::Create({std::get<0>(size), std::get<1>(size)}, format); |
| 93 | output.pushBack(image); |
| 94 | } |
| 95 | |
| 96 | return ResizeVarShapeInto(output, input, interp, pstream); |
| 97 | } |
| 98 | |
| 99 | } // namespace |
| 100 | |