Skip to content

Commit 8b026b3

Browse files
refactor to node-addon-api
1 parent 121f90c commit 8b026b3

File tree

375 files changed

+227365
-9657
lines changed

Some content is hidden

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

375 files changed

+227365
-9657
lines changed

.github/FUNDING.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
custom: ["https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=NUZP3U3QZEQV2&currency_code=EUR&source=url"]

.gitignore

+118-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,120 @@
1-
node_modules
2-
npm-debug.log
31
Thumbs.db
42
build/
5-
.node_pre_gyprc
3+
.node_pre_gyprc
4+
.vscode/
5+
6+
# Ignore the downloaded SDK
7+
/sdk
8+
9+
# Ignore the dll files in the root of this module and the examples folders and script folders
10+
/*.dll
11+
/*.onnx
12+
/examples/**/*.dll
13+
/examples/**/*.onnx
14+
/scripts/*.dll
15+
/scripts/*.onnx
16+
17+
# Logs
18+
logs
19+
*.log
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
lerna-debug.log*
24+
25+
# Diagnostic reports (https://nodejs.org/api/report.html)
26+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
27+
28+
# Runtime data
29+
pids
30+
*.pid
31+
*.seed
32+
*.pid.lock
33+
34+
# Directory for instrumented libs generated by jscoverage/JSCover
35+
lib-cov
36+
37+
# Coverage directory used by tools like istanbul
38+
coverage
39+
*.lcov
40+
41+
# nyc test coverage
42+
.nyc_output
43+
44+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
45+
.grunt
46+
47+
# Bower dependency directory (https://bower.io/)
48+
bower_components
49+
50+
# node-waf configuration
51+
.lock-wscript
52+
53+
# Compiled binary addons (https://nodejs.org/api/addons.html)
54+
build/Release
55+
56+
# Dependency directories
57+
node_modules/
58+
jspm_packages/
59+
60+
# TypeScript v1 declaration files
61+
typings/
62+
63+
# TypeScript cache
64+
*.tsbuildinfo
65+
66+
# Optional npm cache directory
67+
.npm
68+
69+
# Optional eslint cache
70+
.eslintcache
71+
72+
# Microbundle cache
73+
.rpt2_cache/
74+
.rts2_cache_cjs/
75+
.rts2_cache_es/
76+
.rts2_cache_umd/
77+
78+
# Optional REPL history
79+
.node_repl_history
80+
81+
# Output of 'npm pack'
82+
*.tgz
83+
84+
# Yarn Integrity file
85+
.yarn-integrity
86+
87+
# dotenv environment variables file
88+
.env
89+
.env.test
90+
91+
# parcel-bundler cache (https://parceljs.org/)
92+
.cache
93+
94+
# Next.js build output
95+
.next
96+
97+
# Nuxt.js build / generate output
98+
.nuxt
99+
dist
100+
101+
# Gatsby files
102+
.cache/
103+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
104+
# https://nextjs.org/blog/next-9-1#public-directory-support
105+
# public
106+
107+
# vuepress build output
108+
.vuepress/dist
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2014 Wouter Verweirder <[email protected]>
1+
Copyright (c) 2019 Wouter Verweirder <[email protected]>
22

33
Permission is hereby granted, free of charge, to any person
44
obtaining a copy of this software and associated documentation

README.md

+30-43
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,46 @@
1-
# Node-Kinect2
1+
# Kinect2 Library for Node / Electron
22

3-
Nodejs library to access the kinect 2 data from the official MS SDK on Windows.
3+
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=NUZP3U3QZEQV2&currency_code=EUR&source=url)
44

5-
![Screenshot](https://raw.githubusercontent.com/wouterverweirder/node-kinect2/master/node-kinect2-skeleton.png)
5+
This library enables you to use the Kinect v2 in your nodejs or electron apps.
6+
7+
![screenshot of multi stream demo](examples/screenshots/multi-source-reader.png)
8+
9+
Features:
10+
11+
- get rgb camera feed
12+
- get depth feed
13+
- get ir feed
14+
- point cloud (greyscale and colored)
15+
- get skeleton joints (2d and 3d)
16+
- user masking
617

718
## Installation
819

920
You will need to install [the official Kinect 2 SDK](https://www.microsoft.com/en-us/download/details.aspx?id=44561) before you can use this module.
1021

11-
### node.js
22+
Just npm install like you would do with any regular module.
1223

13-
You need at least node version 0.12 to use this module. Older versions do not work. Just use npm install:
14-
15-
``` bash
16-
npm install kinect2
24+
```
25+
$ npm install kinect2
1726
```
1827

19-
### electron
28+
There are no precompiled binaries yet, so you need to have [node-gyp installed on your system](https://github.com/nodejs/node-gyp).
2029

21-
If you want to use this module inside an electron application, you will need to [build this module for electron usage](https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md). I've provided a build script which does just that.
30+
## Examples
2231

23-
You will need to have node-gyp & it's dependencies installed (https://github.com/nodejs/node-gyp) before you can continue.
32+
There are nodejs and electron examples in the examples/ folder of this repo. To run them, execute npm install and npm start:
2433

25-
``` bash
26-
# cd into the directory of kinect2
27-
cd node_modules\kinect2
28-
# run my build script to create a native binary for electron
29-
npm run build:electron
34+
```
35+
$ cd examples/electron
36+
$ npm install
37+
$ npm start
3038
```
3139

32-
## Usage
40+
The electron examples have the javascript code inside the html files. You can find these html files in [examples/electron/renderer/demos](examples/electron/renderer/demos).
3341

34-
```
35-
var Kinect2 = require('kinect2');
36-
37-
var kinect = new Kinect2();
38-
39-
if(kinect.open()) {
40-
console.log("Kinect Opened");
41-
//listen for body frames
42-
kinect.on('bodyFrame', function(bodyFrame){
43-
for(var i = 0; i < bodyFrame.bodies.length; i++) {
44-
if(bodyFrame.bodies[i].tracked) {
45-
console.log(bodyFrame.bodies[i]);
46-
}
47-
}
48-
});
49-
50-
//request body frames
51-
kinect.openBodyReader();
52-
53-
//close the kinect after 5 seconds
54-
setTimeout(function(){
55-
kinect.close();
56-
console.log("Kinect Closed");
57-
}, 5000);
58-
}
59-
```
42+
## Donate
43+
44+
Like this library? Always welcome to buy me a beer 🍺
45+
46+
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=NUZP3U3QZEQV2&currency_code=EUR&source=url)

binding.gyp

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{
2-
"targets": [
2+
'targets': [
33
{
44
"target_name": "kinect2",
5+
"cflags!": [ "-fno-exceptions" ],
6+
"cflags_cc!": [ "-fno-exceptions" ],
57
"sources": [ "src/kinect2.cc" ],
68
"include_dirs": [
7-
"<!(node -e \"require('nan')\")",
9+
"<!@(node -p \"require('node-addon-api').include\")",
810
"$(KINECTSDK20_DIR)\\inc"
911
],
1012
"conditions" : [
@@ -14,18 +16,8 @@
1416
["target_arch=='x64'", {
1517
"libraries": [ "-l$(KINECTSDK20_DIR)\\lib\\x64\\kinect20.lib" ]
1618
}]
17-
]
18-
},
19-
{
20-
"target_name": "action_after_build",
21-
"type": "none",
22-
"dependencies": [ "<(module_name)" ],
23-
"copies": [
24-
{
25-
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
26-
"destination": "<(module_path)"
27-
}
28-
]
19+
],
20+
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
2921
}
3022
]
3123
}

examples/basicexample.js

-26
This file was deleted.

examples/color-feed-browser-lwip/index.js

-64
This file was deleted.

examples/color-feed-browser-lwip/package.json

-16
This file was deleted.

0 commit comments

Comments
 (0)