mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
add sigma param to gaussianBlur
This commit is contained in:
parent
2bce0b7cd2
commit
fe2b18e0a7
@ -1100,6 +1100,7 @@ NAN_METHOD(Matrix::GaussianBlur) {
|
|||||||
cv::Mat blurred;
|
cv::Mat blurred;
|
||||||
|
|
||||||
Matrix *self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
|
Matrix *self = Nan::ObjectWrap::Unwrap<Matrix>(info.This());
|
||||||
|
double sigma = 0;
|
||||||
|
|
||||||
if (info.Length() < 1) {
|
if (info.Length() < 1) {
|
||||||
ksize = cv::Size(5, 5);
|
ksize = cv::Size(5, 5);
|
||||||
@ -1116,9 +1117,12 @@ NAN_METHOD(Matrix::GaussianBlur) {
|
|||||||
Nan::ThrowTypeError("'ksize' argument must be a 2 double array");
|
Nan::ThrowTypeError("'ksize' argument must be a 2 double array");
|
||||||
}
|
}
|
||||||
ksize = cv::Size(x->NumberValue(), y->NumberValue());
|
ksize = cv::Size(x->NumberValue(), y->NumberValue());
|
||||||
|
if (info[1]->IsNumber()) {
|
||||||
|
sigma = info[1]->ToNumber()->Value();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GaussianBlur(self->mat, blurred, ksize, 0);
|
cv::GaussianBlur(self->mat, blurred, ksize, sigma);
|
||||||
blurred.copyTo(self->mat);
|
blurred.copyTo(self->mat);
|
||||||
|
|
||||||
info.GetReturnValue().Set(Nan::Null());
|
info.GetReturnValue().Set(Nan::Null());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user