Commit 9d711fd659971aadba596f9bb078dad79382f1fa
1 parent
ef45e042
Add documentation to WatershedSegmentation
Showing
1 changed file
with
8 additions
and
4 deletions
openbr/plugins/segmentation.cpp
| ... | ... | @@ -7,7 +7,12 @@ using namespace cv; |
| 7 | 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 | 17 | Q_OBJECT |
| 13 | 18 | void project(const Template &src, Template &dst) const |
| ... | ... | @@ -27,8 +32,7 @@ class SegmentationTransform : public UntrainableTransform |
| 27 | 32 | findContours(mod, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE); |
| 28 | 33 | |
| 29 | 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 | 36 | int compCount=0; |
| 33 | 37 | for (int idx=0; idx>=0; idx=hierarchy[idx][0], compCount++) { |
| 34 | 38 | drawContours(markers, contours, idx, Scalar::all(compCount+1), -1, 8, hierarchy, INT_MAX); |
| ... | ... | @@ -42,7 +46,7 @@ class SegmentationTransform : public UntrainableTransform |
| 42 | 46 | dst.file.set("NumSegments", compCount); |
| 43 | 47 | } |
| 44 | 48 | }; |
| 45 | -BR_REGISTER(Transform, SegmentationTransform) | |
| 49 | +BR_REGISTER(Transform, WatershedSegmentationTransform) | |
| 46 | 50 | |
| 47 | 51 | } // namespace br |
| 48 | 52 | ... | ... |