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:
@@ -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
|
||||
|
||||
@@ -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());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user