Skip to content

Latest commit

 

History

History

README.md

Find Contour using NVIDIA NPP

Overview

This sample demonstrates how to detect and extract contours from an image using NVIDIA’s NPP library. It performs unified labeling, label compression, and geometric contour reconstruction on grayscale input images.

Key Concepts

  • Unified Framework (UF) Labeling
  • Connected Component Analysis
  • Image Contour Extraction using CUDA/NPP

Requirements


Build Instructions

Linux

mkdir build
cd build
cmake ..
make

Windows

mkdir build
cd build
cmake -DCMAKE_GENERATOR_PLATFORM=x64 ..

Then open findContour.sln in Visual Studio (2017 or later) and build the solution.


Usage

./findContour

Example Output:

./build/findContour 
Done. Compressed Labels: 274

Input & Output

Input Image

  • CircuitBoard_2048x1024_8u.raw
  • Format: 8-bit unsigned grayscale
  • Dimensions: 2048 x 1024

Input Image


Output Visualizations

1. Label Markers (UF-based)

  • File: CircuitBoard_LabelMarkersUF_8Way_2048x1024_32u.raw
  • Generated by: nppiLabelMarkersUF_8u32u_C1R_Ctx

Label Markers


2. Compressed Labels

  • File: CircuitBoard_CompressedMarkerLabelsUF_8Way_2048x1024_32u.raw
  • Generated by: nppiCompressMarkerLabelsUF_32u_C1IR_Ctx

Compressed Labels


3. Contour Pixels

  • File: CircuitBoard_Contours_8Way_2048x1024_8u.raw
  • Generated by: nppiCompressedMarkerLabelsUFInfo_32u_C1R_Ctx

Contours


4. Reconstructed Contours (Ordered Geometry)

  • File: CircuitBoard_ContoursReconstructed_8Way_2048x1024_8u.raw
  • Generated by: nppiCompressedMarkerLabelsUFContoursOutputGeometryLists_C1R

Reconstructed Contours