Prevent a copy during grayscale conversion

This commit is contained in:
Anshul Jain 2015-10-08 12:16:15 -07:00
parent a2073757a2
commit dc12c4f2ed

View File

@ -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());
}