mirror of
https://github.com/peterbraden/node-opencv.git
synced 2025-12-08 19:45:55 +00:00
Additional (optional) parameters added to gaussian blur
This commit is contained in:
parent
48a4fc35e8
commit
302bbea2af
@ -1188,7 +1188,9 @@ 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;
|
double sigmaX = 0;
|
||||||
|
double sigmaY = 0;
|
||||||
|
int borderType = cv::BORDER_DEFAULT;
|
||||||
|
|
||||||
if (info.Length() < 1) {
|
if (info.Length() < 1) {
|
||||||
ksize = cv::Size(5, 5);
|
ksize = cv::Size(5, 5);
|
||||||
@ -1205,12 +1207,16 @@ 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 = Nan::To<double>(info[1]).FromJust();
|
sigmaX = info.Length() < 2 ? 0 : info[1]->NumberValue();
|
||||||
|
sigmaY = info.Length() < 3 ? 0 : info[2]->NumberValue();
|
||||||
|
|
||||||
|
if (info.Length() == 4) {
|
||||||
|
borderType = info[3]->IntegerValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cv::GaussianBlur(self->mat, blurred, ksize, sigma);
|
cv::GaussianBlur(self->mat, blurred, ksize, sigmaX, sigmaY, borderType);
|
||||||
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