Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

visops Namespace Reference

Visual routines operators, used in DualCoding. More...

Enumerations

enum  Connectivity_t { FourWayConnect, EightWayConnect }
 

Connectivity used by oldlabelcc and neighborsum.

More...

Functions

std::vector< xyPairboundaryPoints (const Sketch< uint > &dest, uint &mindist, const uint maxval)
bool radiate (const xyPair center, Sketch< uint > &dist, const Sketch< bool > &dest, const Sketch< bool > &obst, const uint maxval)
Sketch< uint > ebdist (const Sketch< bool > &dest, const Sketch< bool > &obst, const uint maxdist, const uint time)
Sketch< uint > bdist (const Sketch< bool > &dest, const Sketch< bool > &obst, const uint maxdist)
Sketch< uint > areacc (const Sketch< uint > &labels)
void fillExteriorHelper (const Sketch< uint > &regions, Sketch< bool > &result, std::vector< bool > &processed, const int x, const int y)
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.
Sketch creation

template<class T >
DualCoding::Sketch< Tcopy (const Sketch< T > &other)
 Returns a deep copy of the sketch: actually copies the pixels.
Sketch< bool > zeros (SketchSpace &space)
 Returns an all-zero Sketch<bool> in the specified sketch space.
Sketch< bool > zeros (const SketchRoot &sketch)
 Returns an all-zero Sketch<bool> of same size as parent sketch.
Miscellaneous functions

Sketch< bool > colormask (const Sketch< uchar > &src, const std::string &colorname)
 Returns all the pixels of the named color.
Sketch< bool > colormask (const Sketch< uchar > &src, color_index cindex)
 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< 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.
Edge and symmetry detection

Sketch< bool > edge (const Sketch< bool > &im)
 Simple edge finding. Use SUSAN for more sophisticated edge detection.
Sketch< bool > horsym (const Sketch< bool > &sketch, size_t minskip=3, size_t maxskip=80)
 Horizontal symmetry points.
Sketch< bool > versym (const Sketch< bool > &sketch, size_t minskip=3, size_t maxskip=80)
 Vertical symmetry points.
Sketch< bool > skel (const Sketch< bool > &sketch)
 returns a skeleton of sketch, with pixel values corresponding to distance of symmetry
Region filling

Sketch< bool > seedfill (const Sketch< bool > &borders, size_t index)
 Fills a region bounded by borders, starting at position given by index.
Sketch< bool > fillExterior (const Sketch< bool > &borders)
 Fills the exterior of region bounded by borders, starting from the edges of the sketch; border pixels are not filled.
Sketch< bool > fillInterior (const Sketch< bool > &borders)
 Fills the interior of region bounded by borders, i.e., pixels not reachable from the edges of the sketch; border pixels are not filled.
Sketch dissection

Sketch< bool > leftHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Sketch< bool > rightHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Sketch< bool > topHalfPlane (const Shape< LineData > &ln)
Sketch< bool > bottomHalfPlane (const Shape< LineData > &ln)
 Half-plane functions fill in the half plane on one side of a line.
Image manipulation primitives

Sketch< ucharsusan_edges (const Sketch< uchar > &im, int brightness)
 Runs the SUSAN edge detector on a grayscale image.
Sketch< bool > susan_edge_points (const Sketch< uchar > &im, int brightness)
 Returns a Sketch<bool> indicating edge points found by SUSAN.
Sketch< uintconvolve (const Sketch< uchar > &sketch, Sketch< uchar > &kernel, int i, int j, int width, int height)
 Convolves a kernel with an image.
