00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef IMAGE_DRAWOPS_H_DEFINED
00039 #define IMAGE_DRAWOPS_H_DEFINED
00040
00041 #include "Util/Types.H"
00042 #include "Image/SimpleFont.H"
00043 #include "Image/Pixels.H"
00044
00045 #include <string>
00046 #include <vector>
00047
00048 template <class T> class Point2D;
00049 class Dims;
00050 class Rectangle;
00051 template <class T> class Image;
00052 template <class T> class PixRGB;
00053 class ColorMap;
00054
00055
00056
00057
00058 void drawTraj(Image< PixRGB<byte> >& img,
00059 const Point2D<int>* foas_begin, const Point2D<int>* foas_end);
00060
00061
00062
00063
00064
00065
00066 Image< PixRGB<byte> > colGreyCombo(const Image< PixRGB<byte> >& colimg,
00067 const Image<float>& bwimg,
00068 const bool xcombo,
00069 const bool interp = true);
00070
00071
00072
00073
00074
00075
00076 Image< PixRGB<byte> > colColCombo(const Image< PixRGB<byte> >& colimg1,
00077 const Image< PixRGB<byte> >& colimg2,
00078 const bool xcombo,
00079 const bool interp = true);
00080
00081
00082 Image< PixRGB<byte> > highlightRegions(const Image< PixRGB<byte> >& img,
00083 const Image<byte>& mask,
00084 const int maxval = 320);
00085
00086
00087 Image< PixRGB<byte> > warp3Dmap(const Image< PixRGB<byte> >& img,
00088 const Image<float>& hmap,
00089 const float pitch, const float yaw,
00090 Dims& imdims);
00091
00092
00093 void inplaceSetValMask(Image<float>& dest,
00094 const Image<byte>& mask, const float val);
00095
00096
00097
00098 template <class T_or_RGB>
00099 void drawDisk(Image<T_or_RGB>& dst,
00100 const Point2D<int>& center, const int radius,
00101 const T_or_RGB value);
00102
00103
00104 template <class T_or_RGB>
00105 void drawLine(Image<T_or_RGB>& dst,
00106 const Point2D<int>& p1, const Point2D<int>& p2, const T_or_RGB col,
00107 const int rad = 1);
00108
00109
00110 template <class T_or_RGB>
00111 void drawLine(Image<T_or_RGB>& dst,
00112 const Point2D<int>& pos, float ori, float len, const T_or_RGB col,
00113 const int rad = 1);
00114
00115
00116 template <class T_or_RGB>
00117 void drawCorner(Image<T_or_RGB>& dst,
00118 const Point2D<int>& pos, float ori, float ang, float len,
00119 const T_or_RGB col, const int rad = 1);
00120
00121
00122
00123 template <class T_or_RGB>
00124 void drawRect(Image<T_or_RGB>& dst,
00125 const Rectangle& rect, const T_or_RGB col, const int rad = 1);
00126
00127
00128 template <class T_or_RGB>
00129 void drawRectSquareCorners(Image<T_or_RGB>& dst, const Rectangle &r,
00130 const T_or_RGB color, const int linewidth);
00131
00132
00133 template <class T_or_RGB>
00134 void drawRectOR(Image<T_or_RGB>& dst,
00135 const Rectangle& rect, const T_or_RGB col, const int rad = 1,
00136 const float ori = 0.0F);
00137
00138
00139 template <class T_or_RGB>
00140 void drawRectEZ(Image<T_or_RGB>& dst,
00141 const Rectangle& rect, const T_or_RGB col, const int rad = 1);
00142
00143
00144 template <class T_or_RGB>
00145 void drawFilledRect(Image<T_or_RGB>& dst, const Rectangle& rect,
00146 const T_or_RGB fillVal);
00147
00148
00149 template <class T_or_RGB>
00150 void drawCross(Image<T_or_RGB>& dst,
00151 const Point2D<int>& p, const T_or_RGB col, const int siz = 3,
00152 const int rad = 1);
00153
00154
00155 template <class T_or_RGB>
00156 void drawCrossOR(Image<T_or_RGB>& dst,
00157 const Point2D<int>& p, const T_or_RGB col, const int siz = 3,
00158 const int rad = 1, const float ori = 0.0F);
00159
00160
00161 template <class T_or_RGB>
00162 void drawPatch(Image<T_or_RGB>& dst,
00163 const Point2D<int>& p, const int siz, const T_or_RGB col);
00164
00165
00166 template <class T_or_RGB>
00167 void drawPatchBB(Image<T_or_RGB>& dst,
00168 const Point2D<int>& p, const int siz, const T_or_RGB col, const T_or_RGB bgcol = T_or_RGB());
00169
00170
00171 template <class T_or_RGB>
00172 void drawCircle(Image<T_or_RGB>& dst,
00173 const Point2D<int>& p, const int radius, const T_or_RGB col,
00174 const int rad = 1);
00175
00176
00177 template <class T_or_RGB>
00178 void drawArrow(Image<T_or_RGB>& dst,
00179 const Point2D<int>& p1, const Point2D<int>& p2, const T_or_RGB col,
00180 const int rad = 1);
00181
00182
00183 template <class T_or_RGB>
00184 void drawGrid(Image<T_or_RGB>& dst,
00185 const int spacingX, const int spacingY,
00186 const int thickX, const int thickY, const T_or_RGB col);
00187
00188
00189 template <class T_or_RGB>
00190 void drawGrid(Image<T_or_RGB>& dst, const uint nx, const uint ny,
00191 const int thick, const T_or_RGB col);
00192
00193
00194
00195
00196 template <class T, class T_or_RGB>
00197 void drawContour2D(const Image<T>& src, Image<T_or_RGB>& dst, const T_or_RGB &col, const byte rad);
00198
00199 enum TextAnchor
00200 {
00201 ANCHOR_TOP_LEFT,
00202 ANCHOR_TOP_RIGHT,
00203 ANCHOR_BOTTOM_LEFT,
00204 ANCHOR_BOTTOM_RIGHT
00205 };
00206
00207
00208
00209 template <class T_or_RGB>
00210 void writeText(Image<T_or_RGB>& dst,
00211 const Point2D<int>& pt, const char* text,
00212 const T_or_RGB col = T_or_RGB(),
00213 const T_or_RGB bgcol = T_or_RGB(255),
00214 const SimpleFont& f = SimpleFont::FIXED(10),
00215 const bool transparent_bg = false,
00216 const TextAnchor anchor = ANCHOR_TOP_LEFT);
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233 template <class T_or_RGB>
00234 Image<T_or_RGB> makeMultilineTextBox(const int w,
00235 const std::string* lines,
00236 const size_t nlines,
00237 const T_or_RGB col,
00238 const T_or_RGB bg = T_or_RGB(),
00239 const size_t max_chars_per_line = 0,
00240 const int fontwidth = 0);
00241
00242
00243
00244
00245
00246 template <class T_or_RGB>
00247 void drawPoint(Image<T_or_RGB>& dst,
00248 int X,int Y, T_or_RGB pix);
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258 template <class T>
00259 int drawDiskCheckTarget(Image<T>& dst,
00260 Image<T>& mask, const Point2D<int>& center,
00261 const int radius, const T value,
00262 const T targetval, const T floodval);
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273 template <class T>
00274 Image<PixRGB<T> > warp3D(const Image<PixRGB<T> >& ima,
00275 const Image<float>& zmap,
00276 const float pitch, const float yaw,
00277 const float zMax, Dims& dims);
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288 Image< PixRGB<byte> >
00289 formatMapForDisplay(const Image<float>& img, const float factor,
00290 const Dims& newdims, const bool useInterp,
00291 const ColorMap& cmap, const bool showColorScale,
00292 const char *label);
00293
00294
00295 template <typename T, class U>
00296 Image< PixRGB<byte> >
00297 linePlot(const U& points,
00298 const int w, const int h, T minVal = T(),
00299 T maxVal = T(), const char *title = "",
00300 const char *xLabel = "", const char *yLabel = "",
00301 const PixRGB<byte>& linecol=PixRGB<byte>(0,0,0),
00302 const PixRGB<byte>& bckcol=PixRGB<byte>(255,255,255));
00303
00304
00305 template <class T_or_RGB>
00306 void drawFilledPolygon(Image<T_or_RGB>& img,
00307 const std::vector<Point2D<int> >& polygon,
00308 const T_or_RGB col);
00309
00310
00311 struct MeterInfo
00312 {
00313 std::string label;
00314 double val;
00315 double valmax;
00316 double thresh;
00317 PixRGB<byte> color;
00318 };
00319
00320
00321 Image<PixRGB<byte> > drawMeters(const MeterInfo* infos, const size_t ninfo,
00322 const size_t nx, const Dims& meterdims);
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332 #endif // !IMAGE_DRAWOPS_H_DEFINED