Ask Your Question

Revision history [back]

OpenCv.js: what's the quickest way to set the pixel of an image?

What's the quickest way for setting the pixel value of image Mat in OpenCv.js?

I'm currently doing

img.data.set([r, g, b, a], row * img.cols * img.channels() + col * img.channels());

But I'm wondering whether there's a less-verbose built-in method in opencv.js, something analogous to img.ucharPtr(row, col) when retrieving the pixel value.