MTF
graphUtils.h
1 //------------------------------------------------------------------------------
2 // Graphing functions for OpenCV. Part of "ImageUtils.cpp", a set of handy utility functions for dealing with images in OpenCV.
3 // by Shervin Emami (http://www.shervinemami.co.cc/) on 20th May, 2010.
4 // updated for newer versions of OpenCV while adapting for MTF
5 //------------------------------------------------------------------------------
6 
7 #ifndef MTF_GRAPH_UTILS_H
8 #define MTF_GRAPH_UTILS_H
9 
10 #include "mtf/Macros/common.h"
11 #include "opencv2/core/core.hpp"
12 
13 #define DEFAULT(val) = val
14 
15 namespace mtf{
16  namespace utils{
17  //------------------------------------------------------------------------------
18  // Graphing functions
19  //------------------------------------------------------------------------------
20 
21  // Draw the graph of an array of floats into imageDst or a new image, between minV & maxV if given.
22  // Remember to free the newly created image if imageDst is not given.
23  cv::Mat drawFloatGraph(const float *arraySrc, int nArrayLength, cv::Mat imageDst DEFAULT(cv::Mat()),
24  float minV DEFAULT(0.0), float maxV DEFAULT(0.0), int width DEFAULT(0), int height DEFAULT(0),
25  char *graphLabel DEFAULT(0), bool showScale DEFAULT(true));
26 
27  // Draw the graph of an array of ints into imageDst or a new image, between minV & maxV if given.
28  // Remember to free the newly created image if imageDst is not given.
29  cv::Mat drawIntGraph(const int *arraySrc, int nArrayLength, cv::Mat imageDst DEFAULT(cv::Mat()),
30  int minV DEFAULT(0), int maxV DEFAULT(0), int width DEFAULT(0), int height DEFAULT(0),
31  char *graphLabel DEFAULT(0), bool showScale DEFAULT(true));
32 
33  // Draw the graph of an array of uchars into imageDst or a new image, between minV & maxV if given.
34  // Remember to free the newly created image if imageDst is not given.
35  cv::Mat drawUCharGraph(const uchar *arraySrc, int nArrayLength, cv::Mat imageDst DEFAULT(cv::Mat()),
36  int minV DEFAULT(0), int maxV DEFAULT(0), int width DEFAULT(0), int height DEFAULT(0),
37  char *graphLabel DEFAULT(0), bool showScale DEFAULT(true));
38 
39  // Display a graph of the given float array.
40  // If background is provided, it will be drawn into, for combining multiple graphs using drawFloatGraph().
41  // Set delay_ms to 0 if you want to wait forever until a keypress, or set it to 1 if you want it to delay just 1 millisecond.
42  void showFloatGraph(const char *name, const float *arraySrc, int nArrayLength, int delay_ms DEFAULT(500),
43  cv::Mat background DEFAULT(cv::Mat()));
44 
45  // Display a graph of the given int array.
46  // If background is provided, it will be drawn into, for combining multiple graphs using drawIntGraph().
47  // Set delay_ms to 0 if you want to wait forever until a keypress, or set it to 1 if you want it to delay just 1 millisecond.
48  void showIntGraph(const char *name, const int *arraySrc, int nArrayLength, int delay_ms DEFAULT(500),
49  cv::Mat background DEFAULT(cv::Mat()));
50 
51  // Display a graph of the given unsigned char array.
52  // If background is provided, it will be drawn into, for combining multiple graphs using drawUCharGraph().
53  // Set delay_ms to 0 if you want to wait forever until a keypress, or set it to 1 if you want it to delay just 1 millisecond.
54  void showUCharGraph(const char *name, const uchar *arraySrc, int nArrayLength, int delay_ms DEFAULT(500),
55  cv::Mat background DEFAULT(cv::Mat()));
56 
57  // Simple helper function to easily view an image, with an optional pause.
58  void showImage(const cv::Mat img, int delay_ms DEFAULT(0), char *name DEFAULT(0));
59 
60  // Call 'setGraphColor(0)' to reset the colors that will be used for graphs.
61  void setGraphColor(int index DEFAULT(0));
62  // Specify the exact color that the next graph should be drawn as.
63  void setCustomGraphColor(int R, int B, int G);
64  }
65 }
66 
67 #endif //end GRAPH_UTILS
Definition: RegNetParams.h:32
basic functions for preprocessing the raw input image using filtering, resizing and histogram equaliz...
Definition: histUtils.h:20