mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Return a new matrix after reshape operation to preserve the
original matrix
This commit is contained in:
parent
cd7b6d16bd
commit
02aa27da1d
@ -2435,11 +2435,13 @@ NAN_METHOD(Matrix::Reshape) {
|
|||||||
JSTHROW("Invalid number of arguments");
|
JSTHROW("Invalid number of arguments");
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::Mat res = self->mat.reshape(cn, rows);
|
Local<Object> img_to_return =
|
||||||
~self->mat;
|
Nan::New(Matrix::constructor)->GetFunction()->NewInstance();
|
||||||
self->mat = res;
|
Matrix *img = Nan::ObjectWrap::Unwrap<Matrix>(img_to_return);
|
||||||
|
|
||||||
return;
|
img->mat = self->mat.reshape(cn, rows);
|
||||||
|
|
||||||
|
info.GetReturnValue().Set(img_to_return);
|
||||||
}
|
}
|
||||||
|
|
||||||
NAN_METHOD(Matrix::Release) {
|
NAN_METHOD(Matrix::Release) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user