Skip to content

Reupload and updated code for Efficient and Effective Automated Digital Hair Removal from Dermoscopy Images by collective of authors from 2016. Code has been updated so it runs on windows and CUDA 13.x An example usage of how to use it with python added.

License

Notifications You must be signed in to change notification settings

HiDPICoder/2016HairRemovalAlgorithm

Repository files navigation

Digital Hair Removal by Threshold Decomposition

(c) Joost Koehoorn, Alex Telea, Univ. of Groningen, 2014

Updated in 2026

====================================================================================================================

This software package implements the digital hair removal algorithm using CUDA and the Parallel Banding Algorithm and AFMM
for fast skeletonization and morphological erosion/dilation.

1. Building
===========
Windows:
Download CMake.
Download Visual Studio.
Install Desktop development with C++.
Install Cuda toolkit.
Open CMake Gui put in source path, put in output path.
Click Configure.
Click Generate.
Click Open Project.
Right click on hairrazor project and click build.
Locate the exe and you can run it now.

Linux:
Install Cuda toolkit.
Ensure your os sees your nvidia drive. Enrolling moik key should be enough to make it visible.
Copy main.cpp from Original Code folder to Code folder.
Configure Makefile with your cuda architecture modify line 46: -gencode arch=compute_61,code=sm_61 \
Afterwards for Linux mint it was enough to just call Makefile.

Note 1: For Cuda version 11.5 you can simply build Original Code.
Note 2: You might have to tinker with source code to get it working on linux machine.
2. Running
==========

Single image
------------

./hairrazor [options]

    Option  Arg     Default  Description
    ------------------------------------------------------------------
    -f      path             Input PPM file, required.
    -w      0..3    3        0 = original, 1 = inverted, 2 = combined, 3 = likeliest.

    -p      [0,1]   0.05     Skeleton prune as percentage from boundary.
    -b      [1,..)  3        Minimum prune parameter.
    -B      [1,..)  40       Maximum prune parameter.

    -s      [0,1]   0.2      Percentage of longest branch to require as minimal branch length.
    -d      [1,..)  20       Minimum bound on branch length.
    -D      [1,..)  30       Maximum bound on branch length.

    -J      [0,1]   0.1      Maximum junction ratio.
    -S      [1,..)  2        Skeletonization simplification level.
    -r      [1,..)  5        Radius used for opening/closings.
    -l      [0,1]   0.2      Lambda, 0 = open-close, 1 = close-open, in-between for linear combination.

    -o      path             Output directory.
    -v                       Verbose, output information.

The input image must be provided in PPM format. The output file is written into ./output/inpainted.ppm alongside various
intermediate images, however using `-o path` a different output path can be given. When compiled with GUI support, provide
`-g` to open a GUI where parameters may be changed interactively.

About

Reupload and updated code for Efficient and Effective Automated Digital Hair Removal from Dermoscopy Images by collective of authors from 2016. Code has been updated so it runs on windows and CUDA 13.x An example usage of how to use it with python added.

Topics

Resources

License

Stars

Watchers

Forks

Contributors