Homepage Demos Overview Downloads Tutorials Reference
Credits

visops Namespace Reference


Detailed Description

Visual routines operators, used in DualCoding.


Sketch creation

template<class T>
DualCoding::Sketch< T > copy (const Sketch< T > &other)
 Returns a copy of the sketch.
Sketch< boolzeros (SketchSpace &space)
 Returns an all-zero Sketch<bool> in the specified sketch space.
Sketch< boolzeros (const SketchRoot &sketch)
 Returns an all-zero Sketch<bool> of same size as parent sketch.

Miscellaneous functions

Sketch< boolcolormask (const Sketch< uchar > &src, const std::string colorname)
 Returns all the pixels of the named color.
Sketch< boolcolormask (const Sketch< uchar > &src, int color_idx)
 Returns all the pixels with the specified color index.
Sketch< ucharneighborSum (const Sketch< bool > &im, Connectivity_t connectivity=EightWayConnect)
 For each pixel, calculate the sum of its neighbors.
Sketch< boolfillin (const Sketch< bool > &im, int iter, uchar min_thresh, uchar max_thresh, bool remove_only=false)
 Produces a filled in image based on the Sketch, using 8-way connectivity.
Sketch< boolseedfill (const Sketch< bool > &borders, size_t index)
 Fills a region bounded by borders, starting at position given by index.

Wavefront algorithms: distance, connected components

Sketch< usintbdist (const Sketch< bool > &dest, const Sketch< bool > &obst, const int maxdist=100)
 Calculates the distance from each pixel in the image to the closest true pixel in dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst.
Sketch< usintedist (const Sketch< bool > &dest)
 Euclidean distance to the nearest true pixel in dest.
Sketch< usintlabelcc (const Sketch< bool > &source, int minarea=1)
 Connected components labeling using CMVision. Components numbered sequentially from 1.
Sketch< usintoldlabelcc (const Sketch< bool > &source, Connectivity_t connectivity=EightWayConnect)
 Old connected-components code written using pure sketch primitives.
Sketch< usintareacc (const Sketch< bool > &source, Connectivity_t connectivity=EightWayConnect)
 Each pixel of the result is the area of that connected component.
Sketch< usintareacc (const Sketch< usint > &labels)
 Each pixel of the result is the area of that connected component.
Sketch< boolminArea (const Sketch< bool > &sketch, int minval=5)
 Low-pass filter by eliminating small regions.

Edge and symmetry detection

Sketch< booledge (const Sketch< bool > &im)
 Simple edge finding. Use SUSAN for more sophisticated edge detection.
Sketch< boolhorsym (const Sketch< bool > &sketch, int minskip=3, int maxskip=80)
 Horizontal symmetry points. Returns non-zero values along points of horizontal symmetry, with each of these values equal to the distance to the symmetric points.
Sketch< boolversym (const Sketch< bool > &sketch, int minskip=3, int maxskip=80)
 Vertical symmetry points. Returns non-zero values along points of vertical symmetry, with each of these values equal to the distance to the symmetric points.
Sketch< boolskel (const Sketch< bool > &sketch)
 returns a skeleton of sketch, with pixel values corresponding to distance of symmetry

Sketch dissection

Sketch< boolleftHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Sketch< boolrightHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Sketch< booltopHalfPlane (const Shape< LineData > &ln)
Sketch< boolbottomHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Sketch< boolnon_bounds (const Sketch< bool > &im, int offset)
 Returns a copy of im except that its pixels within offset from boundaries are removed.

Image manipulation primitives

Sketch< ucharsusan_edges (const Sketch< uchar > &im, int brightness)
 Runs the SUSAN edge detector on a grayscale image.
Sketch< boolsusan_edge_points (const Sketch< uchar > &im, int brightness)
 Returns a Sketch<bool> indicating edge points found by SUSAN.
Sketch< usintconvolve (const Sketch< uchar > &sketch, Sketch< uchar > &kernel, int i, int j, int width, int height)
 Convolves a kernel with an image.
Sketch< usinttemplateMatch (const Sketch< uchar > &sketch, Sketch< uchar > &kernel, int i, int j, int width, int height)
 Convolves a kernel with an image, normalizing the kernel to zero mean.

