Skip to content

Latest commit

 

History

History

watershedSegmentation

Folders and files

README.md

Watershed Image Segmentation with NPP

Overview

This project demonstrates grayscale image segmentation using the watershed algorithm implemented through NVIDIA’s NPP library. The technique is based on the GPU-accelerated approach detailed in the paper:

"Efficient 2D and 3D Watershed on Graphics Processing Unit: Block-Asynchronous Approaches Based on Cellular Automata" by Pablo Quesada-Barriuso et al.

Key Concepts

  • Image Segmentation
  • Watershed Transform
  • NPP (NVIDIA Performance Primitives)

Supported Platforms


Build Instructions

Linux

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

Windows

$ mkdir build
$ cd build
$ cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..
# Open the generated `watershedSegmentation.sln` in Visual Studio 2017 and build the solution

Usage

./watershedSegmentation [-b number-of-batch]

Parameters

  • -b <number>: Number of images to process in a batch (default is 3).

Example

./watershedSegmentation -b 3

Output Log

Processed Lena_512x512_8u_Gray.raw
Processed CT_skull_512x512_8u_Gray.raw
Processed Rocks_512x512_8u_Gray.raw
Processed coins_500x383_8u_Gray.raw
Processed coins_overlay_500x569_8u_Gray.raw


Credits

  • Sample provided by NVIDIA Corporation.
  • Based on academic work cited above.

NPP workspace (CUDA 13.4)

This sample includes nppworkspace.h: the single workspace's high-water-mark scratch buffer is shared by all five images (they have different sizes), replacing a per-image GetBufferSize + cudaMalloc.