Skip to content

Latest commit

 

History

History

README.md

🧮 Image Euclidean Distance Transform (EDT) using NVIDIA NPP

This repository demonstrates how to use the NVIDIA Performance Primitives (NPP) library to compute Euclidean distance transforms and Voronoi diagrams on grayscale images using the GPU.


📌 Overview

This example loads raw .raw grayscale images, performs the following operations using NPP:

  • Truncated Euclidean Distance Transform (EDT)
  • True (floating-point) Distance Transform
  • Voronoi Diagram Generation

The results are saved as output raw files, and CUDA streams are used for efficient execution.


🚀 Features

  • GPU-accelerated distance transform using nppiDistanceTransformPBA_* functions
  • Support for multiple output types: 16u, 32f, 16s
  • Batch processing and stream-based execution
  • Demonstrates use of NppStreamContext

📷 Example Output

Input Image

Dolphin1_313x317_8u.raw
Input Image

Distance Transform

DistanceTransformTrue_Dolphin1_319x319_16u.raw
Distance Transform


🧠 Key Concepts

  • GPU Image Processing
  • Distance Transform
  • Voronoi Diagrams
  • CUDA Streams
  • Raw Image Format Handling

💻 Supported Platforms

Category Support
GPU Architectures SM 7.5, SM 8.0 and Above
OS Linux, Windows
CPU Architecture x86_64
CUDA Toolkit Requires CUDA 11.2+

🛠️ Build Instructions

Linux

$ mkdir build
$ cd build
$ cmake ..
$ make

Windows

$ mkdir build
$ cd build
$ cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..
# Open distanceTransform.sln in Visual Studio and build

▶️ Run Instructions

./distanceTransform

Expected Output:

NPP Library Version 12.4.0
CUDA Driver  Version: 12.9
CUDA Runtime Version: 12.9

Input file load succeeded.
Input file load succeeded.
Done!


📦 Dependencies


🧾 License

This sample is released under the NVIDIA Software License Agreement. Refer to the LICENSE file for more details.