Min/max functions

template<class T>
Sketch< T > max (const Sketch< T > &src, const T value)
 Max of each pixel with a constant.
template<class T>
Sketch< T > max (const Sketch< T > &src, const int value)
 Max of each pixel with a constant.
template<class T>
Sketch< T > max (const Sketch< T > &arg1, const Sketch< T > &arg2)
 Pixel-wise max of two sketches.
template<class T>
Sketch< T > min (const Sketch< T > &src, const T value)
 Min of each pixel with a constant.
template<class T>
Sketch< T > min (const Sketch< T > &src, const int value)
 Min of each pixel with a constant.
template<class T>
Sketch< T > min (const Sketch< T > &arg1, const Sketch< T > &arg2)
 Pixel-wise min of two sketches.

Conditional assignment

template<typename T>
Sketch< T > ifNot (const Sketch< T > &A, const Sketch< T > &B)
 Result holds non-zero pixels of A, with zero pixels filled in by B.
template<typename T, typename Tv>
Sketch< T > maskedAssign (const Sketch< T > &sketch, const Sketch< bool > &mask, const Tv value)
 Returns a result where pixels of sketch for which mask is true have been replaced by value.
template<typename T>
Sketch< T > maskedAssign (const Sketch< T > &sketch, const Sketch< bool > &mask, const Sketch< T > &value)
 Returns a result where pixels of sketch for which mask is true have been replaced by corresponding pixels of value.

Enumerations

enum  Connectivity_t { FourWayConnect, EightWayConnect }
 Connectivity used by oldlabelcc and neighborsum. More...


Enumeration Type Documentation

Connectivity used by oldlabelcc and neighborsum.

Enumerator:
FourWayConnect 
EightWayConnect 

Definition at line 20 of file visops.h.


Function Documentation

Sketch< T > copy ( const DualCoding::Sketch< T > &  other  ) 

Returns a copy of the sketch.

Definition at line 33 of file visops.h.

Referenced by LineData::extractLines(), fillin(), non_bounds(), DualCoding::operator<<(), and susan_edges().

Sketch< bool > zeros ( SketchSpace space  ) 

Sketch< bool > zeros ( const SketchRoot other  ) 

Returns an all-zero Sketch<bool> of same size as parent sketch.

Definition at line 18 of file visops.cc.

Sketch< bool > colormask ( const Sketch< uchar > &  src,
std::string  colorname 
)

Returns all the pixels of the named color.

Definition at line 25 of file visops.cc.

Referenced by MapBuilder::getCamEllipses(), MapBuilder::getCamLines(), MapBuilder::getCamPolygons(), MapBuilder::getCamSpheres(), and MapBuilder::getCamWalls().

Sketch< bool > colormask ( const Sketch< uchar > &  src,
int  color_idx 
)

Returns all the pixels with the specified color index.

Definition at line 29 of file visops.cc.

Sketch< usint > bdist ( const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const int  maxdist = 100 
)

Calculates the distance from each pixel in the image to the closest true pixel in dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst.

Definition at line 35 of file visops.cc.

Referenced by PolygonData::render().

Sketch< usint > edist ( const Sketch< bool > &  dest  ) 

Euclidean distance to the nearest true pixel in dest.

Should calculate the Euclidean distance from each pixel in the image to the closest true pixel in dest, using a linear-time algorithm. Currently calculates Manhattan distance, which is good enough. Should be used instead of bdist if not concerned about obstacles.

Definition at line 70 of file visops.cc.

Referenced by LineData::clearLine(), BrickData::extractBrick(), LineData::extractLine(), PyramidData::extractPyramid(), MapBuilder::getCamWalls(), LineData::houghTransform(), and LineData::splitLine().

Sketch< usint > labelcc ( const Sketch< bool > &  sketch,
int  minarea = 1 
)

Connected components labeling using CMVision. Components numbered sequentially from 1.

Definition at line 125 of file visops.cc.

Referenced by minArea().

Sketch< usint > oldlabelcc ( const Sketch< bool > &  source,
Connectivity_t  connectivity = EightWayConnect 
)

Old connected-components code written using pure sketch primitives.

Returns a connected-components labeling of the foreground. Each different foreground region will contain a unique positive integer. No guarantees on the integer values.

