Skip to content

Commit 514b376

Browse files
Merge pull request #181 from justadudewhohacks/typescript-definitions
Typescript definitions
2 parents 502b4a2 + 3c12905 commit 514b376

File tree

111 files changed

+3899
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3899
-10
lines changed

.gitattributes

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
*.sh* text eol=lf
1+
*.sh* text eol=lf
2+
*.d.ts linguist-vendored=false
3+
/examples/* linguist-documentation=false

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ coverage
99
coverage-report
1010
tmpdata
1111
data/dnn
12-
.idea/
12+
.idea/
13+
dist

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ coverage
1414
coverage-report
1515
tmpdata
1616
ci
17-
.dockerignore
17+
.dockerignore
18+
dist

cc/core/Point.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ NAN_MODULE_INIT(Point::Init) {
2929
ctor->InstanceTemplate()->SetInternalFieldCount(1);
3030
ctor->SetClassName(Nan::New("Point").ToLocalChecked());
3131
target->Set(Nan::New("Point").ToLocalChecked(), ctor->GetFunction());
32+
target->Set(Nan::New("Point2").ToLocalChecked(), ctor->GetFunction());
33+
target->Set(Nan::New("Point3").ToLocalChecked(), ctor->GetFunction());
3234
};
3335

3436
NAN_METHOD(Point::New) {

cc/core/Vec.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ NAN_MODULE_INIT(Vec::Init) {
4343
ctor->InstanceTemplate()->SetInternalFieldCount(1);
4444
ctor->SetClassName(Nan::New("Vec").ToLocalChecked());
4545
target->Set(Nan::New("Vec").ToLocalChecked(), ctor->GetFunction());
46+
target->Set(Nan::New("Vec2").ToLocalChecked(), ctor->GetFunction());
47+
target->Set(Nan::New("Vec3").ToLocalChecked(), ctor->GetFunction());
48+
target->Set(Nan::New("Vec4").ToLocalChecked(), ctor->GetFunction());
4649
};
4750

4851
NAN_METHOD(Vec::New) {
File renamed without changes.
File renamed without changes.

examples/dnn/loadFacenet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const {
55
} = require('../utils');
66

77
module.exports = function () {
8-
const modelPath = '../../data/dnn/facenet';
8+
const modelPath = path.resolve(__dirname, '../../data/dnn/facenet');
99

1010
const prototxt = path.resolve(modelPath, 'facenet.prototxt');
1111
const modelFile = path.resolve(modelPath, 'res10_300x300_ssd_iter_140000.caffemodel');

examples/dnnSSDCoco.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function classifyImg(img) {
4646

4747
const makeDrawClassDetections = predictions => (drawImg, className, getColor, thickness = 2) => {
4848
predictions
49-
.filter(p => p.className === className)
49+
.filter(p => classNames[p.classLabel] === className)
5050
.forEach(p => drawRect(drawImg, p.rect, getColor(), { thickness }));
5151
return drawImg;
5252
};

examples/faceRecognition1.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ const lbph = new cv.LBPHFaceRecognizer();
4141
lbph.train(trainImgs, labels);
4242

4343
const twoFacesImg = cv.imread(path.resolve(basePath, 'daryl-rick.jpg'));
44-
const faces = classifier.detectMultiScale(twoFacesImg.bgrToGray()).objects;
44+
const result = classifier.detectMultiScale(twoFacesImg.bgrToGray());
4545

46-
faces.forEach((faceRect) => {
46+
const minDetections = 10;
47+
result.objects.forEach((faceRect, i) => {
48+
if (result.numDetections[i] < minDetections) {
49+
return;
50+
}
4751
const faceImg = twoFacesImg.getRegion(faceRect).bgrToGray();
4852
const who = nameMappings[lbph.predict(faceImg).label];
4953

0 commit comments

Comments
 (0)