Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
evaluation.h
Go to the documentation of this file.
1 
32 #ifndef EVALUATION_H
33 #define EVALUATION_H
34 
35 #include "io_util.h"
36 
40 class Evaluation {
41  friend class Visualization;
42 public:
51  static float computeUndersegmentationError(const cv::Mat &labels,
52  const cv::Mat &gt);
53 
63  static float computeOversegmentationError(const cv::Mat &labels,
64  const cv::Mat &gt);
65 
82  static float computeBoundaryRecall(const cv::Mat &labels,
83  const cv::Mat &gt, float d = 0.0025);
84 
101  static float computeBoundaryPrecision(const cv::Mat &labels,
102  const cv::Mat &gt, float d = 0.0025);
103 
109  static float computeExplainedVariation(const cv::Mat &labels, const cv::Mat &image);
110 
119  static float computeNPUndersegmentationError(const cv::Mat &labels,
120  const cv::Mat &gt);
121 
130  static float computeLevinUndersegmentationError(const cv::Mat &labels,
131  const cv::Mat &gt);
132 
143  static float computeAchievableSegmentationAccuracy(const cv::Mat &labels,
144  const cv::Mat &gt);
145 
151  static float computeSumOfSquaredErrorRGB(const cv::Mat &labels,
152  const cv::Mat &image);
153 
159  static float computeSumOfSquaredErrorXY(const cv::Mat &labels,
160  const cv::Mat &image);
161 
174  static float computeMeanDistanceToEdge(const cv::Mat &labels,
175  const cv::Mat &gt);
176 
183  static float computeIntraClusterVariation(const cv::Mat &labels,
184  const cv::Mat &image);
185 
195  static float computeCompactness(const cv::Mat &labels);
196 
207  static float computeContourDensity(const cv::Mat &labels);
208 
216  static float computeRegularity(const cv::Mat &labels);
217 
223  static int computeSuperpixels(const cv::Mat &labels);
224 
232  static void computeSuperpixelSizes(const cv::Mat &labels, float &average_size,
233  int &min_size, int &max_size, float &size_variation);
234 
241  static float computeEdgeRecall(const cv::Mat &labels, const cv::Mat &edges,
242  float d = 0.0025);
243 
252  static float computeAverageMetric(const std::vector<float>& values, const std::vector<float>& superpixels,
253  int min_superpixels = 200, int max_superpixels = 5200);
254 
255 private:
260  static void computeBoundingBoxes(const cv::Mat &labels, std::vector<cv::Rect> &rectangles);
261 
271  static void computeIntersectionMatrix(const cv::Mat &labels, const cv::Mat &gt,
272  cv::Mat &intersection_matrix, std::vector<int> &superpixel_sizes, std::vector<int> &gt_sizes);
273 
280  static bool is4ConnectedBoundaryPixel(const cv::Mat &labels, int i, int j);
281 
288  static bool is8Minus4ConnectedBoundaryPixel(const cv::Mat &labels, int i, int j);
289 
290 };
291 
292 #endif /* EVALUATION_H */
static float computeBoundaryPrecision(const cv::Mat &labels, const cv::Mat &gt, float d=0.0025)
Compute boundary precision:
Definition: evaluation.cpp:89
static float computeCompactness(const cv::Mat &labels)
Compute Compactness as follows:
Definition: evaluation.cpp:617
static int computeSuperpixels(const cv::Mat &labels)
Count the number of superpixels.
Definition: evaluation.cpp:809
static float computeSumOfSquaredErrorXY(const cv::Mat &labels, const cv::Mat &image)
Compute Sum-of-Squared Error XY.
Definition: evaluation.cpp:391
static float computeExplainedVariation(const cv::Mat &labels, const cv::Mat &image)
Compute the explained variation of the given segmentation.
Definition: evaluation.cpp:441
static float computeAchievableSegmentationAccuracy(const cv::Mat &labels, const cv::Mat &gt)
Compute achievable segmentation accuracy as follows:
Definition: evaluation.cpp:302
static float computeBoundaryRecall(const cv::Mat &labels, const cv::Mat &gt, float d=0.0025)
Compute boundary recall:
Definition: evaluation.cpp:41
static float computeAverageMetric(const std::vector< float > &values, const std::vector< float > &superpixels, int min_superpixels=200, int max_superpixels=5200)
Computes the average of a metric, i.e. computes the integral of the metric in the given superpixel ra...
Definition: evaluation.cpp:948
static float computeRegularity(const cv::Mat &labels)
Regularity can be computed as the fraction of boundary pixels of a superpixels and the boundary pixel...
Definition: evaluation.cpp:771
Some basic visualizations of superpixel segmentations.
Definition: visualization.h:40
static float computeSumOfSquaredErrorRGB(const cv::Mat &labels, const cv::Mat &image)
Compute Sum-of-Squared Error on RGB.
Definition: evaluation.cpp:339
static float computeUndersegmentationError(const cv::Mat &labels, const cv::Mat &gt)
Compute the Undersegmentation error as follows:
Definition: evaluation.cpp:150
static float computeOversegmentationError(const cv::Mat &labels, const cv::Mat &gt)
Definition: evaluation.cpp:191
static float computeLevinUndersegmentationError(const cv::Mat &labels, const cv::Mat &gt)
Compute the Undersegmentation Error (Levinshtein et al.):
Definition: evaluation.cpp:267
static void computeSuperpixelSizes(const cv::Mat &labels, float &average_size, int &min_size, int &max_size, float &size_variation)
Compute superpixel size statistics.
Definition: evaluation.cpp:839
static float computeIntraClusterVariation(const cv::Mat &labels, const cv::Mat &image)
Compute Intra-Cluster Variation, that is the average standard deviation over all superpixels.
Definition: evaluation.cpp:545
static float computeMeanDistanceToEdge(const cv::Mat &labels, const cv::Mat &gt)
Compute Mean Distance to Edge:
Definition: evaluation.cpp:503
Provides measures to evaluate (over-) segmentations.
Definition: evaluation.h:40
static float computeContourDensity(const cv::Mat &labels)
Contour Density is given as.
Definition: evaluation.cpp:701
static float computeEdgeRecall(const cv::Mat &labels, const cv::Mat &edges, float d=0.0025)
Compute edge recall based on a computed edge map.
Definition: evaluation.cpp:895
static float computeNPUndersegmentationError(const cv::Mat &labels, const cv::Mat &gt)
Computes the Undersegmentation Error (Neubert, Protzel):
Definition: evaluation.cpp:232