habbes / xaval

Interactive web-based playground for computer vision exploration and experimentation
https://xaval.habbes.xyz
5 stars 0 forks source link

Image utility library #69

Open habbes opened 6 years ago

habbes commented 6 years ago

I haven't found a quick method for setting the pixel of an image in opencv.js, at the moment I'm doing this img.data.set([r, g, b, a], row * img.cols * img.channels() + col * img.channels());, which I find to be too verbose.

It would be good to have a utility lib in Xaval that provides shortcuts and quick wrappers for such basic operations.

In this case it could be something like util.setPixel(img, row, col, pixel) where pixel is an array with the pixel components. Or maybe it would be sensible to specify the channels: util.setPixel4(img, row, col, pixel) or util.setPixel(img, row, col, channels, pixel).