DrawOps.C File Reference

#include <deque>
#include "Image/DrawOps.H"
#include "Image/ColorOps.H"
#include "Image/ColorMap.H"
#include "Image/CutPaste.H"
#include "Image/FilterOps.H"
#include "Image/Image.H"
#include "Image/MathOps.H"
#include "Image/Pixels.H"
#include "Image/Point2D.H"
#include "Image/Range.H"
#include "Image/ShapeOps.H"
#include "Image/Transforms.H"
#include "Image/MatrixOps.H"
#include "Util/Assert.H"
#include "Util/MathFunctions.H"
#include "Util/sformat.H"
#include "rutz/trace.h"
#include <cmath>
#include "inst/Image/DrawOps.I"
Include dependency graph for DrawOps.C:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void drawTraj (Image< PixRGB< byte > > &img, const Point2D< int > *foa, const Point2D< int > *foas_end)
 draw the trajectory for the points in foas onto img
Image< PixRGB< byte > > colGreyCombo (const Image< PixRGB< byte > > &colimg, const Image< float > &bwimg, const bool xcombo, const bool interp)
 build a combo between a color and greyscale image
Image< PixRGB< byte > > colColCombo (const Image< PixRGB< byte > > &colimg1, const Image< PixRGB< byte > > &colimg2, const bool xcombo, const bool interp)
 build a combo between a color and color image
Image< PixRGB< byte > > highlightRegions (const Image< PixRGB< byte > > &img, const Image< byte > &mask, const int maxval)
 highlight an image in the regions given by a mask
Image< PixRGB< byte > > warp3Dmap (const Image< PixRGB< byte > > &img, const Image< float > &hmap, const float pitch, const float yaw, Dims &imdims)
 warp image onto height map
void inplaceSetValMask (Image< float > &dest, const Image< byte > &mask, const float val)
 Set values at all locations where mask is non-zero.
template<class T >
void drawDisk (Image< T > &dst, const Point2D< int > &center, const int radius, const T value)
template<class T >
void drawLine (Image< T > &dst, const Point2D< int > &pos, float ori, float len, const T col, const int rad=1)
template<class T >
void drawLine (Image< T > &dst, const Point2D< int > &p1, const Point2D< int > &p2, const T col, const int rad)
template<class T >
void drawCorner (Image< T > &dst, const Point2D< int > &pos, float ori, float ang, float len, const T col, const int rad=1)
template<class T >
void drawRect (Image< T > &dst, const Rectangle &r, const T color, const int rad)
template<class T >
void drawRectSquareCorners (Image< T > &dst, const Rectangle &r1, const T color, const int linewidth)
template<class T >
void drawRectOR (Image< T > &dst, const Rectangle &r, const T color, const int rad, const float ori)
template<class T >
void drawRectEZ (Image< T > &dst, const Rectangle &r, const T color, const int rad)
template<class T >
void drawFilledRect (Image< T > &dst, const Rectangle &r, const T val)
template<class T >
Image< T > drawHistogram (std::vector< float > hist, int width, int height, T lineVal, T fillVal)
template<class T >
void drawCross (Image< T > &dst, const Point2D< int > &p, const T col, const int siz, const int rad)
template<class T >
void drawCrossOR (Image< T > &dst, const Point2D< int > &p, const T col, const int siz, const int rad, const float ori)
template<class T >
void drawPatch (Image< T > &dst, const Point2D< int > &p, const int siz, const T col)
template<class T >
void drawPatchBB (Image< T > &dst, const Point2D< int > &p, const int siz, const T col, const T bgcol)
template<class T >
void drawCircle (Image< T > &dst, const Point2D< int > &p, const int radius, const T col, const int rad)
template<class T >
void drawEllipse (Image< T > &dst, const Point2D< int > &p, const int radiusx, const int radiusy, const T col, const int rad)
template<class T_or_RGB >
void drawSuperquadric (Image< T_or_RGB > &dst, const Point2D< int > &p, const float a, const float b, const float e, const T_or_RGB col, const float rot, const float k1, const float k2, const float thetai, const float thetaf, const int rad, const int nSeg)
 Draw a superquadric shape. nSeg defines the quality of the shape. ie. how many line to draw.
