| 465 | } |
| 466 | |
| 467 | ImageBatchVarShape VarShapeHQResize(ImageBatchVarShape &src, const std::vector<std::tuple<int, int>> &outShape, |
| 468 | std::optional<bool> antialias, const std::optional<Rois> &roi, |
| 469 | std::optional<NVCVInterpolationType> interpolation, |
| 470 | std::optional<NVCVInterpolationType> minInterpolation, |
| 471 | std::optional<NVCVInterpolationType> magInterpolation, |
| 472 | std::optional<Stream> pstream) |
| 473 | { |
| 474 | ImageBatchVarShape out = ImageBatchVarShape::Create(src.capacity()); |
| 475 | |
| 476 | int32_t numOutSizes = outShape.size(); |
| 477 | if (numOutSizes != src.numImages() && numOutSizes != 1) |
| 478 | { |
| 479 | throw std::runtime_error( |
| 480 | "The list of output shapes `out_size` must either contain a single shape to be used for all output images " |
| 481 | "or its length must match the number of input samples."); |
| 482 | } |
| 483 | |
| 484 | for (int i = 0; i < src.numImages(); ++i) |
| 485 | { |
| 486 | auto size = outShape[numOutSizes == 1 ? 0 : i]; |
| 487 | auto image = Image::Create({std::get<1>(size), std::get<0>(size)}, src[i].format()); |
| 488 | out.pushBack(image); |
| 489 | } |
| 490 | |
| 491 | return VarShapeHQResizeInto(out, src, antialias, roi, interpolation, minInterpolation, magInterpolation, pstream); |
| 492 | } |
| 493 | |
| 494 | TensorBatch TensorBatchHQResizeInto(TensorBatch &dst, const TensorBatch &src, std::optional<bool> antialias, |
| 495 | const std::optional<Rois> &roi, std::optional<NVCVInterpolationType> interpolation, |