node-opencv icon indicating copy to clipboard operation
node-opencv copied to clipboard

NAN_METHOD(Matrix::Set) in Matrix.cc isn't working?

Open amj1985 opened this issue 8 years ago • 1 comments
trafficstars

Hi guys, I'm trying to replace the pixel color of matrix channel and then merge this channels into original matrix, but without lucky. My workaround is to draw a 1x1 rectangle upper to the original pixel. Sorry about my poor english.

_adjustColorChannel(channel, intensity, width, height) {
    for (let i = 0; i < width; i++) {
      for (let j = 0; j < height; j++) {
        let pixel = channel.pixel(i, j);
        let newPixel = Math.floor(pixel + (pixel * intensity));
        channel.set(i, j, newPixel);
      }
    }
  }

amj1985 avatar Jun 21 '17 07:06 amj1985

Hello,

What is the type of your channel Matrix (channel.type()) ?

I think only CV_32FC3 and CV_32FC1 are supported by setmethod. See https://github.com/peterbraden/node-opencv/blob/master/src/Matrix.cc#L289

I had similar problems with CV_8U1 matrixes

piercus avatar Sep 06 '17 14:09 piercus