Sketch< uinttemplateMatch (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< Tmax (const Sketch< T > &src, const T value)
 Max of each pixel with a constant.
template<class T >
Sketch< Tmax (const Sketch< T > &src, const int value)
 Max of each pixel with a constant.
template<class T >
Sketch< Tmax (const Sketch< T > &arg1, const Sketch< T > &arg2)
 Pixel-wise max of two sketches.
template<class T >
Sketch< Tmin (const Sketch< T > &src, const T value)
 Min of each pixel with a constant.
template<class T >
Sketch< Tmin (const Sketch< T > &src, const int value)
 Min of each pixel with a constant.
template<class T >
Sketch< Tmin (const Sketch< T > &arg1, const Sketch< T > &arg2)
 Pixel-wise min of two sketches.
Masking and conditional assignment

template<typename T >
Sketch< Tmask (const Sketch< T > &A, const Sketch< bool > &B)
 Returns pixels of A masked by bool sketch B.
template<typename T >
Sketch< TifNot (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< TmaskedAssign (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< TmaskedAssign (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.

Wavefront algorithms: distance, connected components



typedef std::pair< int, int > xyPair
 Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.
Sketch< uintmdist (const Sketch< bool > &dest)
 Manhattan distance to the nearest true pixel in dest.
Sketch< floatedist (const Sketch< bool > &dest)
 Euclidean distance to the nearest true pixel in dest.
Sketch< uintlabelcc (const Sketch< bool > &source, int minarea=1)
 Connected components labeling using CMVision. Components numbered sequentially from 1.
Sketch< uintoldlabelcc (const Sketch< bool > &source, Connectivity_t connectivity=EightWayConnect)
 Old connected-components code written using pure sketch primitives.
Sketch< uintareacc (const Sketch< bool > &source, Connectivity_t connectivity=EightWayConnect)
 Each pixel of the result is the area of that connected component.
Sketch< bool > minArea (const Sketch< bool > &sketch, int minval=5)
 Low-pass filter by eliminating small regions.
Sketch< uintbdist (const Sketch< bool > &dest, const Sketch< bool > &obst, const uint maxdist=(uint)-1)
 Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.
std::vector< xyPairboundaryPoints (const Sketch< uint > &dest, uint &mindist, const uint maxval=(uint)-1)
 Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.
bool radiate (const xyPair center, Sketch< uint > &dest, const Sketch< bool > &obst, const uint maxval=(uint)-1)
 Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.
Sketch< uintebdist (const Sketch< bool > &dest, const Sketch< bool > &obst, const uint maxdist=(uint)-1, const uint time=3)
 Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.
Sketch< uintareacc (const Sketch< uint > &labels)
 Each pixel of the result is the area of that connected component.

Detailed Description

Visual routines operators, used in DualCoding.


Typedef Documentation

typedef std::pair<int,int> xyPair

Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.

Definition at line 149 of file visops.h.


Enumeration Type Documentation

Connectivity used by oldlabelcc and neighborsum.

Enumerator:
FourWayConnect 
EightWayConnect 

Definition at line 23 of file visops.h.


Function Documentation

Sketch<uint> visops::areacc ( const Sketch< uint > &  labels  ) 

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

Sketch<uint> visops::areacc ( const Sketch< uint > &  labels  ) 

Definition at line 576 of file visops.cc.

Sketch< uint > areacc ( const Sketch< bool > &  source,
Connectivity_t  connectivity 
)

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

Sketch<uint> visops::bdist ( const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const uint  maxdist = (uint)-1 
)

Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.

Sketch<uint> visops::bdist ( const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const uint  maxdist 
)

Definition at line 189 of file visops.cc.

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

std::vector<xyPair> visops::boundaryPoints ( const Sketch< uint > &  dest,
uint mindist,
const uint  maxval = (uint)-1 
)

Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.

std::vector<xyPair> visops::boundaryPoints ( const Sketch< uint > &  dest,
uint &  mindist,
const uint  maxval 
)

Definition at line 36 of file visops.cc.

Referenced by ebdist().

Sketch< bool > colormask ( const Sketch< uchar > &  src,
color_index  cindex 
)

Returns all the pixels with the specified color index.

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

Returns all the pixels of the named color.

Referenced by TargetData::extractLineTarget(), AgentData::findCirclesManual(), and SphereData::get_spheres().

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

Convolves a kernel with an image.

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

Returns a deep copy of the sketch: actually copies the pixels.

Definition at line 36 of file visops.h.

Referenced by LineData::extractLine(), and LineData::extractLines().

Sketch<uint> visops::ebdist ( const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const uint  maxdist = (uint)-1,
const uint  time = 3 
)

Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.

Sketch<uint> visops::ebdist ( const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const uint  maxdist,
const uint  time 
)

Definition at line 139 of file visops.cc.

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.

Sketch< float > 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.

Sketch< bool > fillExterior ( const Sketch< bool > &  borders  ) 

Fills the exterior of region bounded by borders, starting from the edges of the sketch; border pixels are not filled.

void visops::fillExteriorHelper ( const Sketch< uint > &  regions,
Sketch< bool > &  result,
std::vector< bool > &  processed,
const int  x,
const int  y 
)

Definition at line 766 of file visops.cc.

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
Sketch< bool > fillInterior ( const Sketch< bool > &  borders  ) 

Fills the interior of region bounded by borders, i.e., pixels not reachable from the edges of the sketch; border pixels are not filled.

Sketch< bool > horsym ( const Sketch< bool > &  sketch,
size_t  minskip = 3,
size_t  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.
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 208 of file visops.h.

Sketch< uint > labelcc ( const Sketch< bool > &  sketch,
int  minarea 
)

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

Referenced by AgentData::findCirclesManual().

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

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

Returns pixels of A masked by bool sketch B.

Definition at line 194 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 239 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 223 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 65 of file visops.h.

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

Max of each pixel with a constant.

Definition at line 58 of file visops.h.

Sketch< uint > mdist ( const Sketch< bool > &  dest  ) 

Manhattan distance to the nearest true pixel in dest.

Should calculate the Manhattan 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.

Referenced by LineData::clearLine(), BrickData::extractBrick(), PyramidData::extractPyramid(), LineData::houghExtractLines(), and LineData::houghTransform().

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

Pixel-wise min of two sketches.

Definition at line 89 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 83 of file visops.h.

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

Low-pass filter by eliminating small regions.

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

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

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.

Referenced by LineData::houghExtractLines().

Sketch< uint > 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.

Referenced by EllipseData::extractEllipses(), NaughtData::extractNaughts(), and SphereData::extractSpheres().

bool visops::radiate ( const xyPair  center,
Sketch< uint > &  dest,
const Sketch< bool > &  obst,
const uint  maxval = (uint)-1 
)

Calculates the distance from each pixel in the image to the closest true pixel in destination dest, using the wavefront algorithm. Obstacles indicated by true values in pixels of obst. Note: use maxdist=width+height if you want the result to be viewable with the jetMapScaled colormap.

bool visops::radiate ( const xyPair  center,
Sketch< uint > &  dist,
const Sketch< bool > &  dest,
const Sketch< bool > &  obst,
const uint  maxval 
)

Definition at line 76 of file visops.cc.

Referenced by ebdist().

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

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

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

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

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

Referenced by ShapeSpace::getShapeListForGUI().

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

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

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

Runs the SUSAN edge detector on a grayscale image.

Sketch< uint > 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.

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

Todo:
**** visops::topHalfPlane needs to check the SketchSpace ReferenceFrameType because "left" means different things in different reference frames

Referenced by BlobData::findCornersDiagonal().

Sketch< bool > versym ( const Sketch< bool > &  sketch,
size_t  minskip = 3,
size_t  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.
Sketch< bool > zeros ( const SketchRoot &  other  ) 

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

Sketch< bool > zeros ( SketchSpace &  space  ) 

Returns an all-zero Sketch<bool> in the specified sketch space.

Referenced by TargetData::extractLineTarget(), AgentData::findCirclesManual(), and SketchIndices::getRendering().


DualCoding 5.1CVS
Generated Mon May 9 04:56:32 2016 by Doxygen 1.6.3