This project demonstrates Labeling and Compression of Image Regions using the Nvidia Performance Primitives (NPP+) library. It efficiently labels connected regions in images and compresses the labels for optimized processing. This is especially useful for processing large batches of images in GPU-accelerated environments.
- Image Region Labeling: Identifies connected regions in an image and assigns labels to each region.
- Label Compression: Compresses labeled regions to optimize memory usage and performance, reducing redundancy in the labeled regions.
This example is optimized for the following Nvidia GPU architectures:
- Linux
- Windows
- x86_64
To use this example, first download and install the latest version of NPP+ on your Nvidia GPU-equipped machine:
This example leverages key functions from the NPP+ library for efficient image processing on Nvidia GPUs.
This project includes the following components:
- Labeling Connected Image Regions: Labels all connected regions in an image.
- Compression of Labeled Regions: Compresses the labeled regions for efficient memory usage and faster processing.
Before building and running the example, ensure that your system meets the following requirements:
- A Linux or Windows system with an Nvidia GPU.
- The latest NVIDIA drivers installed.
- CUDA 12.0 Toolkit and above installed.
$ mkdir build
$ cd build
$ cmake .. -DNPP_PLUS_PATH=/usr/lib/x86_64-linux-gnu
$ make
$ mkdir build
$ cd build
$ cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..
$ Open findContour.sln project in Visual Studio 15 2017 and build
./batchedLabelMarkersAndCompression -h
Usage: ./batchedLabelMarkersAndCompression [-b number-of-batch]
Parameters:
number-of-batch : Use number of batch to process [default 5]
Sample Output:
$ ./batchedLabelMarkersAndCompression -b 5
./batchedLabelMarkersAndCompression
NPP Library Version 0.9.0 CUDA Driver Version: 12.7 CUDA Runtime Version: 12.6
Input file load succeeded. Lena_CompressedMarkerLabelsUF_8Way_512x512_32u succeeded, compressed label count is 572. Input file load succeeded. CT_Skull_CompressedMarkerLabelsUF_8Way_512x512_32u succeeded, compressed label count is 434. Input file load succeeded. PCB_METAL_CompressedMarkerLabelsUF_8Way_509x335_32u succeeded, compressed label count is 3733. Input file load succeeded. PCB2_CompressedMarkerLabelsUF_8Way_1024x683_32u succeeded, compressed label count is 1272. Input file load succeeded. PCB_CompressedMarkerLabelsUF_8Way_1280x720_32u succeeded, compressed label count is 1468.