1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

imgproc: add IntelligentScissors

This commit is contained in:
Alexander Alekhin
2020-12-16 00:53:52 +00:00
parent 84676fefe3
commit 3eea3dd46b
14 changed files with 1637 additions and 7 deletions
+2
View File
@@ -87,6 +87,8 @@ namespace hal {
using namespace emscripten;
using namespace cv;
using namespace cv::segmentation; // FIXIT
#ifdef HAVE_OPENCV_DNN
using namespace cv::dnn;
#endif
+23
View File
@@ -977,3 +977,26 @@ QUnit.test('warpPolar', function(assert) {
96, 83, 64, 45, 32
]);
});
QUnit.test('IntelligentScissorsMB', function(assert) {
const lines = new cv.Mat(50, 100, cv.CV_8U, new cv.Scalar(0));
lines.row(10).setTo(new cv.Scalar(255));
assert.ok(lines instanceof cv.Mat);
let tool = new cv.segmentation_IntelligentScissorsMB();
tool.applyImage(lines);
assert.ok(lines instanceof cv.Mat);
lines.delete();
tool.buildMap(new cv.Point(10, 10));
let contour = new cv.Mat();
tool.getContour(new cv.Point(50, 10), contour);
assert.equal(contour.type(), cv.CV_32SC2);
assert.ok(contour.total() == 41, contour.total());
tool.getContour(new cv.Point(80, 10), contour);
assert.equal(contour.type(), cv.CV_32SC2);
assert.ok(contour.total() == 71, contour.total());
});