diff --git a/modules/js/test/test_core.js b/modules/js/test/test_core.js
new file mode 100644
index 0000000000..14d4ffe72b
--- /dev/null
+++ b/modules/js/test/test_core.js
@@ -0,0 +1,41 @@
+// This file is part of OpenCV project.
+// It is subject to the license terms in the LICENSE file found in the top-level directory
+// of this distribution and at http://opencv.org/license.html.
+
+if (typeof module !== 'undefined' && module.exports) {
+ // The environment is Node.js
+ var cv = require('./opencv.js'); // eslint-disable-line no-var
+}
+
+QUnit.module('Core', {});
+
+QUnit.test('test_LUT', function(assert) {
+ // test LUT
+ {
+ let src = cv.matFromArray(3, 3, cv.CV_8UC1, [255, 128, 0, 0, 128, 255, 1, 2, 254]);
+ let lutTable = [];
+ for (let i = 0; i < 256; i++)
+ {
+ lutTable[i] = 255 - i;
+ }
+ let lut = cv.matFromArray(1, 256, cv.CV_8UC1, lutTable);
+ let dst = new cv.Mat();
+
+ cv.LUT(src, lut, dst);
+
+ //console.log(dst.data);
+ assert.equal(dst.ucharAt(0), 0);
+ assert.equal(dst.ucharAt(1), 127);
+ assert.equal(dst.ucharAt(2), 255);
+ assert.equal(dst.ucharAt(3), 255);
+ assert.equal(dst.ucharAt(4), 127);
+ assert.equal(dst.ucharAt(5), 0);
+ assert.equal(dst.ucharAt(6), 254);
+ assert.equal(dst.ucharAt(7), 253);
+ assert.equal(dst.ucharAt(8), 1);
+
+ src.delete();
+ lut.delete();
+ dst.delete();
+ }
+});
diff --git a/modules/js/test/test_mat.js b/modules/js/test/test_mat.js
index 409ed1b123..fd3611cd2c 100644
--- a/modules/js/test/test_mat.js
+++ b/modules/js/test/test_mat.js
@@ -73,7 +73,7 @@ if (typeof module !== 'undefined' && module.exports) {
var cv = require('./opencv.js'); // eslint-disable-line no-var
}
-QUnit.module('Core', {});
+QUnit.module('CoreMat', {});
QUnit.test('test_mat_creation', function(assert) {
// Mat constructors.
diff --git a/modules/js/test/tests.html b/modules/js/test/tests.html
index de64ca7a29..b20013ec63 100644
--- a/modules/js/test/tests.html
+++ b/modules/js/test/tests.html
@@ -52,12 +52,12 @@
if (window.cv instanceof Promise) {
window.cv.then((target) => {
window.cv = target;
- //console.log(cv.getBuildInformation());
+ console.log(cv.getBuildInformation());
QUnit.start();
})
} else {
// for backward compatible
- // console.log(cv.getBuildInformation());
+ console.log(cv.getBuildInformation());
QUnit.start();
}
},
@@ -108,6 +108,7 @@
+
diff --git a/modules/js/test/tests.js b/modules/js/test/tests.js
index f3156f6ea0..74a4b87e45 100644
--- a/modules/js/test/tests.js
+++ b/modules/js/test/tests.js
@@ -44,10 +44,15 @@ testrunner.options.maxBlockDuration = 20000; // cause opencv_js.js need time to
testrunner.run(
{
code: 'opencv.js',
- tests: ['test_mat.js', 'test_utils.js', 'test_imgproc.js',
- 'test_objdetect.js', 'test_video.js', 'test_features2d.js',
+ tests: ['test_mat.js',
+ 'test_utils.js',
+ 'test_core.js',
+ 'test_imgproc.js',
+ 'test_objdetect.js',
+ 'test_video.js',
+ 'test_features2d.js',
'test_photo.js',
- 'test_calib3d.js'
+ 'test_calib3d.js',
],
},
function(err, report) {
diff --git a/platforms/js/opencv_js.config.py b/platforms/js/opencv_js.config.py
index 69891ea71a..5dca863bef 100644
--- a/platforms/js/opencv_js.config.py
+++ b/platforms/js/opencv_js.config.py
@@ -9,6 +9,7 @@ core = {
'perspectiveTransform', 'polarToCart', 'pow', 'randn', 'randu', 'reduce', 'repeat', 'rotate', 'setIdentity', 'setRNGSeed',
'solve', 'solvePoly', 'split', 'sqrt', 'subtract', 'trace', 'transform', 'transpose', 'vconcat',
'setLogLevel', 'getLogLevel',
+ 'LUT',
],
'Algorithm': [],
}