Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
using LUT & applyColorMap with opencv.js

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).

Steps to reproduce
  1. add 'LUT' to core section in ./platforms/js/opencv_js.config.py
  2. add 'applyColorMap' to imgproc section in ./platforms/js/opencv_js.config.py
  3. Build opencv.js with the following command:
$ emcmake python ./platforms/js/build_js.py build_wasm --build_wasm
  1. call the functions in javascript, e.g. like this:
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()
})()
System information
  • OpenCV: 4.5.5
  • OS: NixOS 22.05
  • emscripten: 2.0.10
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!