PlanarGC  1.0.2
 All Data Structures Functions Variables Enumerations Enumerator Friends Pages
cutsegment.cpp
#include "CutSegment.h"
class MyCutSegment : public CutSegment {
public:
MyCutSegment(int width, int height) : CutSegment(width,height) {};
double gradient(double color1, double color2);
};
double MyCutSegment::gradient(double color1, double color2) {
double diff, weight;
diff = color1-color2;
weight = exp(-sqrt(diff*diff));
return weight;
}
int main() {
int width=128, height=128;
MyCutSegment segment_cut(width,height);
/*
please load image I and prelabeling L here
*/
segment_cut.setImageData(I);
segment_cut.setSourceSink(L,0,128);
double flow;
flow = segment_cut.segment();
label = segment_cut.getLabel(1,2);
labels = new CutPlanar::ELabel[width*height];
segment_cut.getLabels(labels);
}
© 2009 - 2013 by Eno Töppe, Frank R. Schmidt
generated by Doxygen