Commit 9d711fd659971aadba596f9bb078dad79382f1fa

Authored by Austin Blanton
1 parent ef45e042

Add documentation to WatershedSegmentation

openbr/plugins/segmentation.cpp
@@ -7,7 +7,12 @@ using namespace cv; @@ -7,7 +7,12 @@ using namespace cv;
7 namespace br 7 namespace br
8 { 8 {
9 9
10 -class SegmentationTransform : public UntrainableTransform 10 +/*!
  11 + * \ingroup transforms
  12 + * \brief Applies watershed segmentation.
  13 + * \author Austin Blanton \cite imaus10
  14 + */
  15 +class WatershedSegmentationTransform : public UntrainableTransform
11 { 16 {
12 Q_OBJECT 17 Q_OBJECT
13 void project(const Template &src, Template &dst) const 18 void project(const Template &src, Template &dst) const
@@ -27,8 +32,7 @@ class SegmentationTransform : public UntrainableTransform @@ -27,8 +32,7 @@ class SegmentationTransform : public UntrainableTransform
27 findContours(mod, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); 32 findContours(mod, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE);
28 33
29 // draw the contour delineations as 1,2,3... for input to watershed 34 // draw the contour delineations as 1,2,3... for input to watershed
30 - Mat markers(mod.size(), CV_32S);  
31 - Scalar::all(0); 35 + Mat markers = Mat::zeros(mod.size(), CV_32S);
32 int compCount=0; 36 int compCount=0;
33 for (int idx=0; idx>=0; idx=hierarchy[idx][0], compCount++) { 37 for (int idx=0; idx>=0; idx=hierarchy[idx][0], compCount++) {
34 drawContours(markers, contours, idx, Scalar::all(compCount+1), -1, 8, hierarchy, INT_MAX); 38 drawContours(markers, contours, idx, Scalar::all(compCount+1), -1, 8, hierarchy, INT_MAX);
@@ -42,7 +46,7 @@ class SegmentationTransform : public UntrainableTransform @@ -42,7 +46,7 @@ class SegmentationTransform : public UntrainableTransform
42 dst.file.set("NumSegments", compCount); 46 dst.file.set("NumSegments", compCount);
43 } 47 }
44 }; 48 };
45 -BR_REGISTER(Transform, SegmentationTransform) 49 +BR_REGISTER(Transform, WatershedSegmentationTransform)
46 50
47 } // namespace br 51 } // namespace br
48 52