I'd like to use LUT & applyColorMap in opencv.js. By default, they are not included, thus I tried doing a custom build, but I'm getting runtime errors when trying to use them:
LUT:
Uncaught (in promise) 6705216
That's pretty much all the information on the error there is.
applyColorMap:
Uncaught (in promise) TypeError: Cannot convert "[object Object]" to int
It seems only the first overload of applyColorMap is supported, but I need the second one with a custom userColor matrix (see docs).
'LUT' to core section in ./platforms/js/opencv_js.config.py'applyColorMap' to imgproc section in ./platforms/js/opencv_js.config.py$ emcmake python ./platforms/js/build_js.py build_wasm --build_wasm
import cv_ from "./opencv.js"
(async () {
const cv = await cv_
// provide some `imgEl` here
const img = cv.imread(imgEl)
const lut = new cv.Mat.zeros(256, 4, cv.CV_8UC4)
const out = new cv.Mat()
// error is thrown here:
cv.LUT(img, lut, out)
// cv.applyColorMap(img, out, lut)
lut.delete()
})()