Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit a8f9cf2

Browse files
Merge pull request justadudewhohacks#55 from grassias/SuperpixelSEEDS-getLabelContourMask
Add label contour mask functionality in SuperpixelSEEDS
2 parents 4173d66 + e681901 commit a8f9cf2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cc/modules/ximgproc/SuperpixelSEEDS.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ NAN_MODULE_INIT(SuperpixelSEEDS::Init) {
1919
Nan::SetAccessor(instanceTemplate, Nan::New("doubleStep").ToLocalChecked(), SuperpixelSEEDS::GetDoubleStep);
2020
Nan::SetAccessor(instanceTemplate, Nan::New("numCalculatedSuperpixels").ToLocalChecked(), SuperpixelSEEDS::GetNumCalculatedSuperpixels);
2121
Nan::SetAccessor(instanceTemplate, Nan::New("labels").ToLocalChecked(), SuperpixelSEEDS::GetLabels);
22-
22+
Nan::SetAccessor(instanceTemplate, Nan::New("labelContourMask").ToLocalChecked(), SuperpixelSEEDS::GetLabelContourMask);
23+
2324
Nan::SetPrototypeMethod(ctor, "iterate", SuperpixelSEEDS::Iterate);
2425

2526
target->Set(Nan::New("SuperpixelSEEDS").ToLocalChecked(), ctor->GetFunction());
@@ -70,6 +71,7 @@ NAN_METHOD(SuperpixelSEEDS::Iterate) {
7071
self->superpixelSeeds->iterate(self->img, (int)iterations);
7172
self->superpixelSeeds->getLabels(self->labels);
7273
self->numCalculatedSuperpixels = self->superpixelSeeds->getNumberOfSuperpixels();
74+
self->superpixelSeeds->getLabelContourMask(self->labelContourMask);
7375
}
7476

7577
#endif // HAVE_XIMGPROC

cc/modules/ximgproc/SuperpixelSEEDS.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class SuperpixelSEEDS : public Nan::ObjectWrap {
1010
cv::Ptr<cv::ximgproc::SuperpixelSEEDS> superpixelSeeds;
1111
cv::Mat img;
1212
cv::Mat labels;
13+
cv::Mat labelContourMask;
1314
int numSuperpixels;
1415
int numLevels;
1516
int prior = 2;
@@ -23,6 +24,7 @@ class SuperpixelSEEDS : public Nan::ObjectWrap {
2324

2425
static FF_GETTER_JSOBJ(SuperpixelSEEDS, GetImg, img, FF_UNWRAP_MAT_AND_GET, Mat::constructor);
2526
static FF_GETTER_JSOBJ(SuperpixelSEEDS, GetLabels, labels, FF_UNWRAP_MAT_AND_GET, Mat::constructor);
27+
static FF_GETTER_JSOBJ(SuperpixelSEEDS, GetLabelContourMask, labelContourMask, FF_UNWRAP_MAT_AND_GET, Mat::constructor);
2628
static FF_GETTER(SuperpixelSEEDS, GetNumSuperpixels, numSuperpixels);
2729
static FF_GETTER(SuperpixelSEEDS, GeNumLevels, numLevels);
2830
static FF_GETTER(SuperpixelSEEDS, GetPrior, prior);

0 commit comments

Comments
 (0)