Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
superpixel_tools.h
Go to the documentation of this file.
1 
32 #ifndef SUPERPIXEL_TOOLS_H
33 #define SUPERPIXEL_TOOLS_H
34 
35 #include <opencv2/opencv.hpp>
36 
41 public:
47  static int computeRegionSizeFromSuperpixels(const cv::Mat &image, int superpixels);
48 
55  static void computeHeightWidthFromSuperpixels(const cv::Mat &image,
56  int superpixels, int &height, int &width);
57 
65  static void computeHeightWidthLevelsFromSuperpixels(const cv::Mat &image,
66  int superpixels, int &height, int &width, int &levels);
67 
74  static void computeRegionSizeLevels(const cv::Mat &image,
75  int superpixels, int &region_size, int &levels);
76 
80  static void relabelSuperpixels(cv::Mat &labels);
81 
90  static void computeLabelsFromBoundaries(const cv::Mat &image, const cv::Mat &boundaries,
91  cv::Mat &labels, int BOUNDARY_VALUE = -1, int INNER_VALUE = -2);
92 
99  static void assignBoundariesToSuperpixels(const cv::Mat &image,
100  const cv::Mat &boundaries, cv::Mat &labels, int BOUNDARY_VALUE = -1);
101 
106  static int countSuperpixels(const cv::Mat &labels);
107 
111  static int relabelConnectedSuperpixels(cv::Mat &labels);
112 
120  static int enforceMinimumSuperpixelSize(const cv::Mat &image, cv::Mat &labels,
121  int size);
122 
130  static int enforceMinimumSuperpixelSizeUpTo(const cv::Mat &image, cv::Mat &labels,
131  int number);
132 
133 };
134 
135 #endif /* SUPERPIXEL_TOOLS_H */
136 
static int relabelConnectedSuperpixels(cv::Mat &labels)
Relabel superpixels based on connected components.
Definition: superpixel_tools.cpp:517
static int enforceMinimumSuperpixelSizeUpTo(const cv::Mat &image, cv::Mat &labels, int number)
Enforce the minimum segment size by merging small superpixels with similar neighboring superpixels su...
Definition: superpixel_tools.cpp:661
static int countSuperpixels(const cv::Mat &labels)
Count number of superpixels.
Definition: superpixel_tools.cpp:486
static void computeRegionSizeLevels(const cv::Mat &image, int superpixels, int &region_size, int &levels)
Compute region size and levels for the given number of superpixels.
Definition: superpixel_tools.cpp:63
static void relabelSuperpixels(cv::Mat &labels)
Relabel superpixel segmentation.
Definition: superpixel_tools.cpp:135
static void computeHeightWidthLevelsFromSuperpixels(const cv::Mat &image, int superpixels, int &height, int &width, int &levels)
Compute width, height and levels for the given number of superpixels.
Definition: superpixel_tools.cpp:95
static void assignBoundariesToSuperpixels(const cv::Mat &image, const cv::Mat &boundaries, cv::Mat &labels, int BOUNDARY_VALUE=-1)
Assigns boundary pixels (indicated by -1) to the nearest superpixel (indicated by labels >= 0)...
Definition: superpixel_tools.cpp:346
static int enforceMinimumSuperpixelSize(const cv::Mat &image, cv::Mat &labels, int size)
Enforce the minimum segment size by merging small superpixels with similar neighboring superpixels...
Definition: superpixel_tools.cpp:551
Superpixel utilities.
Definition: superpixel_tools.h:40
static void computeHeightWidthFromSuperpixels(const cv::Mat &image, int superpixels, int &height, int &width)
Compute width and height for the given number of superpixels.
Definition: superpixel_tools.cpp:51
static void computeLabelsFromBoundaries(const cv::Mat &image, const cv::Mat &boundaries, cv::Mat &labels, int BOUNDARY_VALUE=-1, int INNER_VALUE=-2)
Compute label map from boundaries by assigning boundary pixels to the nearest superpixel and flooding...
Definition: superpixel_tools.cpp:176
static int computeRegionSizeFromSuperpixels(const cv::Mat &image, int superpixels)
Compute region size from desired number of superpixels.
Definition: superpixel_tools.cpp:40