| 28 | namespace nvcv::priv { |
| 29 | |
| 30 | NVCVTensorLayout GetTensorLayoutFor(ImageFormat fmt, int nbatches) |
| 31 | { |
| 32 | (void)nbatches; |
| 33 | |
| 34 | int nplanes = fmt.numPlanes(); |
| 35 | |
| 36 | if (nplanes == 1) |
| 37 | { |
| 38 | return NVCV_TENSOR_NHWC; |
| 39 | } |
| 40 | else if (nplanes == fmt.numChannels()) |
| 41 | { |
| 42 | return NVCV_TENSOR_NCHW; |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | throw Exception(NVCV_ERROR_INVALID_ARGUMENT) << "Image format cannot be semi-planar, but it is: " << fmt; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void FillTensorData(IImage &img, NVCVTensorData &tensorData) |
| 51 | { |
no test coverage detected