Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Classes | Functions
drwnVisionUtils.h File Reference

Computer vision utility functions (not dependent on OpenCV functions, but may use OpenCV data structures). More...

Go to the source code of this file.

Classes

class  drwnWeightedPixelEdge
 Weighted undirected arc between pixels in an image. More...
 

Functions

double drwnPyramidScale (int lambda)
 Image rescaling factor for lambda levels per octave.
 
cv::Rect drwnTransformROI (const cv::Rect &roi, const cv::Size &srcSize, const cv::Size &dstSize)
 Maps a region of interest from one image scale to another.
 
void drwnLoadPixelLabels (cv::Mat &pixelLabels, const char *filename)
 Load an over-segmentation (superpixel image) or pixel labeling from a .png or .txt file. Checks size if pixelLabels is not empty. More...
 
void drwnLoadPixelLabels (cv::Mat &pixelLabels, const char *filename, int numLabels)
 Load an over-segmentation (superpixel image) or pixel labeling from a .png or .txt file. Checks size if pixelLabels is not empty. Replaces any value greater than or equal to numLabels with -1.
 
void drwnLoadPixelLabels (MatrixXi &pixelLabels, const char *filename, int numLabels=DRWN_INT_MAX)
 Load an over-segmentation (superpixel image) or pixel labeling from a .png or .txt file. Checks size if pixelLabels is not empty. Replaces any value greater than or equal to numLabels with -1.
 
int drwnConnectedComponents (cv::Mat &segments, bool b8Connected=false)
 Finds connected components in an over-segmentation and renumbers superpixels contiguously from 0. Second argument controls whether connectivity is defined on a 4-connected or 8-connected neighborhood. Returns the number of connected components.
 
int drwnConnectedComponents (MatrixXi &segments, bool b8Connected=false)
 See above.
 
cv::Mat drwnFastSuperpixels (const cv::Mat &img, unsigned gridSize)
 Generates an over-segmentation (superpixels) of an image. The parameter gridSize controls the number of superpixels. A value of 10 will produce about 100 superpixels.
 
cv::Mat drwnKMeansSegments (const cv::Mat &img, unsigned numCentroids)
 Generates an over-segmentation (superpixels) of an image as a set of disconnected regions. The parameter numCentroids controls the number of regions. A value of 10 will produce up to 10 regions.
 
cv::Mat drwnSLICSuperpixels (const cv::Mat &img, unsigned nClusters, double spatialWeight=200.0, double threshold=1.0e-3)
 Generates an over-segmentation (superpixels) of an image based on the SLIC algorithm (Achanta et al., PAMI 2012). The parameter nClusters controls the number of superpixels, the parameter spatialWeight controls the relative weight of the spatial term, and the parameter threshold (between 0 and 1) defines a stopping criteria. The image schould be provided in CIELAB format. More...
 
void drwnMergeSuperpixels (const cv::Mat &img, cv::Mat &seg, unsigned maxSegs)
 Merges small superpixels into neighbours until at most maxSegs remain. More...
 
std::vector< std::pair
< cv::Mat, unsigned > > 
drwnLoadCIFAR (const string &filename, unsigned headerBytes=1, cv::Size sz=cv::Size(32, 32), unsigned nChannels=3)
 Loads CIFAR-10, CIFAR-100 or similarly stored datasets, where images are stored in binary row-major order with prepended byte label. Data is returned as a vector of image-label pairs. Set headerBytes to 2 for CIFAR-100.
 

Detailed Description

Computer vision utility functions (not dependent on OpenCV functions, but may use OpenCV data structures).

Function Documentation

void drwnLoadPixelLabels ( cv::Mat &  pixelLabels,
const char *  filename 
)

Load an over-segmentation (superpixel image) or pixel labeling from a .png or .txt file. Checks size if pixelLabels is not empty.

Bug:
8-bit png files with colour tables are automatically converted to greyscale images. We'd like to just load their indexes.
void drwnMergeSuperpixels ( const cv::Mat &  img,
cv::Mat &  seg,
unsigned  maxSegs 
)

Merges small superpixels into neighbours until at most maxSegs remain.

Todo:
look for "best matching" neighbour to merge with
cv::Mat drwnSLICSuperpixels ( const cv::Mat &  img,
unsigned  nClusters,
double  spatialWeight = 200.0,
double  threshold = 1.0e-3 
)

Generates an over-segmentation (superpixels) of an image based on the SLIC algorithm (Achanta et al., PAMI 2012). The parameter nClusters controls the number of superpixels, the parameter spatialWeight controls the relative weight of the spatial term, and the parameter threshold (between 0 and 1) defines a stopping criteria. The image schould be provided in CIELAB format.

Todo:
replace with separate x and y grid sizes