Stack an image with CVCUDA.
()
| 29 | |
| 30 | |
| 31 | def main() -> None: |
| 32 | """Stack an image with CVCUDA.""" |
| 33 | # docs_tag: begin_main |
| 34 | args: argparse.Namespace = parse_image_args() |
| 35 | # docs_tag: begin_read_image |
| 36 | input_image: cvcuda.Tensor = read_image(args.input) |
| 37 | height, width, channels = input_image.shape |
| 38 | # docs_tag: end_read_image |
| 39 | |
| 40 | # docs_tag: begin_stack |
| 41 | # 1. Generate all the images |
| 42 | # We will simply use the same image for all to do the stack operation |
| 43 | # in the real world, you would have different images/data to stack |
| 44 | images: list[cvcuda.Tensor] = [input_image] * 3 |
| 45 | |
| 46 | # 2. Perform a stack operation on the images |
| 47 | stacked_images: cvcuda.Tensor = cvcuda.stack(images) |
| 48 | assert stacked_images.shape == (3, height, width, channels) |
| 49 | # docs_tag: end_stack |
| 50 | # docs_tag: end_main |
| 51 | |
| 52 | |
| 53 | if __name__ == "__main__": |
no test coverage detected