Home

Awesome

Salient Region Detection and Segmentation for Python Using CImg

This is an UNIX platform oriented version of Salient Region Detection and Segmentation technique represented in:

R. Achanta, S. Hemami, F. Estrada and S. Süsstrunk, Frequency-tuned Salient Region Detection, IEEE International Conference on Computer Vision and Pattern Recognition (CVPR 2009), pp. 1597 - 1604, 2009.

Check also the webpage for the paper. Most of the code is unaltered from the C++ sources given on the webpage.

The differences are:

Dependencies

The conversion has been done with minimum amount of work so any input and/or change suggestions are welcome.

Usage

  1. As Command line tool:

    1.1 Compile program with make

    1.2 Call the program created:

    $>./saliency [-s] [-o=path/to/outfolder/] path/to/pic1 path/to/pic2 path/to/pic3 ...

    where optional '-s' argument tells the program to not only do saliency mapping, but also mean shift based processing and extracting the most salient objects from the pictures.

  2. From Python:

    2.1 Compile program as shared library with make shared_osx or make shared_linux

    2.2 Instantiate SDRWrapper object in Python and call it:

    from sdrWrapper import SDRWrapper
    sdrw = SDRWrapper()
    doSegmentation = True # Extract most salient objects
    sdrw.saliency("path/to/outfolder", "path/to/my/pic", doSegmentation)
    

Created pictures are saved with different suffixes. For example, running code for bird.jpg will create three different files to the output folder when most salient objects are extracted: