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 drawEllipse(Image<T_or_RGB>& dst,
00179 const Point2D<int>& p, const int radiusx,
00180 const int radiusy, const T_or_RGB col, const int rad = 1);
00181
00182
00183 template <class T_or_RGB>
00184 void drawArrow(Image<T_or_RGB>& dst,
00185 const Point2D<int>& p1, const Point2D<int>& p2, const T_or_RGB col,
00186 const int rad = 1);
00187
00188
00189 template <class T_or_RGB>
00190 void drawGrid(Image<T_or_RGB>& dst,
00191 const int spacingX, const int spacingY,
00192 const int thickX, const int thickY, const T_or_RGB col);
00193
00194
00195 template <class T_or_RGB>
00196 void drawGrid(Image<T_or_RGB>& dst, const uint nx, const uint ny,
00197 const int thick, const T_or_RGB col);
00198
00199
00200 template <class T_or_RGB>
00201 void drawSuperquadric(Image<T_or_RGB>& dst,
00202 const Point2D<int>& p,
00203 const float a, const float b, const float e, const T_or_RGB col,
00204 const float rot = 0, const float k1 = 0, const float k2 = 0,
00205 const float thetai = -M_PI,
00206 const float thetaf = M_PI,
00207 const int rad = 1,
00208 const int nSeg = 40);
00209
00210
00211
00212
00213
00214 template <class T, class T_or_RGB>
00215 void drawContour2D(const Image<T>& src, Image<T_or_RGB>& dst, const T_or_RGB &col, const byte rad);
00216
00217 enum TextAnchor
00218 {
00219 ANCHOR_TOP_LEFT,
00220 ANCHOR_TOP_RIGHT,
00221 ANCHOR_BOTTOM_LEFT,
00222 ANCHOR_BOTTOM_RIGHT
00223 };
00224
00225
00226
00227 template <class T_or_RGB>
00228 void writeText(Image<T_or_RGB>& dst,
00229 const Point2D<int>& pt, const char* text,
00230 const T_or_RGB col = T_or_RGB(),
00231 const T_or_RGB bgcol = T_or_RGB(255),
00232 const SimpleFont& f = SimpleFont::FIXED(10),
00233 const bool transparent_bg = false,
00234 const TextAnchor anchor = ANCHOR_TOP_LEFT);
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251 template <class T_or_RGB>
00252 Image<T_or_RGB> makeMultilineTextBox(const int w,
00253 const std::string* lines,
00254 const size_t nlines,
00255 const T_or_RGB col,
00256 const T_or_RGB bg = T_or_RGB(),
00257 const size_t max_chars_per_line = 0,
00258 const int fontwidth = 0);
00259
00260
00261
00262
00263
00264 template <class T_or_RGB>
00265 void drawPoint(Image<T_or_RGB>& dst,
00266 int X,int Y, T_or_RGB pix);
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276 template <class T>
00277 int drawDiskCheckTarget(Image<T>& dst,
00278 Image<T>& mask, const Point2D<int>& center,
00279 const int radius, const T value,
00280 const T targetval, const T floodval);
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291 template <class T>
00292 Image<PixRGB<T> > warp3D(const Image<PixRGB<T> >& ima,
00293 const Image<float>& zmap,
00294 const float pitch, const float yaw,
00295 const float zMax, Dims& dims);
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306 Image< PixRGB<byte> >
00307 formatMapForDisplay(const Image<float>& img, const float factor,
00308 const Dims& newdims, const bool useInterp,
00309 const ColorMap& cmap, const bool showColorScale,
00310 const char *label);
00311
00312
00313
00314 template <typename T, class U>
00315 Image< PixRGB<byte> >
00316 linePlot(const U& points, const int w, const int h,
00317 const T& minVal = T(), const T& maxVal = T(),
00318 const char *title = "",
00319 const char *yLabel = "", const char *xLabel = "",
00320 const PixRGB<byte>& linecol=PixRGB<byte>(0,0,0),
00321 const PixRGB<byte>& bckcol=PixRGB<byte>(255,255,255),
00322 const int numticks = 4, const bool axisonright = false);
00323
00324
00325
00326 template <typename T>
00327 Image< PixRGB<byte> >
00328 multilinePlot(const std::vector<std::vector<T> >& lines,
00329 const int w, const int h, T minVal = T(),
00330 T maxVal = T(), const char *title = "",
00331 const char *xLabel = "", const char *yLabel = "",
00332 const std::vector<PixRGB<byte> >& linescolor = std::vector<PixRGB<byte> >(0),
00333 const PixRGB<byte>& gridcolor=PixRGB<byte>(255,0,0),
00334 const PixRGB<byte>& bckcolor=PixRGB<byte>(255,255,255));
00335
00336
00337 template <class T_or_RGB>
00338 void drawOutlinedPolygon(Image<T_or_RGB>& img,
00339 const std::vector<Point2D<int> >& polygon,
00340 const T_or_RGB col,
00341 const Point2D<int> trans = Point2D<int>(0,0),
00342 const float rot = 0.0,
00343 const float scale = 1.0,
00344 const float k1 = 0,
00345 const float k2 = 0,
00346 const int rad = 1);
00347
00348
00349 template <class T_or_RGB>
00350 void drawFilledPolygon(Image<T_or_RGB>& img,
00351 const std::vector<Point2D<int> >& polygon,
00352 const T_or_RGB col);
00353
00354
00355 struct MeterInfo
00356 {
00357 std::string label;
00358 double val;
00359 double valmax;
00360 double thresh;
00361 PixRGB<byte> color;
00362 };
00363
00364
00365 Image<PixRGB<byte> > drawMeters(const MeterInfo* infos, const size_t ninfo,
00366 const size_t nx, const Dims& meterdims);
00367
00368
00369 template <class T>
00370 Image<T> drawHistogram(std::vector<float> hist, int width, int height, T lineVal, T fillVal );
00371
00372
00373
00374
00375
00376
00377
00378
00379 #endif // !IMAGE_DRAWOPS_H_DEFINED