template<class T >
void drawArrow (Image< T > &dst, const Point2D< int > &p1, const Point2D< int > &p2, const T col, const int rad)
template<class T >
void drawGrid (Image< T > &dst, const int spacingX, const int spacingY, const int thickX, const int thickY, const T col)
template<class T , class TT >
void drawContour2D (const Image< T > &src, Image< TT > &dst, const TT &col, const byte rad)
template<class T >
void drawGrid (Image< T > &dst, const uint nx, const uint ny, const int thick, const T col)
template<class T >
void writeText (Image< T > &dst, const Point2D< int > &pt, const char *text, const T col, const T bgcol, const SimpleFont &f, const bool transparent_bg, const TextAnchor anchor)
template<class T >
Image< T > makeMultilineTextBox (const int w, const std::string *lines, const size_t nlines, const T col, const T bg, const size_t max_chars_per_line_hint, const int fontwidth)
template<class T >
void drawPoint (Image< T > &dst, int X, int Y, T pix)
template<class T >
int drawDiskCheckTarget (Image< T > &dst, Image< T > &mask, const Point2D< int > &center, const int radius, const T value, const T targetvalue, const T floodvalue)
 Draws a disk in image and check if it hits a target.
template<class T >
Image< PixRGB< T > > warp3D (const Image< PixRGB< T > > &ima, const Image< float > &zmap, const float pitch, const float yaw, const float zMax, Dims &dims)
 Warp image in 3D onto z-map.
Image< PixRGB< byte > > formatMapForDisplay (const Image< float > &img, const float factor, const Dims &newdims, const bool useInterp, const ColorMap &cmap, const bool showColorScale, const char *label)
 Format a feature map for display.
