Merge pull request #439 from silklabs/fix-getData-elemsize

make getData() work if we have more than one channel
This commit is contained in:
Michael Vines 2016-09-07 21:32:32 -07:00 committed by GitHub
commit 33976a951a

View File

@ -317,7 +317,7 @@ NAN_METHOD(Matrix::GetData) {
Nan::HandleScope scope;
Matrix *self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
int size = self->mat.rows * self->mat.cols * self->mat.elemSize1();
int size = self->mat.rows * self->mat.cols * self->mat.elemSize();
Local<Object> buf = Nan::NewBuffer(size).ToLocalChecked();
uchar* data = (uchar*) Buffer::Data(buf);
// if there is padding after each row, clone first to get rid of it