Definition at line 177 of file visops.cc.

Referenced by areacc(), EllipseData::extractEllipses(), LineData::extractLine(), SphereData::extractSpheres(), and seedfill().

Sketch< usint > areacc ( const Sketch< bool > &  source,
Connectivity_t  connectivity = EightWayConnect 
)

Each pixel of the result is the area of that connected component.

Definition at line 283 of file visops.cc.

Referenced by minArea().

Sketch< usint > areacc ( const Sketch< usint > &  labels  ) 

Each pixel of the result is the area of that connected component.

Definition at line 288 of file visops.cc.

Sketch< bool > minArea ( const Sketch< bool > &  sketch,
int  minval = 5 
)

Low-pass filter by eliminating small regions.

Definition at line 299 of file visops.cc.

Referenced by MapBuilder::getCamLines().

Sketch< uchar > neighborSum ( const Sketch< bool > &  im,
Connectivity_t  connectivity = EightWayConnect 
)

For each pixel, calculate the sum of its neighbors.

Parameters:
im Sketch to use as input.
connectivity the type of neighbor connectivity to use

Definition at line 306 of file visops.cc.

Referenced by PolygonData::convexHull(), fillin(), and BlobData::findCornersShapeFit().

Sketch< bool > fillin ( const Sketch< bool > &  im,
int  iter,
uchar  min_thresh,
uchar  max_thresh,
bool  remove_only = false 
)

Produces a filled in image based on the Sketch, using 8-way connectivity.

Parameters:
im The sketch to which to apply the function.
iter Number of times to perform the fillin operation.
min_thresh Fill in pixel if has at least this many neighbors.
max_thresh Fill in pixel if has fewer than this many neighbors.
remove_only Set to true if you know you will only be deleting pixels for a speedup

Definition at line 330 of file visops.cc.

Referenced by LineData::extractLine(), LineData::extractLines(), MapBuilder::getCamLines(), MapBuilder::getCamPolygons(), and MapBuilder::getCamWalls().

Sketch< bool > edge ( const Sketch< bool > &  im  ) 

Simple edge finding. Use SUSAN for more sophisticated edge detection.

This edge-finding algorithm is inefficient, and produces offset results for top and left edges. Should replace it with something better.

Definition at line 354 of file visops.cc.

Referenced by PathPlanner::findLinks(), and DualCoding::findRadialDistancesFromPoint().

Sketch< bool > horsym ( const Sketch< bool > &  sketch,
int  minskip = 3,
int  maxskip = 80 
)

Horizontal symmetry points. Returns non-zero values along points of horizontal symmetry, with each of these values equal to the distance to the symmetric points.

Parameters:
sketch The sketch to which to apply the function.
minskip The min accepted distance between pixels for symmetry.
maxskip The max accepted distance between pixels for symmetry.

Definition at line 361 of file visops.cc.

Referenced by skel().

Sketch< bool > versym ( const Sketch< bool > &  sketch,
int  minskip = 3,
int  maxskip = 80 
)

Vertical symmetry points. Returns non-zero values along points of vertical symmetry, with each of these values equal to the distance to the symmetric points.

Parameters:
sketch The sketch to which to apply the function.
minskip The min accepted distance between pixels for symmetry.
maxskip The max accepted distance between pixels for symmetry.

Definition at line 386 of file visops.cc.

Referenced by skel().

Sketch< bool > skel ( const Sketch< bool > &  im  ) 

returns a skeleton of sketch, with pixel values corresponding to distance of symmetry

Definition at line 445 of file visops.cc.

Referenced by LineData::extractLine(), LineData::extractLines(), MapBuilder::getCamLines(), MapBuilder::getCamPolygons(), and MapBuilder::getCamWalls().

Sketch< bool > seedfill ( const Sketch< bool > &  borders,
size_t  index 
)

Fills a region bounded by borders, starting at position given by index.

Definition at line 452 of file visops.cc.

Referenced by leftHalfPlane(), and topHalfPlane().

Sketch< bool > leftHalfPlane ( const Shape< LineData > &  ln  ) 

Half-plane functions fill in the half plane on one side of a line.

