From dc12c4f2ed202b2c2a1d0251fd8891b97a751cea Mon Sep 17 00:00:00 2001 From: Anshul Jain Date: Thu, 8 Oct 2015 12:16:15 -0700 Subject: [PATCH] Prevent a copy during grayscale conversion --- src/Matrix.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Matrix.cc b/src/Matrix.cc index 8c63ab0..0645c95 100755 --- a/src/Matrix.cc +++ b/src/Matrix.cc @@ -998,10 +998,7 @@ NAN_METHOD(Matrix::ConvertGrayscale) { Nan::ThrowError("Image is no 3-channel"); } - cv::Mat gray; - - cv::cvtColor(self->mat, gray, CV_BGR2GRAY); - gray.copyTo(self->mat); + cv::cvtColor(self->mat, self->mat, CV_BGR2GRAY); info.GetReturnValue().Set(Nan::Null()); }