35 using namespace Eigen;
47 w(_w), p(_p), q(_q) { };
52 if (w < e.
w)
return true;
53 if (w > e.
w)
return false;
54 if (p.y < e.
p.y)
return true;
55 if (p.y > e.
p.y)
return false;
56 if (p.x < e.
p.x)
return true;
57 if (p.x > e.
p.x)
return false;
58 if (q.y < e.
q.y)
return true;
59 if (q.y > e.
q.y)
return false;
66 return exp(-1.0 * log(2.0) / (
double)lambda);
70 cv::Rect
drwnTransformROI(
const cv::Rect& roi,
const cv::Size& srcSize,
const cv::Size& dstSize);
87 int numLabels = DRWN_INT_MAX);
114 double spatialWeight = 200.0,
double threshold = 1.0e-3);
124 std::vector<std::pair<cv::Mat, unsigned> >
drwnLoadCIFAR(
const string& filename,
125 unsigned headerBytes = 1, cv::Size sz = cv::Size(32, 32),
unsigned nChannels = 3);
void drwnMergeSuperpixels(const cv::Mat &img, cv::Mat &seg, unsigned maxSegs)
Merges small superpixels into neighbours until at most maxSegs remain.
Definition: drwnVisionUtils.cpp:617
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.
Definition: drwnVisionUtils.cpp:34
int drwnConnectedComponents(cv::Mat &segments, bool b8Connected=false)
Finds connected components in an over-segmentation and renumbers superpixels contiguously from 0...
Definition: drwnVisionUtils.cpp:142
void drwnLoadPixelLabels(cv::Mat &pixelLabels, const char *filename)
Load an over-segmentation (superpixel image) or pixel labeling from a .png or .txt file...
Definition: drwnVisionUtils.cpp:45
cv::Point q
second pixel
Definition: drwnVisionUtils.h:42
double w
weight
Definition: drwnVisionUtils.h:40
Weighted undirected arc between pixels in an image.
Definition: drwnVisionUtils.h:38
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...
Definition: drwnVisionUtils.cpp:472
cv::Mat drwnKMeansSegments(const cv::Mat &img, unsigned numCentroids)
Generates an over-segmentation (superpixels) of an image as a set of disconnected regions...
Definition: drwnVisionUtils.cpp:408
cv::Point p
first pixel
Definition: drwnVisionUtils.h:41
bool operator<(const drwnWeightedPixelEdge &e) const
default comparison for sorting
Definition: drwnVisionUtils.h:51
double drwnPyramidScale(int lambda)
Image rescaling factor for lambda levels per octave.
Definition: drwnVisionUtils.h:65
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 o...
Definition: drwnVisionUtils.cpp:708
cv::Mat drwnFastSuperpixels(const cv::Mat &img, unsigned gridSize)
Generates an over-segmentation (superpixels) of an image. The parameter gridSize controls the number ...
Definition: drwnVisionUtils.cpp:300