Skip to content

Implementation of the SLIC superpixel algorithm to work with OpenCV2

Notifications You must be signed in to change notification settings

jiawenhao2015/SLIC-superpixel-with-OpenCV

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SLIC Superpixel Modification

We modified the SLICO version of slic algorithm to work with OpenCV2, and make it easy to use.

Class explanation

  • void SLIC::GenerateSuperpixels(cv::Mat& img, UINT numSuperpixels)

    Perform SLIC algorithm on the given image with the given number of superpixels.

    img - 24-bit or 8-bit cv::Mat

    numSuperpixels - an appropriate number, no more than total number of pixels

  • cv::Mat SLIC::GetImgWithContours(cv::Scalar color)

    Get the result image with contours on the given color.

    color - If input image is 24-bit, the color may be cv::Scalar(255, 0, 0) or cv::Scalar(0, 255, 0) or cv::Scalar(0, 0, 255)

    If input image is 8-bit, the color may be cv::Scalar(0) or cv::Scalar(128) or cv::Scalar(255)

  • int* SLIC::GetLabel()

    Get label on each pixel which shows the number of superpixel it belongs to.

Example

  • original image

bird_color.jpg

  • 200 superpixels

bird_color.jpg

  • 500 superpixels

bird_color.jpg

About

Implementation of the SLIC superpixel algorithm to work with OpenCV2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.7%
  • CMake 1.3%