Node.js API for Intel® RealSense™ SDK 2.0 [2.51.1]
npm install @cza_li/node-librealsenseThis module works with Intel® RealSense™ D400 series camera (and SR300 camera). It's part of the Intel® librealsense open source project.
``
const rs2 = require('node-librealsense');
const colorizer = new rs2.Colorizer(); // This will make depth image pretty
const pipeline = new rs2.Pipeline(); // Main work pipeline of RealSense camera
pipeline.start(); // Start camera
const frameset = pipeline.waitForFrames(); // Get a set of frames
const depth = frameset.depthFrame; // Get depth data
const depthRGB = colorizer.colorize(depth); // Make depth image pretty
const color = frameset.colorFrame; // Get RGB image
// TODO: use frame buffer data
depthRGB.getData();
color.getData();
// Before exiting, do cleanup.
rs2.cleanup();
`
More examples can be found in examples directory of the module.
1. Install Python 2.7.xx, make sure "Add python.exe to Path" is checked during the installation.
1. Install Visual Studio 2015 or 2017. The Visual Studio 2017 Community version also works.msbuild.exe
After installation, make sure is in PATH, e.g "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
1. Install CMake, make sure CMake is in system PATH (Choose "Add CMake to the system PATH for all users" or "Add CMake to the system PATH for the current user" during the installation).
Note: The npm module windows-build-tools is not suffcient to build the native C++ librealsense.
``
sudo apt install -y libusb-1.0-0-dev pkg-config libgtk-3-dev libglfw3-dev cmake
Please refer to Linux installation doc or Windows installation doc for full document of C++ librealsense build environment setup.
Note: OSX support for the full range of functionality offered by the SDK is not yet complete.
1. Install XCode 6.0+ via the AppStore.
2. Install the Homebrew package manager via terminal - link
3. Install the following packages via brew:
* brew install libusb pkg-configbrew install homebrew/versions/glfw3
* brew install cmake
*
``
npm install -g jsdoc
``
npm install --save node-librealsense
It will take a while to build C++ librealsense library, and then the Node.js addon will be built. If both of them succeed, the node-librealsense module is ready to use.
When it's installed, you can run examples to see if it works fine. Plug in your Intel® RealSense™ camera and do the following:
``
cd node-librealsense/examples
npm install
node nodejs-capture.js$3
1. nodejs-align.js: capture and then align RGB image frames to depth image frames, using depth info to remove background by a distance threshold.nodejs-capture.js
1. : display RGB image frames and colorized depth image frames that are captured in real timenodejs-save-to-disk.js
1. : capture a RGB image frame and a depth image frame, then save both of them to disk file (*.png)nodejs-pointcloud.js
1. : capture RGB image frames and depth image frames, and then use them to generate and visualize textured 3D pointcloud
for full reference document. If it isn't there, run the following commands to generate it:`
cd node-librealsense/
npm run doc
`5. Compatibility ##
List of supported platforms
- Windows 10 + Node.js x64 & ia32 - supported
- Windows 8.1 + Node.js x64 & ia32 - theoretically supported. Not verified yet.
- Ubuntu 16.04 + Node.js x64 & ia32 - supported
- Node.js v8 - supported
- Node.js v6 LTS - You might need to upgrade npm-bundled
node-gyp` to support Visual Studio 2017 (if you're using it)