Superpixel Benchmark
Superpixel benchmark, tools and algorithms.
robustness_tool.h
Go to the documentation of this file.
1 
32 #ifndef ROBUSTNESS_TOOL_H
33 #define ROBUSTNESS_TOOL_H
34 
35 #include <boost/filesystem.hpp>
36 #include <opencv2/opencv.hpp>
37 
42 public:
47  virtual void computeImage(const cv::Mat &image, cv::Mat &computed_image) = 0;
48 
53  virtual void computeSegmentation(const cv::Mat &segmentation,
54  cv::Mat &computed_segmentation) = 0;
55 
58  virtual bool next() = 0;
59 
63  virtual std::string identify() = 0;
64 
65 };
66 
71 public:
72 
80  RobustnessTool(boost::filesystem::path &base_directory, boost::filesystem::path &image_directory,
81  boost::filesystem::path &gt_directory, std::string command_line, RobustnessToolDriver* driver);
82 
86  void setFilesToKeep(const std::vector<std::string> &files);
87 
90  void evaluate();
91 
92 private:
93 
97  void cleanDirectory(boost::filesystem::path directory);
98 
100  boost::filesystem::path base_directory;
102  boost::filesystem::path image_directory;
104  boost::filesystem::path gt_directory;
105 
107  std::string command_line;
108 
110  RobustnessToolDriver* driver;
111 
113  std::vector<std::string> files;
114 
115 };
116 
120 public:
121 
126  GaussianNoiseDriver(std::string type, const std::vector<float> &variances);
127 
132  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
133 
138  void computeSegmentation(const cv::Mat &segmentation,
139  cv::Mat &computed_segmentation);
140 
143  bool next();
144 
148  std::string identify();
149 
150 private:
151 
153  std::string type;
154 
156  std::vector<float> variances;
157 
159  int current;
160 };
161 
165 public:
166 
170 
175  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
176 
181  void computeSegmentation(const cv::Mat &segmentation,
182  cv::Mat &computed_segmentation);
183 
186  bool next();
187 
191  std::string identify();
192 
193 };
194 
198 public:
199 
203  SaltAndPepperNoiseDriver(const std::vector<float> &probabilities);
204 
209  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
210 
215  void computeSegmentation(const cv::Mat &segmentation,
216  cv::Mat &computed_segmentation);
217 
220  bool next();
221 
225  std::string identify();
226 
227 private:
228 
230  std::vector<float> probabilities;
231 
233  int current;
234 
235 };
236 
240 public:
241 
245  BlurDriver(const std::vector<int> &sizes);
246 
251  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
252 
257  void computeSegmentation(const cv::Mat &segmentation,
258  cv::Mat &computed_segmentation);
259 
262  bool next();
263 
267  std::string identify();
268 
269 private:
270 
272  std::vector<int> sizes;
273 
275  int current;
276 
277 };
278 
282 public:
283 
288  GaussianBlurDriver(const std::vector<int> &sizes, const std::vector<float> &variances);
289 
294  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
295 
300  void computeSegmentation(const cv::Mat &segmentation,
301  cv::Mat &computed_segmentation);
302 
305  bool next();
306 
310  std::string identify();
311 
312 private:
313 
315  std::vector<int> sizes;
316 
318  std::vector<float> variances;
319 
321  int current;
322 
323 };
324 
328 public:
329 
333  MedianBlurDriver(const std::vector<int> &sizes);
334 
339  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
340 
345  void computeSegmentation(const cv::Mat &segmentation,
346  cv::Mat &computed_segmentation);
347 
350  bool next();
351 
355  std::string identify();
356 
357 private:
358 
360  std::vector<int> sizes;
361 
363  int current;
364 };
365 
369 public:
370 
376  BilateralFilterDriver(const std::vector<int> &sizes, const std::vector<float> &color_variances,
377  const std::vector<float> &space_variances);
378 
383  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
384 
389  void computeSegmentation(const cv::Mat &segmentation,
390  cv::Mat &computed_segmentation);
391 
394  bool next();
395 
399  std::string identify();
400 
401 private:
402 
404  std::vector<int> sizes;
405 
407  std::vector<float> color_variances;
408 
410  std::vector<float> space_variances;
411 
413  int current;
414 
415 };
416 
420 public:
421 
426  MotionBlurDriver(const std::vector<int> &sizes, const std::vector<float> &angles);
427 
432  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
433 
438  void computeSegmentation(const cv::Mat &segmentation,
439  cv::Mat &computed_segmentation);
440 
443  bool next();
444 
448  std::string identify();
449 
450 private:
451 
453  std::vector<int> sizes;
454 
456  std::vector<float> angles;
457 
459  int current;
460 
461 };
462 
466 public:
467 
473  ShearDriver(std::string type, int crop, const std::vector<float> &m);
474 
479  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
480 
485  void computeSegmentation(const cv::Mat &segmentation,
486  cv::Mat &computed_segmentation);
487 
490  bool next();
491 
495  std::string identify();
496 
497 private:
498 
500  std::string type;
501 
503  int crop;
504 
506  std::vector<float> m;
507 
509  int current;
510 
511 };
512 
516 public:
517 
522  RotationDriver(int crop, const std::vector<float> &angles);
523 
528  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
529 
534  void computeSegmentation(const cv::Mat &segmentation,
535  cv::Mat &computed_segmentation);
536 
539  bool next();
540 
544  std::string identify();
545 
546 private:
547 
549  int crop;
550 
552  std::vector<float> angles;
553 
555  int current;
556 
557 };
558 
562 public:
563 
569  TranslationDriver(int crop, const std::vector<int> &x, const std::vector<int> &y);
570 
575  void computeImage(const cv::Mat &image, cv::Mat &computed_image);
576 
581  void computeSegmentation(const cv::Mat &segmentation,
582  cv::Mat &computed_segmentation);
583 
586  bool next();
587 
591  std::string identify();
592 
593 private:
594 
596  int crop;
597 
599  std::vector<int> x;
600 
602  std::vector<int> y;
603 
605  int current;
606 
607 };
608 
609 #endif /* ROBUSTNESS_TOOL_H */
610 
Tool evaluating the robustness for different filters/enhancement/transformations. ...
Definition: robustness_tool.h:70
Poisson noise driver.
Definition: robustness_tool.h:164
Blur driver.
Definition: robustness_tool.h:239
Additive Gaussian noise and Gaussian sampling error driver.
Definition: robustness_tool.h:119
Motion blur driver.
Definition: robustness_tool.h:419
virtual void computeImage(const cv::Mat &image, cv::Mat &computed_image)=0
Apply the transformation with the current parameters.
Vertical and horizontal shear driver.
Definition: robustness_tool.h:465
Rotation driver.
Definition: robustness_tool.h:515
virtual std::string identify()=0
Identify current parameter settings.
virtual bool next()=0
Select next parameter set.
Bilateral filter driver.
Definition: robustness_tool.h:368
virtual void computeSegmentation(const cv::Mat &segmentation, cv::Mat &computed_segmentation)=0
Apply the transformation with the current parameters on the ground truth.
Salt and pepper noise driver.
Definition: robustness_tool.h:197
Median blur driver.
Definition: robustness_tool.h:327
Driver for different filters/enhancements/transformations.
Definition: robustness_tool.h:41
Gaussian blur filter.
Definition: robustness_tool.h:281
Translation driver.
Definition: robustness_tool.h:561