Todo:
**** THIS visops::leftHalfPlane CODE NEEDS TO CHECK THE SketchSpace ReferenceFrameType **** BECAUSE "left" MEANS DIFFERENT THINGS IN DIFFERENT FRAMES

Definition at line 460 of file visops.cc.

Referenced by rightHalfPlane().

Sketch< bool > rightHalfPlane ( const Shape< LineData > &  ln  ) 

Half-plane functions fill in the half plane on one side of a line.

Todo:
**** THIS visops::leftHalfPlane CODE NEEDS TO CHECK THE SketchSpace ReferenceFrameType **** BECAUSE "left" MEANS DIFFERENT THINGS IN DIFFERENT FRAMES

Definition at line 489 of file visops.cc.

Sketch< bool > topHalfPlane ( const Shape< LineData > &  ln  ) 

Definition at line 497 of file visops.cc.

Referenced by bottomHalfPlane(), and BlobData::findCornersDiagonal().

Sketch< bool > bottomHalfPlane ( const Shape< LineData > &  ln  ) 

Half-plane functions fill in the half plane on one side of a line.

Todo:
**** THIS visops::leftHalfPlane CODE NEEDS TO CHECK THE SketchSpace ReferenceFrameType **** BECAUSE "left" MEANS DIFFERENT THINGS IN DIFFERENT FRAMES

Definition at line 526 of file visops.cc.

Sketch< bool > non_bounds ( const Sketch< bool > &  im,
int  offset 
)

Returns a copy of im except that its pixels within offset from boundaries are removed.

Definition at line 534 of file visops.cc.

Referenced by MapBuilder::getCamWalls().

Sketch< uchar > susan_edges ( const Sketch< uchar > &  im,
int  brightness 
)

Runs the SUSAN edge detector on a grayscale image.

Definition at line 556 of file visops.cc.

Sketch< bool > susan_edge_points ( const Sketch< uchar > &  im,
int  brightness 
)

Returns a Sketch<bool> indicating edge points found by SUSAN.

Definition at line 587 of file visops.cc.

Sketch< usint > convolve ( const Sketch< uchar > &  sketch,
Sketch< uchar > &  kernel,
int  istart,
int  jstart,
int  width,
int  height 
)

Convolves a kernel with an image.

Definition at line 607 of file visops.cc.

Sketch< usint > templateMatch ( const Sketch< uchar > &  sketch,
Sketch< uchar > &  kernel,
int  istart,
int  jstart,
int  width,
int  height 
)

Convolves a kernel with an image, normalizing the kernel to zero mean.

Definition at line 626 of file visops.cc.

Sketch<T> visops::max ( const Sketch< T > &  src,
const int  value 
)

Max of each pixel with a constant.

Definition at line 57 of file visops.h.

Sketch<T> visops::max ( const Sketch< T > &  arg1,
const Sketch< T > &  arg2 
)

Pixel-wise max of two sketches.

Definition at line 64 of file visops.h.

Sketch<T> visops::min ( const Sketch< T > &  src,
const int  value 
)

Min of each pixel with a constant.

Definition at line 82 of file visops.h.

Sketch<T> visops::min ( const Sketch< T > &  arg1,
const Sketch< T > &  arg2 
)

Pixel-wise min of two sketches.

Definition at line 88 of file visops.h.

Sketch<T> visops::ifNot ( const Sketch< T > &  A,
const Sketch< T > &  B 
)

Result holds non-zero pixels of A, with zero pixels filled in by B.

Equivalent to writing maskedAssign(A,A==0,B)

Definition at line 168 of file visops.h.

Sketch<T> visops::maskedAssign ( const Sketch< T > &  sketch,
const Sketch< bool > &  mask,
const Tv  value 
)

Returns a result where pixels of sketch for which mask is true have been replaced by value.

Definition at line 183 of file visops.h.

Sketch<T> visops::maskedAssign ( const Sketch< T > &  sketch,
const Sketch< bool > &  mask,
const Sketch< T > &  value 
)

Returns a result where pixels of sketch for which mask is true have been replaced by corresponding pixels of value.

Definition at line 199 of file visops.h.


DualCoding 3.0beta
Generated Wed Oct 4 00:02:32 2006 by Doxygen 1.4.7