template<typename T , class U >
Image< PixRGB< byte > > linePlot (const U &points, const int w, const int h, const T &minVal, const T &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template<typename T >
Image< PixRGB< byte > > multilinePlot (const std::vector< std::vector< T > > &lines, const int w, const int h, T minVal, T maxVal, const char *title, const char *ylabel, const char *xlabel, const std::vector< PixRGB< byte > > &linescolor, const PixRGB< byte > &gridcolor, const PixRGB< byte > &bckcolor)
 Generate multiline plot from a vector of lines.
template<class T >
void drawOutlinedPolygon (Image< T > &img, const std::vector< Point2D< int > > &polygon, const T col, const Point2D< int > trans, const float rot, const float scale, const float k1, const float k2, const int rad)
template<class T >
void drawFilledPolygon (Image< T > &img, const std::vector< Point2D< int > > &polygon, const T col)
Image< PixRGB< byte > > drawMeters (const MeterInfo *infos, const size_t ninfo, const size_t nx, const Dims &meterdims)
 Draw some bargraph meters.
template Image< PixRGB< byte > > linePlot (const std::vector< double > &points, const int w, const int h, const double &minVal, const double &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template Image< PixRGB< byte > > linePlot (const std::deque< double > &points, const int w, const int h, const double &minVal, const double &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template Image< PixRGB< byte > > linePlot (const std::deque< float > &points, const int w, const int h, const float &minVal, const float &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template Image< PixRGB< byte > > linePlot (const std::vector< float > &points, const int w, const int h, const float &minVal, const float &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template Image< PixRGB< byte > > linePlot (const std::vector< int > &points, const int w, const int h, const int &minVal, const int &maxVal, const char *title, const char *ylabel, const char *xlabel, const PixRGB< byte > &linecol, const PixRGB< byte > &bckcol, const int numticks, const bool axisonright)
template void drawContour2D (const Image< byte > &src, Image< PixRGB< byte > > &dst, const PixRGB< byte > &col, const byte rad)
template void drawContour2D (const Image< byte > &src, Image< byte > &dst, const byte &col, const byte rad)
template Image< PixRGB< byte > > drawHistogram (std::vector< float > hist, int width, int height, PixRGB< byte > lineVal, PixRGB< byte > fillVal)

Detailed Description

functions for drawing on images

Definition in file DrawOps.C.


Function Documentation

Image< PixRGB<byte> > colColCombo ( const Image< PixRGB< byte > > &  colimg1,
const Image< PixRGB< byte > > &  colimg2,
const bool  xcombo,
const bool  interp = true 
)

build a combo between a color and color image

Parameters:
colimg1 the color image (e.g., trajectory + saliency map)
colimg2 the second color image (e.g., the scene highlighted by TRM)
xcombo will combine horizontally if true, otherwise vertically
interp use bilinear interpolation for any image rescaling

Definition at line 95 of file DrawOps.C.

References ASSERT, concatX(), and concatY().

Referenced by SimulationViewerStd::getTraj().

Image< PixRGB<byte> > colGreyCombo ( const Image< PixRGB< byte > > &  colimg,
const Image< float > &  bwimg,
const bool  xcombo,
const bool  interp = true 
)

build a combo between a color and greyscale image

Parameters:
colimg the color image (e.g., trajectory)
bwimg the greyscale image (e.g., saliency map)
xcombo will combine horizontally if true, otherwise vertically
interp use bilinear interpolation for any image rescaling

Definition at line 74 of file DrawOps.C.

References ASSERT, concatX(), concatY(), Image< T >::getDims(), Image< T >::initialized(), makeRGB(), and ZEROS.

Referenced by SimulationViewerStd::getTraj(), SimulationViewerCompress::getTraj(), main(), and SimulationViewerStats::save1().

template<class T >
int drawDiskCheckTarget ( Image< T > &  dst,
Image< T > &  mask,
const Point2D< int > &  center,
const int  radius,
const T  value,
const T  targetval,
const T  floodval 
) [inline]

Draws a disk in image and check if it hits a target.

Parameters:
mask input binary target mask to draw into
center coordinates of disk center
radius radisu of disk, in pixels
value pixel value used to draw the disk
targetval value with which the targets are represented
floodval value to flood target with if target hit
Returns:
number of targets hit and flooded

Definition at line 888 of file DrawOps.C.

References ASSERT, Image< T >::coordsOk(), flood(), Image< T >::getVal(), Point2D< T >::i, Image< T >::initialized(), Image< T >::setVal(), sqrt(), and squareOf().

Image<PixRGB<byte> > drawMeters ( const MeterInfo infos,
const size_t  ninfo,
const size_t  nx,
const Dims meterdims 
)

Draw some bargraph meters.

Definition at line 1570 of file DrawOps.C.

References ASSERT, clampValue(), SimpleFont::fixedMaxHeight(), Dims::h(), sformat(), SimpleFont::w(), Dims::w(), writeText(), and ZEROS.

template<class T_or_RGB >
void drawSuperquadric ( Image< T_or_RGB > &  dst,
const Point2D< int > &  p,
const float  a,
const float  b,
const float  e,
const T_or_RGB  col,
const float  rot,
const float  k1,
const float  k2,
const float  thetai,
const float  thetaf,
const int  rad,
const int  nSeg 
) [inline]

Draw a superquadric shape. nSeg defines the quality of the shape. ie. how many line to draw.

Definition at line 643 of file DrawOps.C.

References Point2D< T >::i.

void drawTraj ( Image< PixRGB< byte > > &  img,
const Point2D< int > *  foas_begin,
const Point2D< int > *  foas_end 
)

draw the trajectory for the points in foas onto img

Yellow circles and red arrows are drawn, connecting the points in foas.

Parameters:
foas a vector with the foci of attention ised for drawing

Definition at line 59 of file DrawOps.C.

References drawArrow(), and drawCircle().

Image< PixRGB<byte> > formatMapForDisplay ( const Image< float > &  img,
const float  factor,
const Dims newdims,
const bool  useInterp,
const ColorMap cmap,
const bool  showColorScale,
const char *  label 
)

Format a feature map for display.

Take an Image<float> feature map as input and convert it to PixRGB<byte> by either multiplying the values by a factor or by normalizing them to 0 .. 255 (if factor is 0.0), and then using a given color map (which will also be displayed if showColorScale is true). Then rescale to the specified dims, using interpolation if desired. Then write a descriptor label in the top-left corner using a large font, and finally show the original range of values in the bottom-right corner uing a tiny font.

Definition at line 1056 of file DrawOps.C.

References colorize(), drawRect(), SimpleFont::FIXED(), Image< T >::getHeight(), getMinMax(), Image< T >::getVal(), Image< T >::getWidth(), SimpleFont::h(), Image< T >::initialized(), inplaceNormalize(), Image< T >::resize(), sformat(), Rectangle::tlbrI(), SimpleFont::w(), and writeText().

Image< PixRGB<byte> > highlightRegions ( const Image< PixRGB< byte > > &  img,
const Image< byte > &  mask,
const int  maxval 
)

highlight an image in the regions given by a mask

Definition at line 124 of file DrawOps.C.

References binaryReverse(), chamfer34(), inplaceNormalize(), and Image< T >::setVal().

Referenced by SimulationViewerStd::getTraj().

void inplaceSetValMask ( Image< float > &  dest,
const Image< byte > &  mask,
const float  val 
)

Set values at all locations where mask is non-zero.

Definition at line 152 of file DrawOps.C.

References ASSERT, Image< T >::begin(), Image< T >::beginw(), Image< T >::endw(), and Image< T >::isSameSize().

template<typename T , class U >
Image<PixRGB<byte> > linePlot ( const U &  points,
const int  w,
const int  h,
const T &  minVal = T(),
const T &  maxVal = T(),
const char *  title = "",
const char *  yLabel = "",
const char *  xLabel = "",
const PixRGB< byte > &  linecol = PixRGBbyte >(0, 0, 0),
const PixRGB< byte > &  bckcol = PixRGBbyte >(255, 255, 255),
const int  numticks = 4,
const bool  axisonright = false 
) [inline]

Generate a plot from a vector of points. Choose numticks < 0 to disable x and y axes tick marks. class U should be a deque or vector

Definition at line 1132 of file DrawOps.C.

References SimpleFont::fixedMaxHeight(), flipVertic(), SimpleFont::h(), Point2D< T >::i, sformat(), Image< T >::size(), transpose(), SimpleFont::w(), writeText(), and ZEROS.

Referenced by SVEMNPlot::PlotBuf::draw(), and PlotBuffer::draw().

template<typename T >
Image<PixRGB<byte> > multilinePlot ( const std::vector< std::vector< T > > &  lines,
const int  w,
const int  h,
minVal,
maxVal,
const char *  title,
const char *  ylabel,
const char *  xlabel,
const std::vector< PixRGB< byte > > &  linescolor,
const PixRGB< byte > &  gridcolor,
const PixRGB< byte > &  bckcolor 
) [inline]

Generate multiline plot from a vector of lines.

Definition at line 1299 of file DrawOps.C.

References SimpleFont::fixedMaxHeight(), flipVertic(), SimpleFont::h(), Point2D< T >::i, min(), sformat(), transpose(), SimpleFont::w(), writeText(), and ZEROS.

template<class T >
Image<PixRGB<T> > warp3D ( const Image< PixRGB< T > > &  ima,
const Image< float > &  zmap,
const float  pitch,
const float  yaw,
const float  zMax,
Dims dims 
) [inline]

Warp image in 3D onto z-map.

Parameters:
ima Input image
zmap Height map of same size as ima
pitch 3D pitch angle, in degrees
yaw 3D yaw angle, in degrees
dims The result will have these dimensions, unless the dimensions are empty (i.e. 0-by-0), in which case the result will be the best size computed from ima's size and the pitch and yaw angles.

Definition at line 922 of file DrawOps.C.

References ASSERT, clampValue(), Image< T >::getHeight(), Image< T >::getVal(), Image< T >::getWidth(), Dims::h(), Dims::isEmpty(), Image< T >::isSameSize(), max(), min(), Image< T >::setVal(), Dims::w(), and ZEROS.

Referenced by warp3Dmap().

Image< PixRGB<byte> > warp3Dmap ( const Image< PixRGB< byte > > &  img,
const Image< float > &  hmap,
const float  pitch,
const float  yaw,
Dims imdims 
)

warp image onto height map

Definition at line 137 of file DrawOps.C.

References Image< T >::getWidth(), inplaceClamp(), lowPass9(), rescale(), and warp3D().

Referenced by SimulationViewerStd::getTraj(), and SimulationViewerNerdCam::saveResults().

Generated on Sun May 8 08:42:41 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3