Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drwnPatchMatch.h
1 /*****************************************************************************
2 ** DARWIN: A FRAMEWORK FOR MACHINE LEARNING RESEARCH AND DEVELOPMENT
3 ** Distributed under the terms of the BSD license (see the LICENSE file)
4 ** Copyright (c) 2007-2015, Stephen Gould
5 ** All rights reserved.
6 **
7 ******************************************************************************
8 ** FILENAME: drwnPatchMatch.h
9 ** AUTHOR(S): Stephen Gould <stephen.gould@anu.edu.au>
10 **
11 *****************************************************************************/
12 
13 #pragma once
14 
15 #include <cstdlib>
16 #if defined(_WIN32)||defined(WIN32)||defined(__WIN32__)||defined(__VISUALC__)
17 #include <cstdint>
18 #endif
19 #include <cassert>
20 #include <list>
21 
22 #include "cv.h"
23 
24 #include "drwnBase.h"
25 #include "drwnIO.h"
26 #include "drwnVision.h"
27 
28 using namespace std;
29 
30 // drwnPatchMatchStatus ------------------------------------------------------
33 
34 typedef enum { DRWN_PM_DIRTY,
35  DRWN_PM_PASS1,
36  DRWN_PM_PASS2
37 } drwnPatchMatchStatus;
38 
39 // drwnPatchMatchTransform ---------------------------------------------------
43 
44 typedef unsigned char drwnPatchMatchTransform;
45 
46 #define DRWN_PM_TRANSFORM_NONE 0x00
47 #define DRWN_PM_TRANSFORM_HFLIP 0x01
48 #define DRWN_PM_TRANSFORM_VFLIP 0x02
49 
51 inline drwnPatchMatchTransform drwnComposeTransforms(const drwnPatchMatchTransform& f,
52  const drwnPatchMatchTransform& g) {
53  return g ^ f; // xor transformations (horizontal and vertical flips)
54 }
55 
56 // drwnPatchMatchNode --------------------------------------------------------
65 
67  public:
68  uint16_t imgIndx;
69  uint8_t imgScale;
70  uint16_t xPosition;
71  uint16_t yPosition;
72 
73  public:
74  drwnPatchMatchNode() : imgIndx(-1), imgScale(0), xPosition(-1), yPosition(-1)
75  { /* do nothing */ };
76  drwnPatchMatchNode(uint16_t idx, uint8_t sc, uint16_t x, uint16_t y) :
77  imgIndx(idx), imgScale(sc), xPosition(x), yPosition(y) { /* do nothing */ };
78  drwnPatchMatchNode(uint16_t idx, uint8_t sc, const cv::Point& p) :
79  imgIndx(idx), imgScale(sc), xPosition(p.x), yPosition(p.y) { /* do nothing */ };
80  ~drwnPatchMatchNode() { /* do nothing */ };
81 
83  bool operator<(const drwnPatchMatchNode& node) const {
84  if (imgIndx < node.imgIndx) return true;
85  if (imgIndx > node.imgIndx) return false;
86  if (imgScale < node.imgScale) return true;
87  if (imgScale > node.imgScale) return false;
88  if (yPosition < node.yPosition) return true;
89  if (yPosition > node.yPosition) return false;
90  return (xPosition < node.xPosition);
91  }
92 
94  bool operator==(const drwnPatchMatchNode& node) const {
95  if (imgIndx != node.imgIndx) return false;
96  if (imgScale != node.imgScale) return false;
97  if (yPosition != node.yPosition) return false;
98  if (xPosition != node.xPosition) return false;
99  return true;
100  }
101 };
102 
103 // drwnPatchMatchEdge --------------------------------------------------------
108 
110  public:
111  float matchScore;
113  drwnPatchMatchTransform xform;
114 
115  drwnPatchMatchStatus status;
116 
117  public:
119  inline drwnPatchMatchEdge() : matchScore(DRWN_FLT_MAX),
120  xform(DRWN_PM_TRANSFORM_NONE), status(DRWN_PM_DIRTY) { /* do nothing */ };
122  inline drwnPatchMatchEdge(float score, const drwnPatchMatchNode& node,
123  const drwnPatchMatchTransform& patchXform) : matchScore(score), targetNode(node),
124  xform(patchXform), status(DRWN_PM_DIRTY) { /* do nothing */ };
125 
127  size_t numBytesOnDisk() const;
129  bool read(istream& is);
131  bool write(ostream& os) const;
132 
134  bool operator<(const drwnPatchMatchEdge& e) const {
135  return (matchScore < e.matchScore);
136  }
137 };
138 
139 // drwnPatchMatchEdge Utility Functions --------------------------------------
140 
141 inline bool drwnPatchMatchSortByScore(const drwnPatchMatchEdge& a, const drwnPatchMatchEdge& b)
142 {
143  return (a.matchScore < b.matchScore);
144 }
145 
146 inline bool drwnPatchMatchSortByImage(const drwnPatchMatchEdge& a, const drwnPatchMatchEdge& b)
147 {
148  return (a.targetNode.imgIndx < b.targetNode.imgIndx) ||
150 }
151 
152 string toString(const drwnPatchMatchEdge& e);
153 
154 // drwnPatchMatchEdgeList ----------------------------------------------------
157 
158 typedef vector<drwnPatchMatchEdge> drwnPatchMatchEdgeList;
159 
160 // drwnPatchMatchImageRecord ------------------------------------------------
162 
164  public:
165  static bool ALLOW_MULTIPLE;
166 
167  protected:
168  uint16_t _width;
169  uint16_t _height;
170 
172  vector<drwnPatchMatchEdgeList> _matches;
173 
174  public:
176  drwnPatchMatchImageRecord() : _width(0), _height(0) {
177  // do nothing
178  }
180  drwnPatchMatchImageRecord(uint16_t width, uint16_t height) : _width(width), _height(height) {
181  DRWN_ASSERT((width > 0) && (height > 0));
182  _matches.resize(width * height);
183  }
186  // do nothing
187  }
188 
190  uint16_t width() const { return _width; }
192  uint16_t height() const { return _height; }
194  size_t size() const { return _width * _height; }
195 
197  void clear();
198 
200  inline uint16_t x(int indx) const { return indx % _width; }
202  inline uint16_t y(int indx) const { return indx / _width; }
204  inline cv::Point index2pixel(int indx) const { return cv::Point(indx % _width, indx / _width); }
206  inline int pixel2index(uint16_t x, uint16_t y) const { return y * _width + x; }
207 
210  bool update(int indx, const drwnPatchMatchEdge& match);
213  inline bool update(uint16_t x, uint16_t y, const drwnPatchMatchEdge& match) {
214  return update(pixel2index(x, y), match);
215  }
216 
218  drwnPatchMatchEdgeList& operator()(uint16_t x, uint16_t y) { return _matches[y * _width + x]; }
220  const drwnPatchMatchEdgeList& operator()(uint16_t x, uint16_t y) const { return _matches[y * _width + x]; }
222  drwnPatchMatchEdgeList& operator[](int indx) { return _matches[indx]; }
224  const drwnPatchMatchEdgeList& operator[](int indx) const { return _matches[indx]; }
225 };
226 
227 // drwnPatchMatchImagePyramid -------------------------------------------------
230 
232  public:
233  static unsigned MAX_LEVELS;
234  static unsigned MAX_SIZE;
235  static unsigned MIN_SIZE;
236  static double PYR_SCALE;
237 
238  public:
242  bool bActive;
243 
247  int eqvClass;
248 
249  protected:
250  string _name;
251  uint16_t _width;
252  uint16_t _height;
253 
255  vector<drwnPatchMatchImageRecord> _levels;
256 
257  public:
260  bActive(true), eqvClass(-1), _name(""), _width(0), _height(0) {
261  // do nothing
262  }
264  drwnPatchMatchImagePyramid(const string& name, uint16_t width, uint16_t height) :
265  drwnPersistentRecord(), bActive(true), eqvClass(-1),
266  _name(name), _width(width), _height(height) {
267  DRWN_ASSERT((width > 0) && (height > 0));
268  constructPyramidLevels();
269  }
272  // do nothing
273  }
274 
276  const string& name() const { return _name; }
278  uint16_t width() const { return _width; }
280  uint16_t height() const { return _height; }
282  size_t levels() const { return _levels.size(); }
283 
285  void clear();
286 
287  // i/o (from drwnPersistentRecord)
288  size_t numBytesOnDisk() const;
289  bool write(ostream& os) const;
290  bool read(istream& is);
291 
293  inline cv::Point mapPixel(const cv::Point& p, int srcLevel, int dstLevel) const {
294  return cv::Point(p.x * _levels[dstLevel].width() / _levels[srcLevel].width(),
295  p.y * _levels[dstLevel].height() / _levels[srcLevel].height());
296  }
297 
300  bool samplePatchByScore(drwnPatchMatchNode& sample) const;
301 
303  drwnPatchMatchImageRecord& operator[](uint8_t indx) { return _levels[indx]; }
305  const drwnPatchMatchImageRecord& operator[](uint8_t indx) const { return _levels[indx]; }
306 
307  protected:
309  void constructPyramidLevels();
310 };
311 
312 // drwnPatchMatchGraph -------------------------------------------------------
322 
324  public:
325  static unsigned int PATCH_WIDTH;
326  static unsigned int PATCH_HEIGHT;
327  static unsigned int K;
328 
329  string imageDirectory;
330  string imageExtension;
331 
332  protected:
333  unsigned int _patchWidth;
334  unsigned int _patchHeight;
335  vector<drwnPatchMatchImagePyramid *> _images;
336 
337  public:
344 
346  bool write(const char *filestem) const;
348  bool read(const char *filestem);
349 
351  size_t size() const { return _images.size(); }
352 
354  unsigned int patchWidth() const { return _patchWidth; }
356  unsigned int patchHeight() const { return _patchHeight; }
357 
359  int findImage(const string& baseName) const;
361  void appendImage(const string& baseName);
363  void appendImage(const string& baseName, const cv::Size& imgSize);
365  void appendImages(const vector<string>& baseNames);
369  int removeImage(unsigned imgIndx);
370 
372  drwnPatchMatchEdgeList& edges(const drwnPatchMatchNode& node) {
373  DRWN_ASSERT(node.xPosition < (*_images[node.imgIndx])[node.imgScale].width());
374  DRWN_ASSERT(node.yPosition < (*_images[node.imgIndx])[node.imgScale].height());
375  return (*_images[node.imgIndx])[node.imgScale](node.xPosition, node.yPosition);
376  }
378  const drwnPatchMatchEdgeList& edges(const drwnPatchMatchNode& node) const {
379  DRWN_ASSERT(node.xPosition < (*_images[node.imgIndx])[node.imgScale].width());
380  DRWN_ASSERT(node.yPosition < (*_images[node.imgIndx])[node.imgScale].height());
381  return (*_images[node.imgIndx])[node.imgScale](node.xPosition, node.yPosition);
382  }
383 
385  pair<double, double> energy() const;
386 
388  string imageFilename(int indx) const { return imageFilename(_images[indx]->name()); }
390  string imageFilename(const string& baseName) const {
391  return imageDirectory.empty() ? baseName + imageExtension :
392  imageDirectory + DRWN_DIRSEP + baseName + imageExtension;
393  }
394 
396  inline drwnPatchMatchImagePyramid& operator[](unsigned indx) { return *_images[indx]; }
398  inline const drwnPatchMatchImagePyramid& operator[](unsigned indx) const { return *_images[indx]; }
399 };
400 
401 // drwnPatchMatchGraphLearner ------------------------------------------------
406 
408  public:
409  static double SEARCH_DECAY_RATE;
410  static int FORWARD_ENRICHMENT_K;
411  static bool DO_INVERSE_ENRICHMENT;
412  static bool DO_LOCAL_SEARCH;
413  static bool DO_EXHAUSTIVE;
414 
415  static drwnPatchMatchTransform ALLOWED_TRANSFORMATIONS;
416 
417  static double TOP_VAR_PATCHES;
418 
419 #ifdef DRWN_DEBUG_STATISTICS
420  static unsigned _dbPatchesScored;
421 #endif
422 
423  protected:
425  vector<vector<cv::Mat> > _features;
426 
427  public:
430  virtual ~drwnPatchMatchGraphLearner();
431 
434  void initialize();
436  virtual void initialize(unsigned imgIndx);
437 
439  void rescore();
440 
443  void update();
445  virtual void update(unsigned imgIndx);
446 
447  protected:
448  // --- feature calculation ---
449 
452  void cacheImageFeatures();
454  void cacheImageFeatures(unsigned imgIndx);
456  virtual void cacheImageFeatures(unsigned imgIndx, const cv::Mat& baseImg);
457 
460  int appendCIELabFeatures(const cv::Mat& img, cv::Mat& features, int nChannel = 0) const;
461  int appendVerticalFeatures(const cv::Mat& img, cv::Mat& features, int nChannel = 0) const;
462  int appendEdgeFeatures(const cv::Mat& img, cv::Mat& features, int nChannel = 0) const;
463  int appendTextonFilterFeatures(const cv::Mat& img, cv::Mat& features, int nChannel = 0) const;
464 
465  // --- move-making steps ---
466 
469  bool propagate(const drwnPatchMatchNode& u, bool bDirection);
472  bool search(const drwnPatchMatchNode& u);
475  bool local(const drwnPatchMatchNode& u);
476 
479  virtual bool enrichment();
480 
483  bool exhaustive(const drwnPatchMatchNode& u);
484 
485  // --- utility routines ---
486 
488  virtual float scoreMatch(const drwnPatchMatchNode &u, const drwnPatchMatchNode& v,
489  const drwnPatchMatchTransform& xform, float maxValue = DRWN_FLT_MAX) const;
490 
492  cv::Point mapPatch(const cv::Point& p, int imgIndx, int srcScale, int dstScale) const;
493 };
494 
495 // drwnPatchMatchGraphRepaint ------------------------------------------------
499 
501  protected:
503  vector<cv::Mat> _labels;
504 
505  public:
507  virtual ~drwnPatchMatchGraphRepaint();
508 
510  virtual cv::Mat retarget(unsigned imgIndx) const;
511 
513  void updateImageLabels(unsigned imgIndx, const cv::Mat& labels);
514 
515  protected:
517  void cacheImageLabels();
519  virtual void cacheImageLabels(unsigned imgIndx);
520 };
521 
522 // drwnPatchMatchVisualization -----------------------------------------------
524 
525 namespace drwnPatchMatchVis {
527  cv::Mat visualizeMatches(const drwnPatchMatchGraph &graph,
528  int imgIndx, const cv::Point& p);
529 
531  cv::Mat visualizeMatchQuality(const drwnPatchMatchGraph &graph,
532  int imgIndx, float maxScore = 0.0, unsigned kthBest = 0);
533 
535  cv::Mat visualizeMatchQuality(const drwnPatchMatchGraph &graph, unsigned kthBest = 0);
536 
538  cv::Mat visualizeMatchTransforms(const drwnPatchMatchGraph &graph,
539  int imgIndx);
540 
542  cv::Mat visualizeMatchTransforms(const drwnPatchMatchGraph &graph);
543 
545  cv::Mat visualizeMatchTargets(const drwnPatchMatchGraph &graph,
546  int imgIndx);
547 
549  cv::Mat visualizeMatchTargets(const drwnPatchMatchGraph &graph);
550 };
uint16_t height() const
image height
Definition: drwnPatchMatch.h:192
vector< vector< cv::Mat > > _features
image features indexed by (image, pyramid level)
Definition: drwnPatchMatch.h:425
unsigned int patchHeight() const
patch height used for constructing this graph
Definition: drwnPatchMatch.h:356
uint16_t width() const
image width
Definition: drwnPatchMatch.h:278
cv::Point index2pixel(int indx) const
convert from index to pixel coordinates
Definition: drwnPatchMatch.h:204
float matchScore
score of this match
Definition: drwnPatchMatch.h:111
cv::Mat visualizeMatches(const drwnPatchMatchGraph &graph, int imgIndx, const cv::Point &p)
visualize matches for a given pixel
Definition: drwnPatchMatch.cpp:1711
uint16_t yPosition
y location of the patch in the target pyramid level
Definition: drwnPatchMatch.h:71
static unsigned int K
default number of matches per pixel
Definition: drwnPatchMatch.h:327
bool operator<(const drwnPatchMatchEdge &e) const
default comparison for sorting
Definition: drwnPatchMatch.h:134
drwnPatchMatchEdgeList & edges(const drwnPatchMatchNode &node)
returns (a reference to) the list of outgoing edges for a given node
Definition: drwnPatchMatch.h:372
unsigned int _patchWidth
patch width (at base scale in this graph)
Definition: drwnPatchMatch.h:333
static bool DO_LOCAL_SEARCH
run neighbourhood search on dirty pixels
Definition: drwnPatchMatch.h:412
uint16_t _width
width of the image (may differ from first pyramid level)
Definition: drwnPatchMatch.h:251
string imageFilename(int indx) const
full image filename of a given image
Definition: drwnPatchMatch.h:388
static bool ALLOW_MULTIPLE
allow multiple matches within a single image
Definition: drwnPatchMatch.h:165
drwnPatchMatchEdgeList & operator()(uint16_t x, uint16_t y)
reference edges at location (x, y)
Definition: drwnPatchMatch.h:218
static drwnPatchMatchTransform ALLOWED_TRANSFORMATIONS
allowable patch transformations
Definition: drwnPatchMatch.h:415
Class for repainting an image from matches within the PatchMatchGraph.
Definition: drwnPatchMatch.h:500
size_t levels() const
image pyramid levels
Definition: drwnPatchMatch.h:282
static unsigned MIN_SIZE
minimum image size (if smaller than size at MAX_LEVELS)
Definition: drwnPatchMatch.h:235
vector< drwnPatchMatchImageRecord > _levels
pyramid levels holding image matches
Definition: drwnPatchMatch.h:255
drwnPatchMatchStatus status
status flag
Definition: drwnPatchMatch.h:115
string imageDirectory
directory to prepend to instance basename
Definition: drwnPatchMatch.h:329
const drwnPatchMatchImagePyramid & operator[](unsigned indx) const
reference image pyramid level indx
Definition: drwnPatchMatch.h:398
size_t size() const
number of images in the graph
Definition: drwnPatchMatch.h:351
drwnPatchMatchEdgeList & operator[](int indx)
reference edges at index indx
Definition: drwnPatchMatch.h:222
uint16_t imgIndx
index of image (in drwnPatchMatchGraph) for this match
Definition: drwnPatchMatch.h:68
uint16_t height() const
image height
Definition: drwnPatchMatch.h:280
Records matches for one level in an image pyramid.
Definition: drwnPatchMatch.h:163
uint16_t _height
height of the image at this pyrmaid level
Definition: drwnPatchMatch.h:169
size_t size() const
number of pixels in image (width * height)
Definition: drwnPatchMatch.h:194
uint16_t x(int indx) const
convert from index to x pixel coordinate
Definition: drwnPatchMatch.h:200
Record of patch matches for mutliple levels each image.
Definition: drwnPatchMatch.h:231
static unsigned int PATCH_WIDTH
default patch width (at base scale)
Definition: drwnPatchMatch.h:325
drwnPatchMatchImageRecord()
default constructor
Definition: drwnPatchMatch.h:176
uint16_t xPosition
x location of the patch in the target pyramid level
Definition: drwnPatchMatch.h:70
unsigned int _patchHeight
patch height (at base scale in this graph)
Definition: drwnPatchMatch.h:334
drwnPatchMatchImageRecord(uint16_t width, uint16_t height)
constructor
Definition: drwnPatchMatch.h:180
drwnPatchMatchTransform xform
transformation applied to the patch
Definition: drwnPatchMatch.h:113
static unsigned MAX_LEVELS
maximum level in the image pyramid
Definition: drwnPatchMatch.h:233
drwnPatchMatchGraph & _graph
the graph that is being learned
Definition: drwnPatchMatch.h:424
string imageFilename(const string &baseName) const
full image filename from an image basename
Definition: drwnPatchMatch.h:390
static unsigned int PATCH_HEIGHT
default patch height (at base scale)
Definition: drwnPatchMatch.h:326
Learns a PatchMatchGraph by iteratively performing search moves over the space of matches...
Definition: drwnPatchMatch.h:407
static double PYR_SCALE
pyramid downsampling rate
Definition: drwnPatchMatch.h:236
uint16_t width() const
image width
Definition: drwnPatchMatch.h:190
const drwnPatchMatchEdgeList & operator()(uint16_t x, uint16_t y) const
reference edges at location (x, y)
Definition: drwnPatchMatch.h:220
Represents an edge in the drwnPatchMatchGraph.
Definition: drwnPatchMatch.h:109
static double SEARCH_DECAY_RATE
decay rate during search in range [0, 1)
Definition: drwnPatchMatch.h:409
static int FORWARD_ENRICHMENT_K
forward enrichment search depth
Definition: drwnPatchMatch.h:410
drwnPatchMatchNode targetNode
index of image, pyramid level and location of patch
Definition: drwnPatchMatch.h:112
uint16_t _width
width of the image at this pyramid level
Definition: drwnPatchMatch.h:168
uint16_t y(int indx) const
convert from index to x pixel coordinate
Definition: drwnPatchMatch.h:202
~drwnPatchMatchImageRecord()
destructor
Definition: drwnPatchMatch.h:185
std::string toString(const T &v)
Templated function to make conversion from simple data types like int and double to strings easy for ...
Definition: drwnStrUtils.h:134
Represents a node in the drwnPatchMatchGraph.
Definition: drwnPatchMatch.h:66
cv::Mat visualizeMatchTransforms(const drwnPatchMatchGraph &graph, int imgIndx)
visualize best match transformations for a given image
Definition: drwnPatchMatch.cpp:1785
const drwnPatchMatchEdgeList & edges(const drwnPatchMatchNode &node) const
returns (a constant reference to) the list of outgoing edges for a given node
Definition: drwnPatchMatch.h:378
const drwnPatchMatchGraph & _graph
the graph that is being learned
Definition: drwnPatchMatch.h:502
Each image maintains a W-by-H-by-K array of match records referencing the (approximate) best K matche...
Definition: drwnPatchMatch.h:323
static double TOP_VAR_PATCHES
initialize all patches below this with only one match
Definition: drwnPatchMatch.h:417
bool update(uint16_t x, uint16_t y, const drwnPatchMatchEdge &match)
updates edge list for pixel (x,y) with a candidate match and returns true if match is better than exi...
Definition: drwnPatchMatch.h:213
const string & name() const
image name
Definition: drwnPatchMatch.h:276
const drwnPatchMatchImageRecord & operator[](uint8_t indx) const
reference pyramid level indx
Definition: drwnPatchMatch.h:305
string _name
image identifier
Definition: drwnPatchMatch.h:250
drwnPatchMatchImageRecord & operator[](uint8_t indx)
reference pyramid level indx
Definition: drwnPatchMatch.h:303
int eqvClass
Equivalence class for this image. If negative (which is the default) the image is considered to be in...
Definition: drwnPatchMatch.h:247
bool bActive
Include this image during update (initialize, propagate, local, search, and enrichment). If false the image can still be matched to but it's own matches are not updated.
Definition: drwnPatchMatch.h:242
Interface class for drwnPersistentStorage.
Definition: drwnPersistentStorage.h:25
bool operator==(const drwnPatchMatchNode &node) const
equality operator
Definition: drwnPatchMatch.h:94
uint16_t _height
height of the image (may differ from first pyramid level)
Definition: drwnPatchMatch.h:252
bool operator<(const drwnPatchMatchNode &node) const
default comparison for sorting
Definition: drwnPatchMatch.h:83
drwnPatchMatchEdge(float score, const drwnPatchMatchNode &node, const drwnPatchMatchTransform &patchXform)
constructor
Definition: drwnPatchMatch.h:122
int pixel2index(uint16_t x, uint16_t y) const
convert from pixel coordinates to index
Definition: drwnPatchMatch.h:206
static unsigned MAX_SIZE
maximum image size (if larger will be resized in first level)
Definition: drwnPatchMatch.h:234
drwnPatchMatchImagePyramid(const string &name, uint16_t width, uint16_t height)
constructor an image record with a given name (and size)
Definition: drwnPatchMatch.h:264
string imageExtension
extension to append to instance basename
Definition: drwnPatchMatch.h:330
vector< cv::Mat > _labels
the labels that will be used for retargetting
Definition: drwnPatchMatch.h:503
drwnPatchMatchImagePyramid & operator[](unsigned indx)
reference image pyramid indx
Definition: drwnPatchMatch.h:396
static bool DO_INVERSE_ENRICHMENT
perform inverse enrichment
Definition: drwnPatchMatch.h:411
drwnPatchMatchEdge()
default constructor
Definition: drwnPatchMatch.h:119
vector< drwnPatchMatchImagePyramid * > _images
image pyramid matches
Definition: drwnPatchMatch.h:335
const drwnPatchMatchEdgeList & operator[](int indx) const
reference edges at index indx
Definition: drwnPatchMatch.h:224
uint8_t imgScale
level in the image pyramid for the match
Definition: drwnPatchMatch.h:69
cv::Mat visualizeMatchQuality(const drwnPatchMatchGraph &graph, int imgIndx, float maxScore=0.0, unsigned kthBest=0)
visualize match quality for a given image
Definition: drwnPatchMatch.cpp:1736
cv::Mat visualizeMatchTargets(const drwnPatchMatchGraph &graph, int imgIndx)
visualize best match target image for a given image
Definition: drwnPatchMatch.cpp:1819
~drwnPatchMatchImagePyramid()
destructor
Definition: drwnPatchMatch.h:271
unsigned int patchWidth() const
patch width used for constructing this graph
Definition: drwnPatchMatch.h:354
static bool DO_EXHAUSTIVE
run exhustive search on random pixel
Definition: drwnPatchMatch.h:413
drwnPatchMatchImagePyramid()
default constructor
Definition: drwnPatchMatch.h:259
cv::Point mapPixel(const cv::Point &p, int srcLevel, int dstLevel) const
map a pixel from one pyramid level to another
Definition: drwnPatchMatch.h:293