Skip to content

Commit 20aceee

Browse files
authored
Merge pull request #180 from wolfgangWS/patch-1
Minor update to Mat.cc
2 parents d154494 + 0bed13e commit 20aceee

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

cc/core/Mat.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ Nan::Persistent<v8::FunctionTemplate> Mat::constructor;
2121

2222
namespace FF {
2323
/**
24-
* 2,3-Dimmentions Macro seters for a single Value
24+
* 2,3-Dimensions Macro seters for a single Value
2525
*/
2626
template <typename type, int n>
2727
static inline void matPutVal(cv::Mat mat, v8::Local<v8::Value> value, const cv::Vec<int, n>& idx) {
2828
mat.at<type>(idx) = (type)value->ToNumber(Nan::GetCurrentContext()).ToLocalChecked()->Value();
2929
}
3030

3131
/**
32-
* 2,3-Dimmentions Macro seters for a Vec<2> Value
32+
* 2,3-Dimensions Macro seters for a Vec<2> Value
3333
*/
3434

3535
template <typename type, int n>
@@ -40,7 +40,7 @@ static inline void matPutVec2(cv::Mat mat, v8::Local<v8::Value> vector, const cv
4040
(type)FF::DoubleConverter::unwrapUnchecked(Nan::Get(vec, 1).ToLocalChecked()));
4141
}
4242
/**
43-
* 2,3-Dimmentions Macro seters for a Vec<3> Value
43+
* 2,3-Dimensions Macro seters for a Vec<3> Value
4444
*/
4545

4646
template <typename type, int n>
@@ -52,7 +52,7 @@ static inline void matPutVec3(cv::Mat mat, v8::Local<v8::Value> vector, const cv
5252
(type)FF::DoubleConverter::unwrapUnchecked(Nan::Get(vec, 2).ToLocalChecked()));
5353
}
5454
/**
55-
* 2,3-Dimmentions Macro seters for a Vec<4> Value
55+
* 2,3-Dimensions Macro seters for a Vec<4> Value
5656
*/
5757

5858
template <typename type, int n>
@@ -475,10 +475,10 @@ NAN_METHOD(Mat::New) {
475475
dim = dim + 1;
476476
rowArray0 = v8::Local<v8::Array>::Cast(Nan::Get(rowArray0, 0).ToLocalChecked());
477477
}
478-
// if multishanel drop one dimmention
478+
// if multishanel drop one Dimension
479479
if (channel > 1)
480480
dim--;
481-
// std::cout << "Create a Mat of " << dim << " dimentions eatch item has " << channel << " channel(s)." << std::endl;
481+
// std::cout << "Create a Mat of " << dim << " dimensions eatch item has " << channel << " channel(s)." << std::endl;
482482

483483
// reset row0
484484
rowArray0 = v8::Local<v8::Array>::Cast(info[0]);
@@ -490,7 +490,7 @@ NAN_METHOD(Mat::New) {
490490
}
491491
cv::Mat mat = cv::Mat(sizes, type);
492492
self->setNativeObject(mat);
493-
// return tryCatch.throwError("Mat::New - Mat must have at least 2 Dimentions");
493+
// return tryCatch.throwError("Mat::New - Mat must have at least 2 dimensions");
494494
} else if (dim == 2) {
495495
long rows = rowArray0->Length();
496496
long numCols = -1;
@@ -569,7 +569,7 @@ NAN_METHOD(Mat::New) {
569569
FF_MAT_APPLY_TYPED_OPERATOR(mat, rowArray0, type, FF_MAT_FROM_JS_ARRAY_4D, FF::matPut);
570570
self->setNativeObject(mat);
571571
} else {
572-
return tryCatch.throwError("Mat::New - Support only 4 Dimmention provided payload contains " + std::to_string(dim));
572+
return tryCatch.throwError("Mat::New - Support only 4 dimensions provided payload contains " + std::to_string(dim));
573573
}
574574
}
575575
/* row, col, type
@@ -578,7 +578,7 @@ NAN_METHOD(Mat::New) {
578578
*/
579579
else if (info[0]->IsNumber() && info[1]->IsNumber() && info[2]->IsInt32()) {
580580
int type = info[2]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value();
581-
if (info.Length() == 3 || info[3]->IsArray() || info[3]->IsNumber()) {
581+
if (info.Length() == 3 || info[3]->IsArray() || info[3]->IsNumber() || info[3]->IsBoolean()) {
582582

583583
cv::Mat mat(info[0]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), info[1]->ToInt32(Nan::GetCurrentContext()).ToLocalChecked()->Value(), type);
584584

@@ -593,7 +593,7 @@ NAN_METHOD(Mat::New) {
593593
}
594594
FF_MAT_APPLY_TYPED_OPERATOR(mat, vec, type, FF_MAT_FILL, FF::matPut);
595595
}
596-
if (info[3]->IsNumber()) {
596+
if (info[3]->IsNumber() || info[3]->IsBoolean()) {
597597
FF_MAT_APPLY_TYPED_OPERATOR(mat, info[3], type, FF_MAT_FILL, FF::matPut);
598598
}
599599
self->setNativeObject(mat);

0 commit comments

Comments
 (0)