PlanarGC  1.0.2
 All Data Structures Functions Variables Enumerations Enumerator Friends Pages
CutSegment.h
1 /*****************************************************************************
2 * PlanarCut - software to compute MinCut / MaxFlow in a planar graph *
3 * Version 1.0 *
4 * *
5 * Copyright 2011 Eno Töppe <toeppe@in.tum.de> *
6 * Frank R. Schmidt <fschmidt@uwo.ca> *
7 ******************************************************************************
8 
9  If you use this software for research purposes, YOU MUST CITE the following
10  paper in any resulting publication:
11 
12  [1] Efficient Planar Graph Cuts with Applications in Computer Vision.
13  F. R. Schmidt, E. Töppe, D. Cremers,
14  IEEE CVPR, Miami, Florida, June 2009
15 
16 ******************************************************************************
17 
18  This software is released under the LGPL license. Details are explained
19  in the files 'COPYING' and 'COPYING.LESSER'.
20 
21 *****************************************************************************/
22 
23 #ifndef __CUTSEGMENT_H__
24 #define __CUTSEGMENT_H__
25 
26 #include "CutGrid.h"
27 #include "CutPlanarDefs.h"
28 
29 
30 class CutSegment;
31 
32 
33 class CutSegment : private CutGrid
42 {
43  private:
44 
45  int DirToOfs[4];
46 
47  enum EMask {
48  IDX_SINK,
49  IDX_SOURCE,
50  IDX_UNDETERMINED,
51  };
52 
53  uchar *imData;
54  EMask *imMask;
55  bool bFormatRGB;
56 
57  int width;
58  int height;
59 
60  CapType edgeCost(int row, int col, EDir dir);
61 
62  public:
68  CutSegment(int width, int height);
72  virtual ~CutSegment();
73 
78  void setImageData(const uchar *grey);
86  void setImageData(const uchar *r, const uchar *g, const uchar *b);
87 
96  void setSourceSink(const uchar *stMask, uchar source, uchar sink);
97 
102  virtual double gradient(double color1, double color2); //greyscale information of adjacent pixels
107  virtual double gradient(double color1[3], double color2[3]); //RGB-color information of adjacent pixels
108 
113  double segment();
114 
117  CutPlanar::ELabel getLabel(int x, int y);
118 
123  void getLabels(CutPlanar::ELabel *lmask);
124 };
125 
126 
127 #endif
© 2009 - 2013 by Eno Töppe, Frank R. Schmidt
generated by Doxygen