├── src ├── slam │ ├── idl │ ├── common │ ├── map_image.cpp │ ├── default_values.h │ ├── scripts │ │ ├── generate.js │ │ ├── build.js │ │ └── generateAndBuild.js │ ├── index.js │ ├── tracking_result.cpp │ ├── argument_wrapper.h │ ├── fast-build.sh │ ├── occupancy_map_bounds.cpp │ ├── event_info.cpp │ ├── occupancy_tile.cpp │ ├── tracking_event.cpp │ ├── depth_of_interest.cpp │ ├── package.json │ ├── instance_creator.h │ ├── slam_handlers.h │ ├── tracking_event.h │ ├── async_channel.cpp │ ├── occupancy_tile.h │ ├── event_info.h │ ├── occupancy_map_data.cpp │ ├── occupancy_map_data.h │ ├── depth_of_interest.h │ ├── tracking_result.h │ ├── occupancy_map_bounds.h │ ├── examples │ │ └── map-sample.js │ └── map_image.h ├── librealsense │ ├── common │ ├── addon.cpp │ ├── index.js │ ├── context_runner.h │ ├── package.json │ ├── utils.h │ ├── frame_data.cpp │ ├── test │ │ ├── Context │ │ │ └── test-getDeviceCount.js │ │ ├── Device │ │ │ ├── test-getName.js │ │ │ ├── test-getSerial.js │ │ │ └── test-getFirmwareVersion.js │ │ └── test-context.js │ ├── context_runner.cpp │ ├── context.h │ ├── rs_payload.h │ ├── frame_data.h │ ├── context.cpp │ ├── rs_extrinsics.h │ ├── rs_extrinsics.cpp │ ├── README.md │ └── examples │ │ └── get-frame.js ├── object-recognition │ ├── idl │ ├── common │ ├── .spatialkernels │ │ ├── 3_3_256_1_1_1_1_15_15_1_1_384 │ │ ├── 3_3_384_1_1_1_1_15_15_1_1_256 │ │ ├── 5_5_96_1_1_1_1_31_31_1_1_256 │ │ ├── 11_11_3_1_4_4_1_227_227_1_1_96 │ │ └── 3_3_384_1_1_1_1_15_15_1_1_384 │ ├── batch.sh │ ├── index.js │ ├── fast-build.sh │ ├── instance_state_changer.h │ ├── object_recognition_label_name_translator.h │ ├── package.json │ ├── tracking_info.cpp │ ├── recognition_info.cpp │ ├── examples │ │ ├── create-and-exit.js │ │ ├── unplug-camera-while-running.js │ │ ├── localization.js │ │ ├── single-recognition.js │ │ └── frame-data.js │ ├── instance_creator.h │ ├── object_recognition_label_name_translator.cpp │ ├── localization_info.cpp │ ├── recognition_info.h │ ├── u.js │ ├── t.js │ ├── tracking_info.h │ ├── addon.cpp │ ├── localization_info.h │ └── object_recognizer.h ├── person-tracking │ ├── idl │ ├── common │ ├── worker │ │ ├── utils.cpp │ │ ├── utils.h │ │ ├── person_tracking_result_internal.h │ │ ├── person_data_internal.h │ │ ├── person_tracking_result_internal.cpp │ │ └── person_tracker_creator.h │ ├── test │ │ ├── README.md │ │ ├── StableTest │ │ │ ├── drawPng.pg │ │ │ ├── README.md │ │ │ └── getUsageRecord.sh │ │ ├── Point2D │ │ │ ├── test-point2d-distance.js │ │ │ ├── test-point2d-getCoords.js │ │ │ ├── test-point2d-setCoords.js │ │ │ └── test-point2d-equal.js │ │ ├── Point3D │ │ │ ├── test-point3d-distance.js │ │ │ ├── test-point3d-getCoords.js │ │ │ ├── test-point3d-setCoords.js │ │ │ └── test-point3d-equal.js │ │ └── PersonTracking │ │ │ └── test-persontracking-api-existence.js │ ├── index.js │ ├── pose_euler_angles.cpp │ ├── fast-build.sh │ ├── orientation_info.cpp │ ├── pose_info.cpp │ ├── skeleton_info.cpp │ ├── expression_info.cpp │ ├── pointing_data2d.cpp │ ├── pointing_data3d.cpp │ ├── lying_pose_info.cpp │ ├── package.json │ ├── face_landmark.cpp │ ├── face_landmark_info.cpp │ ├── person_recognizer_data_with_status.cpp │ ├── bounding_box2d_info.cpp │ ├── person_face_info.cpp │ ├── person_tracking_result.cpp │ ├── person_info.cpp │ ├── gesture_info.cpp │ ├── expression_info_collection.cpp │ ├── pointing_info.cpp │ ├── mask_info.cpp │ ├── skeleton_info.h │ ├── person_registration_data.cpp │ ├── pose_info.h │ ├── person_recognizer_data.cpp │ ├── orientation_info.h │ ├── expression_info.h │ ├── skeleton_point_info.cpp │ ├── person_tracking_result.h │ ├── person_tracking.h │ ├── pose_euler_angles.h │ ├── lying_pose_recognition.h │ ├── pointing_data2d.h │ ├── pointing_data3d.h │ ├── bounding_box2d_info.h │ ├── expression_info_collection.h │ ├── face_landmark.h │ ├── face_landmark_info.h │ ├── gesture_info.h │ ├── person_recognizer_data_with_status.h │ ├── point_combined_info.cpp │ ├── person_tracking.cpp │ ├── lying_pose_recognition.cpp │ ├── person_recognizer_data.h │ ├── person_registration_data.h │ ├── pointing_info.h │ ├── mask_info.h │ └── point_combined_info.h ├── package.json └── common │ ├── camera-options │ ├── camera_options_type.h │ ├── camera_options_host_instance.h │ └── camera_options_default.h │ ├── geometry │ ├── package.json │ ├── addon.cpp │ ├── float_equal.h │ ├── geometry_change_notify.h │ ├── scripts │ │ └── build.js │ ├── point2d.cpp │ ├── point3d.cpp │ ├── point3d.h │ ├── point2d.h │ ├── point_base.cpp │ ├── size2d.cpp │ └── range.cpp │ ├── scripts │ ├── process_idl.js │ ├── make_tarball.sh │ └── build_utils.js │ ├── type │ └── v8_alias.h │ ├── task │ └── async_task_runner_instance.h │ ├── camera-delegate │ └── camera_delegate_instance.h │ ├── intrinsics.cpp │ ├── frame_data.cpp │ ├── motion_sample.cpp │ ├── image.cpp │ ├── image_utils.h │ └── extrinsics.cpp ├── _config.yml ├── .jshintrc ├── samples └── ocf-realsense │ ├── demo1 │ ├── test │ │ ├── led-on.json │ │ ├── led-off.json │ │ ├── off.json │ │ ├── red.json │ │ ├── blue.json │ │ ├── green.json │ │ ├── white.json │ │ ├── oic-get │ │ ├── oic-post │ │ ├── oic-put │ │ └── README.md │ ├── ui-browser │ │ ├── .gitignore │ │ ├── .jshintrc │ │ ├── typings.json │ │ ├── jsconfig.json │ │ └── .eslintrc.json │ └── package.json │ ├── demo2 │ ├── test │ │ ├── buzzer-off.json │ │ ├── buzzer-on.json │ │ ├── rgbled-off.json │ │ ├── rgbled-green.json │ │ ├── rgbled-red.json │ │ ├── oic-get │ │ ├── oic-post │ │ ├── oic-put │ │ └── README.md │ ├── ui-browser │ │ ├── typings.json │ │ └── jsconfig.json │ └── package.json │ ├── doc │ ├── sh-ocf-arc.png │ ├── sensor_connection.png │ ├── demo1 │ │ ├── demo1_blue_ONE.png │ │ └── demo1_browser_ONE.png │ └── demo2 │ │ ├── demo2_red_light.png │ │ ├── demo2_browser_red.png │ │ ├── demo2_green_light.png │ │ └── demo2_browser_green.png │ └── ocf-servers │ ├── package.json │ ├── config │ └── security.boilerplate.json │ └── README.md ├── .gitmodules ├── config └── header.js ├── .gitignore ├── tools ├── .boto_config.json.template ├── package.json ├── .no_password.expect.template ├── install_realsense_pkgs.sh ├── Dockerfile.template ├── try_build_realsense_js.sh └── README.md ├── doc └── spec │ ├── Makefile │ └── README.md ├── .eslintrc.json ├── LICENSE └── .travis.yml /src/slam/idl: -------------------------------------------------------------------------------- 1 | ../idl/ -------------------------------------------------------------------------------- /src/slam/common: -------------------------------------------------------------------------------- 1 | ../common -------------------------------------------------------------------------------- /src/librealsense/common: -------------------------------------------------------------------------------- 1 | ../common/ -------------------------------------------------------------------------------- /src/object-recognition/idl: -------------------------------------------------------------------------------- 1 | ../idl/ -------------------------------------------------------------------------------- /src/person-tracking/idl: -------------------------------------------------------------------------------- 1 | ../idl -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /src/person-tracking/common: -------------------------------------------------------------------------------- 1 | ../common -------------------------------------------------------------------------------- /src/object-recognition/common: -------------------------------------------------------------------------------- 1 | ../common/ -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "esversion": 6, 3 | "node": true 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/led-on.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": 1 3 | } 4 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/ui-browser/.gitignore: -------------------------------------------------------------------------------- 1 | typings/ 2 | data/ 3 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/led-off.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": 0 3 | } 4 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/buzzer-off.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": false 3 | } 4 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/buzzer-on.json: -------------------------------------------------------------------------------- 1 | { 2 | "value": true 3 | } 4 | -------------------------------------------------------------------------------- /src/object-recognition/.spatialkernels/3_3_256_1_1_1_1_15_15_1_1_384: -------------------------------------------------------------------------------- 1 | 2 7 1 2 7 2 384 1 1 16 1 0 0 -------------------------------------------------------------------------------- /src/object-recognition/.spatialkernels/3_3_384_1_1_1_1_15_15_1_1_256: -------------------------------------------------------------------------------- 1 | 2 7 1 2 7 2 256 1 1 16 1 0 0 -------------------------------------------------------------------------------- /src/object-recognition/.spatialkernels/5_5_96_1_1_1_1_31_31_1_1_256: -------------------------------------------------------------------------------- 1 | 4 4 1 2 7 7 256 1 1 16 1 0 0 -------------------------------------------------------------------------------- /src/object-recognition/.spatialkernels/11_11_3_1_4_4_1_227_227_1_1_96: -------------------------------------------------------------------------------- 1 | 1 8 32 5 3 3032 1 1 8 1 1 0 0 -------------------------------------------------------------------------------- /src/object-recognition/.spatialkernels/3_3_384_1_1_1_1_15_15_1_1_384: -------------------------------------------------------------------------------- 1 | 13 1 1 2 1 13 384 1 1 16 1 0 0 -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/off.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [0, 0, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/red.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [255, 0, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/blue.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [0, 0, 255], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/green.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [0, 255, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/rgbled-off.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [0, 0, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/white.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [255, 255, 255], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/rgbled-green.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [0, 255, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/rgbled-red.json: -------------------------------------------------------------------------------- 1 | { 2 | "rgbValue": [255, 0, 0], 3 | "range": [0, 255] 4 | } 5 | -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/sh-ocf-arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/sh-ocf-arc.png -------------------------------------------------------------------------------- /src/object-recognition/batch.sh: -------------------------------------------------------------------------------- 1 | mocha test/test-options.js 2 | 3 | while [ $? -eq 0 ]; do 4 | mocha test/test-options.js 5 | done 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/common/tests/data"] 2 | path = src/common/tests/data 3 | url = https://github.com/01org/node-realsense-test-data 4 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/ui-browser/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "undef": false, 3 | "unused": true, 4 | "esversion": 6, 5 | "predef": [ "THREE" ] 6 | } -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/sensor_connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/sensor_connection.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo1/demo1_blue_ONE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo1/demo1_blue_ONE.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo2/demo2_red_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo2/demo2_red_light.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo1/demo1_browser_ONE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo1/demo1_browser_ONE.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo2/demo2_browser_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo2/demo2_browser_red.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo2/demo2_green_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo2/demo2_green_light.png -------------------------------------------------------------------------------- /samples/ocf-realsense/doc/demo2/demo2_browser_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intel/node-realsense/HEAD/samples/ocf-realsense/doc/demo2/demo2_browser_green.png -------------------------------------------------------------------------------- /config/header.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/ui-browser/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": false, 3 | "dependencies": {}, 4 | "globalDependencies": { 5 | "three": "registry:dt/three#0.0.0+20160627210315" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/ui-browser/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": false, 3 | "dependencies": {}, 4 | "globalDependencies": { 5 | "three": "registry:dt/three#0.0.0+20160627210315" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | .DS_Store 3 | .*.sw? 4 | *.gypcmd 5 | *.mk 6 | *.pyc 7 | *.tar.gz 8 | *.log 9 | build 10 | cscope.* 11 | gen 12 | node_modules 13 | npm-debug.log 14 | tags 15 | tools/.boto_config.json 16 | tools/.no_password.expect 17 | tools/.docker 18 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/ui-browser/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=759670 3 | // for the documentation about the jsconfig.json format 4 | "compilerOptions": { 5 | "target": "es6", 6 | "module": "system" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/ui-browser/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=759670 3 | // for the documentation about the jsconfig.json format 4 | "compilerOptions": { 5 | "target": "es6", 6 | "module": "system" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/ocf-realsense/ocf-servers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ocf-servers", 3 | "version": "0.0.1", 4 | "description": "The JavaScript version of ocf-servers", 5 | "author": "Hongjuan Wang ", 6 | "license": "Apache-2.0", 7 | "dependencies": { 8 | "uuid": "^2.0.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tools/.boto_config.json.template: -------------------------------------------------------------------------------- 1 | { 2 | "archive_server": { 3 | "host": "", 4 | "nightly_dir": "", 5 | "official_dir": "", 6 | "usergroup": "", 7 | "username": "" 8 | }, 9 | "build_type": "nightly", 10 | "bump_version": true, 11 | "tarball_only": false, 12 | "upload_build": true 13 | } 14 | -------------------------------------------------------------------------------- /src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "multiple-addon-test", 3 | "version": "0.0.1", 4 | "description": "Only for test cases", 5 | "directories": { 6 | "test": "test" 7 | }, 8 | "scripts": { 9 | "test": "mocha" 10 | }, 11 | "author": "", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "assert": "^1.4.1", 15 | "bindings": "^1.2.1", 16 | "tmp": "0.0.31" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/common/camera-options/camera_options_type.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CAMERA_OPTIONS_TYPE_H_ 6 | #define _CAMERA_OPTIONS_TYPE_H_ 7 | 8 | #include "gen/camera_options.h" 9 | 10 | typedef DictionaryCameraOptions CameraOptionsType; 11 | 12 | #endif // _CAMERA_OPTIONS_TYPE_H_ 13 | -------------------------------------------------------------------------------- /src/common/geometry/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "geometry", 3 | "version": "0.0.1", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "mocha", 8 | "postinstall": "node scripts/build.js" 9 | }, 10 | "author": "", 11 | "license": "TBD", 12 | "devDependencies": { 13 | "assert": "^1.4.1", 14 | "bindings": "^1.2.1", 15 | "path": "^0.12.7", 16 | "widl-nan": "^0.1.3" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/person-tracking/worker/utils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "worker/utils.h" 6 | 7 | #include 8 | 9 | void DebugInfoMessage() { 10 | std::cout << std::endl << std::flush; 11 | } 12 | 13 | void DebugErrorMessage() { 14 | std::cerr << std::endl << std::flush; 15 | } 16 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pt_tutorial_1_web", 3 | "version": "0.0.1", 4 | "description": "The JavaScript version of pt_tutorial_1_web", 5 | "main": "main.js", 6 | "author": "Ting Shao ", 7 | "license": "Apache-2.0", 8 | "dependencies": { 9 | "express": "^4.14.0", 10 | "jpeg-turbo": "^0.4.0", 11 | "node-person": "^0.10.0", 12 | "ws": "^7.0.0", 13 | "colors": "1.1.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pt_tutorial_4_web", 3 | "version": "0.0.1", 4 | "description": "The JavaScript version of pt_tutorial_4_web", 5 | "main": "main.js", 6 | "author": "Ting Shao ", 7 | "license": "Apache-2.0", 8 | "dependencies": { 9 | "express": "^4.14.0", 10 | "jpeg-turbo": "^0.4.0", 11 | "node-person": "^0.10.0", 12 | "ws": "^7.0.0", 13 | "colors": "^1.1.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/common/scripts/process_idl.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | const g = require('widl-nan').generator; 6 | 7 | Promise.all(process.argv.slice(3).map(function(val, index, array) { 8 | return g.addFile(val); 9 | })).then(function() { 10 | g.compile(); 11 | g.writeToDir(process.argv[2]); 12 | }).catch((e) => { 13 | console.log(e); 14 | }); 15 | -------------------------------------------------------------------------------- /src/common/type/v8_alias.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _V8_ALIAS_H_ 6 | #define _V8_ALIAS_H_ 7 | 8 | #include 9 | 10 | typedef v8::Local v8_promise_t; 11 | typedef v8::Local v8_object_t; 12 | typedef v8::Local v8_value_t; 13 | typedef v8::Local v8_array_t; 14 | 15 | #endif // _V8_ALIAS_H_ 16 | -------------------------------------------------------------------------------- /src/slam/map_image.cpp: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #include "map_image.h" 4 | 5 | MapImage::MapImage() 6 | : width_(0), height_(0) { 7 | } 8 | 9 | MapImage::~MapImage() { 10 | } 11 | 12 | MapImage& MapImage::operator = (const MapImage& rhs) { 13 | if (&rhs != this) { 14 | // TODO(widl-nan): copy members from rhs 15 | } 16 | return *this; 17 | } 18 | 19 | void MapImage::SetupTypedArray() { 20 | SetupTypedArrayHelper(&data_, 21 | data_store_.data(), 22 | data_store_.size()); 23 | } 24 | -------------------------------------------------------------------------------- /src/slam/default_values.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _DEFAULT_VALUIES_H_ 6 | #define _DEFAULT_VALUIES_H_ 7 | 8 | // TODO(Donna): could defines be in namespace? 9 | 10 | #define DEBUG false 11 | #define SLAM_ADDON_ERROR -10000 12 | #define SLAM_ERROR_PREFIX "SLAM - " 13 | #define BT_BUF_SIZE 500 14 | #define DEFAULT_OCCUPANCY_MAP_CAPACITY 500 15 | 16 | #endif // _DEFAULT_VALUIES_H_ 17 | -------------------------------------------------------------------------------- /src/slam/scripts/generate.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | const w = require('widl-nan'); 6 | const g = w.generator; 7 | 8 | Promise.all([ 9 | g.addFile('idl/common/realsense-camera.widl'), 10 | g.addFile('idl/common/geometry.widl'), 11 | g.addFile('idl/slam/slam.widl'), 12 | ]).then(function() { 13 | g.compile(); 14 | g.writeToDir('gen'); 15 | }).catch((e) => { 16 | console.log(e); 17 | }); 18 | -------------------------------------------------------------------------------- /src/person-tracking/test/README.md: -------------------------------------------------------------------------------- 1 | # How to run unit test 2 | ## Prepare 3 | ``` 4 | npm install mocha -g 5 | ``` 6 | 7 | ## Build addon from source 8 | ``` 9 | cd src/person-tracking 10 | npm install 11 | ``` 12 | 13 | ## Run unit test 14 | + run one single test 15 | ``` 16 | mocha test/BoundingBox2DInfo/test-boundingbox2dinfo-api-existence.js 17 | ``` 18 | + run all api tests 19 | ``` 20 | mocha test/*/*.js 21 | ``` 22 | + run all 'personTrackerOptions' tests 23 | ``` 24 | mocha test/*/*/*.js 25 | ``` 26 | 27 | # IDL: 28 | the code is based on the ./idl/pt.widl currently. 29 | -------------------------------------------------------------------------------- /src/person-tracking/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | let pt = require('bindings')('realsense_person_tracking'); 8 | let emitter = require('events').EventEmitter; 9 | 10 | function inherits(target, source) { 11 | // eslint-disable-next-line 12 | for (let k in source.prototype) { 13 | target.prototype[k] = source.prototype[k]; 14 | } 15 | } 16 | inherits(pt.PersonTracker, emitter); 17 | module.exports = pt; 18 | -------------------------------------------------------------------------------- /src/librealsense/addon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "gen/nan__context.h" 6 | #include "gen/nan__device.h" 7 | #include "gen/nan__frame_data.h" 8 | #include "gen/nan__rs_extrinsics.h" 9 | 10 | void initModule(v8::Local exports) { 11 | NanContext::Init(exports); 12 | NanDevice::Init(exports); 13 | NanFrameData::Init(exports); 14 | NanRSExtrinsics::Init(exports); 15 | } 16 | 17 | NODE_MODULE(node_librealsense, initModule); 18 | -------------------------------------------------------------------------------- /src/slam/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | let slamAddon = require('bindings')('realsense_slam'); 8 | let EventEmitter = require('events').EventEmitter; 9 | 10 | function inherits(target, source) { 11 | // eslint-disable-next-line 12 | for (let k in source.prototype) { 13 | target.prototype[k] = source.prototype[k]; 14 | } 15 | } 16 | inherits(slamAddon.Instance, EventEmitter); 17 | 18 | module.exports = slamAddon; 19 | -------------------------------------------------------------------------------- /src/common/camera-options/camera_options_host_instance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CAMERA_OPTIONS_HOST_INSTANCE_H_ 6 | #define _CAMERA_OPTIONS_HOST_INSTANCE_H_ 7 | 8 | #include "camera_options_host.h" 9 | 10 | class CameraOptionsHostInstance { 11 | CameraOptionsHostInstance(); 12 | ~CameraOptionsHostInstance(); 13 | 14 | public: 15 | static CameraOptionsHost* GetInstance(); 16 | }; 17 | 18 | #endif // _CAMERA_OPTIONS_HOST_INSTANCE_H_ 19 | -------------------------------------------------------------------------------- /src/common/task/async_task_runner_instance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _ASYNC_TASK_RUNNER_INSTANCE_ 6 | #define _ASYNC_TASK_RUNNER_INSTANCE_ 7 | 8 | #include "async_task_runner.h" 9 | 10 | class AsyncTaskRunnerInstance { 11 | AsyncTaskRunnerInstance(); 12 | ~AsyncTaskRunnerInstance(); 13 | 14 | public: 15 | static AsyncTaskRunner* GetInstance(); 16 | static void DestroyInstance(); 17 | }; 18 | 19 | #endif // _ASYNC_TASK_RUNNER_INSTANCE_ 20 | -------------------------------------------------------------------------------- /src/librealsense/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('node_librealsense'); 8 | const EventEmitter = require('events').EventEmitter; 9 | 10 | function inherits(target, source) { 11 | // eslint-disable-next-line 12 | for (let k in source.prototype) { 13 | target.prototype[k] = source.prototype[k]; 14 | } 15 | } 16 | 17 | inherits(addon.Device, EventEmitter); 18 | 19 | module.exports = addon; 20 | -------------------------------------------------------------------------------- /src/slam/tracking_result.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "tracking_result.h" 6 | 7 | TrackingResult::TrackingResult() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | TrackingResult::~TrackingResult() { 12 | // TODO(widl-nan): do cleanup if necessary 13 | } 14 | 15 | TrackingResult& TrackingResult::operator = (const TrackingResult& rhs) { 16 | if (&rhs != this) { 17 | // TODO(widl-nan): copy members from rhs 18 | } 19 | return *this; 20 | } 21 | -------------------------------------------------------------------------------- /src/common/camera-delegate/camera_delegate_instance.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CAMERA_DELEGATE_INSTANCE_H_ 6 | #define _CAMERA_DELEGATE_INSTANCE_H_ 7 | 8 | #include "camera_delegate.h" 9 | 10 | class CameraDelegateInstance { 11 | CameraDelegateInstance() = delete; 12 | ~CameraDelegateInstance() = delete; 13 | 14 | public: 15 | static CameraDelegate* GetInstance(); 16 | static void DestroyInstance(); 17 | }; 18 | 19 | #endif // _CAMERA_DELEGATE_INSTANCE_H_ 20 | -------------------------------------------------------------------------------- /src/librealsense/context_runner.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CONTEXT_RUNNER_H_ 6 | #define _CONTEXT_RUNNER_H_ 7 | 8 | namespace rs { 9 | class context; 10 | class device; 11 | } // namespace rs 12 | 13 | class ContextRunner { 14 | public: 15 | ContextRunner(); 16 | ~ContextRunner(); 17 | 18 | int GetDeviceCount(); 19 | rs::device* GetRSDevice(int index); 20 | 21 | protected: 22 | rs::context* GetRSContext(); 23 | }; 24 | 25 | #endif // _CONTEXT_RUNNER_H_ 26 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/ui-browser/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es6": true, 6 | "node": true 7 | }, 8 | "parserOptions": { 9 | "ecmaFeatures": { 10 | "jsx": true 11 | }, 12 | "sourceType": "script" 13 | }, 14 | "rules": { 15 | "no-const-assign": "warn", 16 | "no-this-before-super": "warn", 17 | "no-undef": "warn", 18 | "no-unreachable": "warn", 19 | "no-unused-vars": "warn", 20 | "constructor-super": "warn", 21 | "valid-typeof": "warn" 22 | } 23 | } -------------------------------------------------------------------------------- /src/object-recognition/index.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('realsense_object_recognition'); 8 | const EventEmitter = require('events').EventEmitter; 9 | 10 | function inherits(target, source) { 11 | // eslint-disable-next-line 12 | for (let k in source.prototype) { 13 | target.prototype[k] = source.prototype[k]; 14 | } 15 | } 16 | 17 | inherits(addon.ObjectRecognizer, EventEmitter); 18 | 19 | module.exports = addon; 20 | -------------------------------------------------------------------------------- /doc/spec/Makefile: -------------------------------------------------------------------------------- 1 | # Make sure bikeshed is installed 2 | # https://github.com/tabatkins/bikeshed/blob/master/docs/install.md 3 | 4 | all : object-recognition.html person-tracking.html slam.html common.html 5 | 6 | common.html : bikeshed/common.bs 7 | bikeshed spec bikeshed/common.bs common.html 8 | 9 | object-recognition.html : bikeshed/object-recognition.bs 10 | bikeshed spec bikeshed/object-recognition.bs object-recognition.html 11 | 12 | person-tracking.html : bikeshed/person-tracking.bs 13 | bikeshed spec bikeshed/person-tracking.bs person-tracking.html 14 | 15 | slam.html : bikeshed/slam.bs 16 | bikeshed spec bikeshed/slam.bs slam.html 17 | -------------------------------------------------------------------------------- /src/slam/argument_wrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _ARGUMENT_WRAPPER_H_ 6 | #define _ARGUMENT_WRAPPER_H_ 7 | 8 | #include 9 | 10 | class ArgumentWrapper { 11 | public: 12 | ArgumentWrapper(std::string file_name, bool draw_camera_trajectory) { 13 | this->file_name = file_name; 14 | this->draw_camera_trajectory = draw_camera_trajectory; 15 | } 16 | 17 | public: 18 | std::string file_name; 19 | bool draw_camera_trajectory; 20 | }; 21 | 22 | #endif // _ARGUMENT_WRAPPER_H_ 23 | -------------------------------------------------------------------------------- /src/common/geometry/addon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "gen/nan__point2d.h" 6 | #include "gen/nan__point3d.h" 7 | #include "gen/nan__range.h" 8 | #include "gen/nan__size2d.h" 9 | #include "gen/nan__rect2d.h" 10 | 11 | void initModule(v8::Local exports) { 12 | NanPoint2D::Init(exports); 13 | 14 | NanPoint3D::Init(exports); 15 | 16 | NanRange::Init(exports); 17 | 18 | NanSize2D::Init(exports); 19 | 20 | NanRect2D::Init(exports); 21 | } 22 | 23 | NODE_MODULE(testAttributes, initModule); 24 | -------------------------------------------------------------------------------- /src/common/geometry/float_equal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _COMMON_GEOMETRY_FLOAT_EQUAL_H_ 6 | #define _COMMON_GEOMETRY_FLOAT_EQUAL_H_ 7 | #include 8 | 9 | inline bool double_equal(const double& v1, const double& v2) { 10 | return std::isgreaterequal(v1, v2) && std::isgreaterequal(v2, v1); 11 | } 12 | 13 | inline bool float_equal(const float& v1, const float& v2) { 14 | return std::isgreaterequal(v1, v2) && std::isgreaterequal(v2, v1); 15 | } 16 | 17 | #endif // _COMMON_GEOMETRY_FLOAT_EQUAL_H_ 18 | -------------------------------------------------------------------------------- /tools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-realsense-tools", 3 | "version": "1.0.0", 4 | "description": "Tools dir under node-realsense", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Halton Huo ", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "eslint": "^3.10.2", 13 | "eslint-config-google": "^0.7.0", 14 | "eslint-config-standard": "^6.2.1", 15 | "eslint-plugin-header": "^0.1.0", 16 | "eslint-plugin-promise": "^3.4.0", 17 | "eslint-plugin-standard": "^2.0.1", 18 | "jslint": "^0.10.3", 19 | "widl-nan": "^0.1.7" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/person-tracking/test/StableTest/drawPng.pg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/gnuplot 2 | # 3 | # Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | 8 | reset 9 | set terminal png 10 | 11 | set timefmt "%H:%M:%S" 12 | set xlabel "time" 13 | 14 | set ylabel "resource usage (%)" 15 | 16 | set title "Joule Performance(CPU,GPU and Memory)" 17 | set key reverse Left outside 18 | set grid 19 | 20 | set style data linespoints 21 | 22 | plot "mem_info.dat" using 1:6 title "mem usage",\ 23 | "cpu_used.dat" using 1:2 title "cpu usage",\ 24 | "gpu.dat" using 1:2 title "gpu usage" 25 | # 26 | -------------------------------------------------------------------------------- /src/person-tracking/pose_euler_angles.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "pose_euler_angles.h" 6 | 7 | #include 8 | 9 | PoseEulerAngles::PoseEulerAngles() : yaw_(0), pitch_(0), roll_(0) {} 10 | 11 | PoseEulerAngles::~PoseEulerAngles() { 12 | // TODO(widl-nan): do cleanup if necessary 13 | } 14 | 15 | PoseEulerAngles& PoseEulerAngles::operator = ( 16 | const PoseEulerAngles& rhs) { 17 | if (&rhs != this) { 18 | yaw_ = rhs.yaw_; 19 | pitch_ = rhs.pitch_; 20 | roll_ = rhs.roll_; 21 | } 22 | return *this; 23 | } 24 | -------------------------------------------------------------------------------- /src/slam/fast-build.sh: -------------------------------------------------------------------------------- 1 | # Workaround of node-gyp build issue 2 | target=`ls build/*.mk` 3 | alter=`ls build/*.mk`".new" 4 | sed 's/widl\ FORCE_DO_CMD/widl/' -r $target > $alter 5 | cp -f $alter $target 6 | 7 | # Build current add-on 8 | node-gyp build -j 8 9 | 10 | # Lint tool -- Make your code great again by making lint happy again 11 | if [ $? -eq 0 ]; then 12 | # Save current dir 13 | saved=`pwd` 14 | 15 | cd ../../ && python tools/node_modules/widl-nan/tools/lint.py --base=master 16 | 17 | # Test: to do, or not to do 18 | if [ $# -gt 0 ] && [ $1 == "test" ]; then 19 | cd $saved && mocha $2 20 | else 21 | echo "Note: to run test, type '$0 test' or '$0 test '" 22 | fi 23 | fi 24 | -------------------------------------------------------------------------------- /src/person-tracking/fast-build.sh: -------------------------------------------------------------------------------- 1 | # Workaround of node-gyp build issue 2 | target=`ls build/*.mk` 3 | alter=`ls build/*.mk`".new" 4 | sed 's/widl\ FORCE_DO_CMD/widl/' -r $target > $alter 5 | cp -f $alter $target 6 | 7 | # Build current add-on 8 | node-gyp build -j 8 9 | 10 | # Lint tool -- Make your code great again by making lint happy again 11 | if [ $? -eq 0 ]; then 12 | # Save current dir 13 | saved=`pwd` 14 | 15 | cd ../../ && python tools/node_modules/widl-nan/tools/lint.py --base=master 16 | 17 | # Test: to do, or not to do 18 | if [ $# -gt 0 ] && [ $1 == "test" ]; then 19 | cd $saved && mocha $2 20 | else 21 | echo "Note: to run test, type '$0 test' or '$0 test '" 22 | fi 23 | fi 24 | -------------------------------------------------------------------------------- /src/object-recognition/fast-build.sh: -------------------------------------------------------------------------------- 1 | # Workaround of node-gyp build issue 2 | target=`ls build/*.mk` 3 | alter=`ls build/*.mk`".new" 4 | sed 's/widl\ FORCE_DO_CMD/widl/' -r $target > $alter 5 | cp -f $alter $target 6 | 7 | # Build current add-on 8 | node-gyp build -j 8 9 | 10 | # Lint tool -- Make your code great again by making lint happy again 11 | if [ $? -eq 0 ]; then 12 | # Save current dir 13 | saved=`pwd` 14 | 15 | cd ../../ && python tools/node_modules/widl-nan/tools/lint.py --base=master 16 | 17 | # Test: to do, or not to do 18 | if [ $# -gt 0 ] && [ $1 == "test" ]; then 19 | cd $saved && mocha $2 20 | else 21 | echo "Note: to run test, type '$0 test' or '$0 test '" 22 | fi 23 | fi 24 | -------------------------------------------------------------------------------- /tools/.no_password.expect.template: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect -f 2 | # 3 | # Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | # This script is to unlock the private key and add the key to ssh-agent 8 | # in non-interactive mode. 9 | # 10 | # CAUTION: Keep this file carefully because it contains plain text 11 | # of your passphrase 12 | # 13 | # CUSTIMZATION: Substitute and 14 | # with your own. 15 | 16 | spawn ssh-add 17 | expect "Enter passphrase for :" 18 | send "\n"; 19 | expect eof 20 | exit 21 | -------------------------------------------------------------------------------- /src/librealsense/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-librealsense", 3 | "version": "0.10.1", 4 | "description": "librealsense Node.js module based on Intel® RealSense™ technology", 5 | "main": "index.js", 6 | "scripts": { 7 | "install": "node -e \"require('./common/scripts/build_utils.js').runNodeGyp();\"", 8 | "maketarball": "bash ./common/scripts/make_tarball.sh librealsense", 9 | "test": "mocha" 10 | }, 11 | "author": "Minggang Wang ", 12 | "license": "MIT", 13 | "dependencies": { 14 | "bindings": "^1.2.1", 15 | "nan": "^2.4.0", 16 | "widl-nan": "^0.1.23" 17 | }, 18 | "devDependencies": { 19 | "spawn-npm-install": "^1.2.0", 20 | "tmp": "0.0.31" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/person-tracking/orientation_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "orientation_info.h" 6 | 7 | OrientationInfo::OrientationInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | OrientationInfo::~OrientationInfo() { 12 | // TODO(widl-nan): do cleanup if necessary 13 | } 14 | 15 | OrientationInfo& OrientationInfo::operator = (const OrientationInfo& rhs) { 16 | if (&rhs != this) { 17 | // TODO(widl-nan): copy members from rhs 18 | orientation_ = rhs.orientation_; 19 | confidence_ = rhs.confidence_; 20 | } 21 | 22 | return *this; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "google", 3 | "parserOptions": { 4 | "ecmaVersion": 6 5 | }, 6 | "plugins": [ 7 | "header" 8 | ], 9 | "rules": { 10 | "header/header": [2, "config/header.js"], 11 | "max-len": ["error", 12 | // Following Google Javascript 100 char line limit 13 | 100, 14 | // Use 2-space as tab width 15 | 2, 16 | { "ignoreUrls": true } 17 | ], 18 | // Prefer to use single quotes 19 | "quotes": ["error", "single"], 20 | // Disable JSDoc 21 | "require-jsdoc": ["error", { 22 | "require": { 23 | "FunctionDeclaration": false, 24 | "MethodDefinition": false, 25 | "ClassDeclaration": false 26 | } 27 | }] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/person-tracking/pose_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "pose_info.h" 6 | 7 | PoseInfo::PoseInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | PoseInfo::PoseInfo(const PoseInfo& rhs) { 12 | position_ = rhs.position_; 13 | confidence_ = rhs.confidence_; 14 | } 15 | 16 | PoseInfo::~PoseInfo() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | PoseInfo& PoseInfo::operator = (const PoseInfo& rhs) { 21 | if (&rhs != this) { 22 | position_ = rhs.position_; 23 | confidence_ = rhs.confidence_; 24 | } 25 | 26 | return *this; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/slam/occupancy_map_bounds.cpp: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #include "occupancy_map_bounds.h" 4 | 5 | OccupancyMapBounds::OccupancyMapBounds() { 6 | // TODO(widl-nan): init your members 7 | } 8 | 9 | OccupancyMapBounds::OccupancyMapBounds(const OccupancyMapBounds& rhs) { 10 | // TODO(widl-nan): copy from rhs if you want this behavior 11 | // Or mark ctor = delete in occupancy_map_bounds.h 12 | } 13 | 14 | OccupancyMapBounds::~OccupancyMapBounds() { 15 | // TODO(widl-nan): do cleanup if necessary 16 | } 17 | 18 | OccupancyMapBounds& OccupancyMapBounds::operator=( 19 | const OccupancyMapBounds& rhs) { 20 | if (&rhs != this) { 21 | // TODO(widl-nan): copy members from rhs 22 | } 23 | return *this; 24 | } 25 | -------------------------------------------------------------------------------- /src/slam/event_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "event_info.h" 6 | 7 | EventInfo::EventInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | EventInfo::EventInfo(const EventInfo& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in event_info.h 14 | } 15 | 16 | EventInfo::~EventInfo() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | EventInfo& EventInfo::operator = (const EventInfo& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | return *this; 25 | } 26 | -------------------------------------------------------------------------------- /src/librealsense/utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _UTILS_H 6 | #define _UTILS_H 7 | 8 | #include 9 | #include 10 | 11 | rs::stream GetRSStreamFromString(const std::string& stream); 12 | 13 | std::string GetStringFromRSStream(const rs::stream stream); 14 | 15 | rs::option GetRSOptionFromString(const std::string& option); 16 | 17 | std::string GetStringFromRSFormat(const rs::format format); 18 | 19 | rs::camera_info GetCameraInfoFromString(const std::string& info); 20 | 21 | rs::format GetRSFormatFromString(const std::string& format); 22 | 23 | #endif // _UTILS_H 24 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point2D/test-point2d-distance.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point2D API Test', function() { 11 | describe('distance Test', function() { 12 | it.skip('parameters are two point2D objects', function() { 13 | let obj = new pt.Point2D(1.0, 2.0); 14 | let objTest = new pt.Point2D(1.0, 3.0); 15 | let result = obj.distance(obj, objTest); 16 | assert.equal(result, 1.0); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/oic-get: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | #echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 26 | curl --noproxy "*" -w "\nHTTP: %{http_code}\n" --no-buffer ${CERT}\ 27 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 28 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/oic-get: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | #echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 26 | curl --noproxy "*" -w "\nHTTP: %{http_code}\n" --no-buffer ${CERT}\ 27 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 28 | -------------------------------------------------------------------------------- /src/librealsense/frame_data.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "frame_data.h" 6 | 7 | FrameData::FrameData() : own_data_(true) { 8 | data_.data = nullptr; 9 | } 10 | 11 | FrameData::FrameData(const FrameData& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in frame_data.h 14 | } 15 | 16 | FrameData::~FrameData() { 17 | if (own_data_) 18 | free(data_.data); 19 | } 20 | 21 | FrameData& FrameData::operator = (const FrameData& rhs) { 22 | if (&rhs != this) { 23 | // TODO(widl-nan): copy members from rhs 24 | } 25 | return *this; 26 | } 27 | -------------------------------------------------------------------------------- /src/librealsense/test/Context/test-getDeviceCount.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('node_librealsense'); 8 | 9 | describe('Test Context interfaces', function() { 10 | let context = new addon.Context; 11 | 12 | it('Negative - Call getDeviceCount with 1 option', function() { 13 | return new Promise((resolve, reject) => { 14 | context.getDeviceCount('dummy').then((count) => { 15 | reject('Should get reject but got resolved promise'); 16 | }).catch((e) => { 17 | resolve(e); 18 | }); 19 | }); 20 | }); 21 | }); 22 | 23 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point3D/test-point3d-distance.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point3D API Test', function() { 11 | describe('distance Test', function() { 12 | it.skip('parameters are two point3D objects', function() { 13 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 14 | let objTest = new pt.Point3D(1.0, 2.0, 4.0); 15 | let result = obj.distance(obj, objTest); 16 | assert.equal(result, 1.0); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /src/common/intrinsics.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/intrinsics.h" 6 | 7 | Intrinsics::Intrinsics() { 8 | } 9 | 10 | Intrinsics::Intrinsics(const Intrinsics& rhs) { 11 | CopyFrom(rhs); 12 | } 13 | 14 | Intrinsics::~Intrinsics() { 15 | } 16 | 17 | Intrinsics& Intrinsics::operator = (const Intrinsics& rhs) { 18 | CopyFrom(rhs); 19 | return *this; 20 | } 21 | 22 | void Intrinsics::CopyFrom(const Intrinsics& rhs) { 23 | if (this != &rhs) { 24 | width_ = rhs.width_; 25 | height_ = rhs.height_; 26 | principalPoint_ = rhs.principalPoint_; 27 | focalLength_ = rhs.focalLength_; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/person-tracking/skeleton_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "skeleton_info.h" 6 | 7 | SkeletonInfo::SkeletonInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | SkeletonInfo::SkeletonInfo(const SkeletonInfo& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in skeleton_info.h 14 | } 15 | 16 | SkeletonInfo::~SkeletonInfo() { 17 | skeletonJoints_.FreeArray(); 18 | } 19 | 20 | SkeletonInfo& SkeletonInfo::operator = (const SkeletonInfo& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | 25 | return *this; 26 | } 27 | -------------------------------------------------------------------------------- /doc/spec/README.md: -------------------------------------------------------------------------------- 1 | # Editorial Documentation 2 | 3 | The specification is built using Bikeshed which is a pre-processor for spec documents. If you want to contribute to the spec, please make sure that they result in a specification that will build correctly. 4 | 5 | 1. Install [Bikeshed](https://github.com/tabatkins/bikeshed). 6 | 2. Edit the source file `*.bs` under the `bikeshed` folder. 7 | 3. Run bikeshed to generate a final spec document: `cd doc/spec; make` 8 | 9 | **NOTE**: 10 | 1. DONOT edit the .html directly. 11 | 2. Bikeshed will inject its SHA1 on meta, thus the generated .html will be changed. Ideally we do not accept that kind of change with only meta line changed. 12 | 3. The detailed features of Bikeshed could refer to [Bikeshed Documentation](https://tabatkins.github.io/bikeshed). 13 | -------------------------------------------------------------------------------- /src/object-recognition/instance_state_changer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _INSTANCE_STATE_CHANGER_H_ 6 | #define _INSTANCE_STATE_CHANGER_H_ 7 | 8 | #include 9 | 10 | #define OR_STATE_READY ("ready") 11 | #define OR_STATE_RUNNING ("running") 12 | #define OR_STATE_PAUSED ("paused") 13 | #define OR_STATE_ERRORED ("errored") 14 | 15 | class InstanceStateChanger { 16 | public: 17 | InstanceStateChanger() {} 18 | virtual ~InstanceStateChanger() {} 19 | 20 | virtual std::string GetInstanceState() const = 0; 21 | virtual void SetInstanceState(const std::string& state) = 0; 22 | }; 23 | 24 | #endif // _INSTANCE_STATE_CHANGER_H_ 25 | -------------------------------------------------------------------------------- /src/object-recognition/object_recognition_label_name_translator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _OBJECT_RECOGNITION_LABEL_NAME_TRANSLATOR_H_ 6 | #define _OBJECT_RECOGNITION_LABEL_NAME_TRANSLATOR_H_ 7 | 8 | #include 9 | 10 | class ObjectRecognitionLabelNameTranslator { 11 | public: 12 | ObjectRecognitionLabelNameTranslator(); 13 | virtual ~ObjectRecognitionLabelNameTranslator(); 14 | 15 | std::string Translate(size_t id); 16 | 17 | private: 18 | virtual std::string DoTranslate(size_t id) = 0; 19 | 20 | class ObjectRecognitionLabelNameTranslatorD* d_; 21 | }; 22 | 23 | #endif // _OBJECT_RECOGNITION_LABEL_NAME_TRANSLATOR_H_ 24 | -------------------------------------------------------------------------------- /src/person-tracking/expression_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "expression_info.h" 6 | 7 | ExpressionInfo::ExpressionInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | ExpressionInfo::ExpressionInfo(const ExpressionInfo& rhs) { 12 | type_ = rhs.type_; 13 | confidence_ = rhs.confidence_; 14 | } 15 | 16 | ExpressionInfo::~ExpressionInfo() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | ExpressionInfo& ExpressionInfo::operator = (const ExpressionInfo& rhs) { 21 | if (&rhs != this) { 22 | type_ = rhs.type_; 23 | confidence_ = rhs.confidence_; 24 | } 25 | 26 | return *this; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_data2d.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "pointing_data2d.h" 6 | 7 | PointingData2D::PointingData2D() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | PointingData2D::PointingData2D(const PointingData2D& rhs) { 12 | origin_ = rhs.origin_; 13 | direction_ = rhs.direction_; 14 | } 15 | 16 | PointingData2D::~PointingData2D() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | PointingData2D& PointingData2D::operator = (const PointingData2D& rhs) { 21 | if (&rhs != this) { 22 | origin_ = rhs.origin_; 23 | direction_ = rhs.direction_; 24 | } 25 | return *this; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_data3d.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "pointing_data3d.h" 6 | 7 | PointingData3D::PointingData3D() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | PointingData3D::PointingData3D(const PointingData3D& rhs) { 12 | origin_ = rhs.origin_; 13 | direction_ = rhs.direction_; 14 | } 15 | 16 | PointingData3D::~PointingData3D() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | PointingData3D& PointingData3D::operator = (const PointingData3D& rhs) { 21 | if (&rhs != this) { 22 | origin_ = rhs.origin_; 23 | direction_ = rhs.direction_; 24 | } 25 | return *this; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/slam/occupancy_tile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "occupancy_tile.h" 6 | 7 | OccupancyTile::OccupancyTile() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | OccupancyTile::OccupancyTile(const OccupancyTile& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in occupancy_tile.h 14 | } 15 | 16 | OccupancyTile::~OccupancyTile() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | OccupancyTile& OccupancyTile::operator = (const OccupancyTile& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | return *this; 25 | } 26 | -------------------------------------------------------------------------------- /src/slam/tracking_event.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "tracking_event.h" 6 | 7 | TrackingEvent::TrackingEvent() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | TrackingEvent::TrackingEvent(const TrackingEvent& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in tracking_event.h 14 | } 15 | 16 | TrackingEvent::~TrackingEvent() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | TrackingEvent& TrackingEvent::operator = (const TrackingEvent& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | return *this; 25 | } 26 | -------------------------------------------------------------------------------- /src/person-tracking/test/StableTest/README.md: -------------------------------------------------------------------------------- 1 | ## Prepare 2 | * Install gnuplot tool 3 | ``` 4 | sudo apt install gnuplot 5 | ``` 6 | 7 | ## Run RealSense sample test 8 | ``` 9 | node /path/to/realsense_samples/samples/pt_tutorial_1/javascript/main.js 10 | ``` 11 | 12 | ## To get cpu, gpu, memory usage record 13 | ``` 14 | Usage: sudo ./getUsageRecord.sh 15 | 16 | command name of running RealSense sample test 17 | 18 | sudo ./getUsageRecord.sh node 19 | ``` 20 | 21 | * You'll got message as below and input the test lasting time in second 22 | ``` 23 | Please input the test lasting time (seconds): 24 | (For example): 3710 25 | ``` 26 | * Script will start to record the resource and keep data in `*.dat` files 27 | 28 | ## draw the line chart 29 | 30 | ``` 31 | ./drawPng.pg > result.png 32 | ``` 33 | -------------------------------------------------------------------------------- /src/person-tracking/lying_pose_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "lying_pose_info.h" 6 | 7 | LyingPoseInfo::LyingPoseInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | LyingPoseInfo::LyingPoseInfo(const LyingPoseInfo& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in lying_pose_info.h 14 | } 15 | 16 | LyingPoseInfo::~LyingPoseInfo() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | LyingPoseInfo& LyingPoseInfo::operator = (const LyingPoseInfo& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | 25 | return *this; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/person-tracking/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-person", 3 | "version": "0.10.1", 4 | "description": "Node.js Person Tracking based on Intel® RealSense™ technology", 5 | "main": "index.js", 6 | "scripts": { 7 | "install": "node -e \"require('./common/scripts/build_utils.js').runNodeGyp();\"", 8 | "maketarball": "bash ./common/scripts/make_tarball.sh node-person", 9 | "test": "mocha" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/01org/node-realsense.git" 14 | }, 15 | "author": "Ting Shao ", 16 | "license": "MIT", 17 | "dependencies": { 18 | "bindings": "^1.2.1", 19 | "nan": "^2.4.0", 20 | "widl-nan": "^0.1.23" 21 | }, 22 | "devDependencies": { 23 | "spawn-npm-install": "^1.2.0", 24 | "tmp": "0.0.31" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/slam/depth_of_interest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "depth_of_interest.h" 6 | 7 | DepthOfInterest::DepthOfInterest() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | DepthOfInterest::DepthOfInterest(const DepthOfInterest& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in depth_of_interest.h 14 | } 15 | 16 | DepthOfInterest::~DepthOfInterest() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | DepthOfInterest& DepthOfInterest::operator = (const DepthOfInterest& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | return *this; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/person-tracking/face_landmark.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "face_landmark.h" 6 | 7 | FaceLandmark::FaceLandmark() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | FaceLandmark::FaceLandmark(const FaceLandmark& rhs) { 12 | imageCoordinate_ = rhs.imageCoordinate_; 13 | worldCoordinate_ = rhs.worldCoordinate_; 14 | } 15 | 16 | FaceLandmark::~FaceLandmark() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | FaceLandmark& FaceLandmark::operator = (const FaceLandmark& rhs) { 21 | if (&rhs != this) { 22 | imageCoordinate_ = rhs.imageCoordinate_; 23 | worldCoordinate_ = rhs.worldCoordinate_; 24 | } 25 | 26 | return *this; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/object-recognition/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-object", 3 | "version": "0.10.1", 4 | "description": "Node.js Object Recognition based on Intel® RealSense™ technology", 5 | "main": "index.js", 6 | "scripts": { 7 | "install": "node -e \"require('./common/scripts/build_utils.js').runNodeGyp();\"", 8 | "maketarball": "bash ./common/scripts/make_tarball.sh node-object", 9 | "test": "mocha" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/01org/node-realsense.git" 14 | }, 15 | "author": "Kenny Yuan ", 16 | "license": "MIT", 17 | "dependencies": { 18 | "bindings": "^1.2.1", 19 | "nan": "^2.4.0", 20 | "widl-nan": "^0.1.23" 21 | }, 22 | "devDependencies": { 23 | "spawn-npm-install": "^1.2.0", 24 | "tmp": "0.0.31" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/person-tracking/face_landmark_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "face_landmark_info.h" 6 | 7 | FaceLandmarkInfo::FaceLandmarkInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | FaceLandmarkInfo::FaceLandmarkInfo(const FaceLandmarkInfo& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in face_landmark_info.h 14 | } 15 | 16 | FaceLandmarkInfo::~FaceLandmarkInfo() { 17 | landmarks_.FreeArray(); 18 | } 19 | 20 | FaceLandmarkInfo& FaceLandmarkInfo::operator = (const FaceLandmarkInfo& rhs) { 21 | if (&rhs != this) { 22 | // TODO(widl-nan): copy members from rhs 23 | } 24 | 25 | return *this; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/librealsense/context_runner.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "context_runner.h" 6 | 7 | #include 8 | #include 9 | 10 | static std::unique_ptr g_context = nullptr; 11 | 12 | ContextRunner::ContextRunner() { 13 | } 14 | 15 | ContextRunner::~ContextRunner() { 16 | } 17 | 18 | int ContextRunner::GetDeviceCount() { 19 | return GetRSContext()->get_device_count(); 20 | } 21 | 22 | rs::device* ContextRunner::GetRSDevice(int index) { 23 | return GetRSContext()->get_device(index); 24 | } 25 | 26 | rs::context* ContextRunner::GetRSContext() { 27 | if (!g_context) { 28 | g_context.reset(new rs::context()); 29 | } 30 | return g_context.get(); 31 | } 32 | -------------------------------------------------------------------------------- /src/person-tracking/person_recognizer_data_with_status.cpp: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #include "person_recognizer_data_with_status.h" 4 | 5 | PersonRecognizerDataWithStatus::PersonRecognizerDataWithStatus() { 6 | // TODO(widl-nan): init your members 7 | } 8 | 9 | PersonRecognizerDataWithStatus::PersonRecognizerDataWithStatus( 10 | const PersonRecognizerDataWithStatus& rhs) { 11 | data_ = rhs.data_; 12 | status_ = rhs.status_; 13 | } 14 | 15 | PersonRecognizerDataWithStatus::~PersonRecognizerDataWithStatus() { 16 | // TODO(widl-nan): do cleanup if necessary 17 | } 18 | 19 | PersonRecognizerDataWithStatus& PersonRecognizerDataWithStatus::operator = ( 20 | const PersonRecognizerDataWithStatus& rhs) { 21 | if (&rhs != this) { 22 | data_ = rhs.data_; 23 | status_ = rhs.status_; 24 | } 25 | return *this; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/common/frame_data.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/frame_data.h" 6 | 7 | FrameData::FrameData() 8 | : has_fisheye_(false), 9 | has_color_(false), 10 | has_depth_(false), 11 | has_gyro_(false), 12 | has_accel_(false) { 13 | // TODO(widl-nan): init your members 14 | } 15 | 16 | FrameData::~FrameData() { 17 | // TODO(widl-nan): do cleanup if necessary 18 | } 19 | 20 | FrameData& FrameData::operator = (const FrameData& rhs) { 21 | if (&rhs != this) { 22 | set_fisheye(rhs.get_fisheye()); 23 | set_color(rhs.get_color()); 24 | set_depth(rhs.get_depth()); 25 | set_gyro(rhs.get_gyro()); 26 | set_accel(rhs.get_accel()); 27 | } 28 | return *this; 29 | } 30 | -------------------------------------------------------------------------------- /src/person-tracking/bounding_box2d_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "bounding_box2d_info.h" 6 | 7 | #include 8 | 9 | BoundingBox2DInfo::BoundingBox2DInfo() { 10 | // TODO(widl-nan): init your members 11 | } 12 | 13 | BoundingBox2DInfo::BoundingBox2DInfo(const BoundingBox2DInfo& rhs) { 14 | rect_ = rhs.rect_; 15 | confidence_ = rhs.confidence_; 16 | } 17 | 18 | BoundingBox2DInfo::~BoundingBox2DInfo() { 19 | // TODO(widl-nan): do cleanup if necessary 20 | } 21 | 22 | BoundingBox2DInfo& BoundingBox2DInfo::operator = ( 23 | const BoundingBox2DInfo& rhs) { 24 | if (&rhs != this) { 25 | rect_ = rhs.rect_; 26 | confidence_ = rhs.confidence_; 27 | } 28 | 29 | return *this; 30 | } 31 | -------------------------------------------------------------------------------- /src/object-recognition/tracking_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "tracking_info.h" 6 | 7 | TrackingInfo::TrackingInfo() { 8 | } 9 | 10 | TrackingInfo::TrackingInfo(const Rect2D& roi, const Point3D& object_center) { 11 | roi_ = roi; 12 | object_center_ = object_center; 13 | } 14 | 15 | TrackingInfo::TrackingInfo(const TrackingInfo& rhs) { 16 | CopyFrom(rhs); 17 | } 18 | 19 | TrackingInfo::~TrackingInfo() { 20 | } 21 | 22 | TrackingInfo& TrackingInfo::operator = (const TrackingInfo& rhs) { 23 | CopyFrom(rhs); 24 | return *this; 25 | } 26 | 27 | void TrackingInfo::CopyFrom(const TrackingInfo& rhs) { 28 | if (this != &rhs) { 29 | roi_ = rhs.roi_; 30 | object_center_ = rhs.object_center_; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/person-tracking/person_face_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "person_face_info.h" 6 | 7 | PersonFaceInfo::PersonFaceInfo() 8 | : has_landmark_(false), 9 | has_head_pose_(false), 10 | has_expression_(false) { 11 | } 12 | 13 | PersonFaceInfo::PersonFaceInfo(const PersonFaceInfo& rhs) { 14 | // TODO(widl-nan): copy from rhs if you want this behavior 15 | // Or mark ctor = delete in person_face_info.h 16 | } 17 | 18 | PersonFaceInfo::~PersonFaceInfo() { 19 | // TODO(widl-nan): do cleanup if necessary 20 | } 21 | 22 | PersonFaceInfo& PersonFaceInfo::operator = (const PersonFaceInfo& rhs) { 23 | if (&rhs != this) { 24 | // TODO(widl-nan): copy members from rhs 25 | } 26 | return *this; 27 | } 28 | -------------------------------------------------------------------------------- /src/common/geometry/geometry_change_notify.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _GEOMETRY_CHANGE_NOTIFY_H_ 6 | #define _GEOMETRY_CHANGE_NOTIFY_H_ 7 | 8 | typedef void GeometryChangeCallback(void*); 9 | 10 | class GeometryChangeNotifyBase { 11 | public: 12 | GeometryChangeNotifyBase() { 13 | callback_ = nullptr; 14 | data_ = nullptr; 15 | } 16 | 17 | void RegisterChangeCallback(GeometryChangeCallback* callback, void* data) { 18 | callback_ = callback; 19 | data_ = data; 20 | } 21 | 22 | void NotifyChange() { 23 | if (callback_) { 24 | callback_(data_); 25 | } 26 | } 27 | 28 | private: 29 | GeometryChangeCallback* callback_; 30 | void* data_; 31 | }; 32 | 33 | #endif // _GEOMETRY_CHANGE_NOTIFY_H_ 34 | -------------------------------------------------------------------------------- /src/common/scripts/make_tarball.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | # This script is to make a tarball of current npm directory. 8 | # 9 | # npm pack is not suitable because it will bundled all files 10 | 11 | module_name=$1 12 | if [ ${module_name} = "" ]; then 13 | echo "Moudle name is not specified." 14 | exit module_name 15 | fi 16 | 17 | version=$(node -e "console.log(require('./package.json').version);") 18 | 19 | rm ${module_name}-${version}.tar ${module_name}-${version}.tar.gz 20 | 21 | tar cf ${module_name}-${version}.tar \ 22 | --exclude-vcs --exclude=node_modules \ 23 | --exclude=gen --exclude=build \ 24 | --exclude=common/tests/data \ 25 | --dereference . 26 | 27 | gzip ${module_name}-${version}.tar 28 | -------------------------------------------------------------------------------- /src/person-tracking/person_tracking_result.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "person_tracking_result.h" 6 | 7 | PersonTrackingResult::PersonTrackingResult() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | PersonTrackingResult::PersonTrackingResult(const PersonTrackingResult& rhs) { 12 | // TODO(widl-nan): copy from rhs if you want this behavior 13 | // Or mark ctor = delete in person_tracking_result.h 14 | } 15 | 16 | PersonTrackingResult::~PersonTrackingResult() { 17 | persons_.FreeArray(); 18 | } 19 | 20 | PersonTrackingResult& PersonTrackingResult::operator = ( 21 | const PersonTrackingResult& rhs) { 22 | if (&rhs != this) { 23 | // TODO(widl-nan): copy members from rhs 24 | } 25 | 26 | return *this; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /tools/install_realsense_pkgs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | # This script is to install RealSense packages. 8 | # 9 | # TODOs: 10 | # * Internal link suppose to be removed when public available. 11 | # 12 | 13 | if [ ! $(id -u) = "0" ]; then 14 | echo "You need run this script with root or sudo" 15 | exit 1 16 | fi 17 | 18 | sudo apt-key adv --keyserver keys.gnupg.net --recv-key D6FB2970 19 | echo 'deb http://realsense-alm-public.s3.amazonaws.com/apt-repo xenial main' | sudo tee /etc/apt/sources.list.d/realsense-public.list 20 | apt-get update 21 | apt-get install -y --allow-unauthenticated librealsense-all-dev=0.0.1~rc0-0ubuntu2~16.gbp3bd28d 22 | # TODO: Remove boost dependency in futhure 23 | apt-get install -y libboost1.58-dev 24 | -------------------------------------------------------------------------------- /src/common/scripts/build_utils.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | function _runNodeGyp() { 8 | return new Promise((resolve, reject) => { 9 | const buildProc = require('child_process').spawn( 10 | 'node-gyp', 11 | ['rebuild', '-j', require('os').cpus().length], 12 | {cwd: '.', stdio: 'inherit'}); 13 | 14 | buildProc.on('close', (code) => { 15 | if (code !== 0) process.exit(code); 16 | 17 | resolve(code); 18 | }); 19 | 20 | buildProc.stdout.on('data', (data) => { 21 | console.log(`${data}`); 22 | }); 23 | buildProc.stderr.on('data', (data) => { 24 | console.log(`${data}`); 25 | }); 26 | }); 27 | } 28 | 29 | module.exports = { 30 | runNodeGyp: _runNodeGyp, 31 | }; 32 | -------------------------------------------------------------------------------- /src/librealsense/context.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CONTEXT_H_ 6 | #define _CONTEXT_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | class ContextRunner; 14 | 15 | class Context { 16 | public: 17 | Context(); 18 | 19 | ~Context(); 20 | 21 | Context& operator = (const Context& rhs); 22 | 23 | public: 24 | v8::Handle getDeviceCount(); 25 | 26 | v8::Handle getDevice(const int32_t& index); 27 | 28 | void SetJavaScriptThis(v8::Local obj) { 29 | // Ignore this if you don't need it 30 | // Typical usage: emit an event on `obj` 31 | } 32 | 33 | private: 34 | std::unique_ptr context_runner_; 35 | }; 36 | 37 | #endif // _CONTEXT_H_ 38 | -------------------------------------------------------------------------------- /src/common/geometry/scripts/build.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | const spawn = require('child_process').spawn; 6 | var w = require('widl-nan'); 7 | var g = w.generator; 8 | 9 | function build() { 10 | return new Promise((resolve, reject) => { 11 | var buildProc = spawn('node-gyp', ['rebuild'], {cwd: '.'}); 12 | 13 | buildProc.on('exit', function(code) { 14 | if (code !== 0) { 15 | process.exit(code); 16 | } 17 | 18 | resolve(code); 19 | }); 20 | }); 21 | } 22 | 23 | Promise.all([g.addFile('../../idl/common/geometry.widl')]).then(function() { 24 | g.compile(); 25 | g.writeToDir('gen'); 26 | build().then(function(code) { 27 | console.log('Success'); 28 | }); 29 | }).catch(e => { 30 | console.log(e); 31 | }); 32 | -------------------------------------------------------------------------------- /src/librealsense/test/Device/test-getName.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('node_librealsense'); 8 | 9 | describe('Test Device interfaces', function() { 10 | let context = new addon.Context; 11 | let device = null; 12 | 13 | before(function(done) { 14 | context.getDevice(0).then((availableDevice) => { 15 | device = availableDevice; 16 | done(); 17 | }); 18 | }); 19 | 20 | it('Negative - Call getName with 1 option', function() { 21 | return new Promise((resolve, reject) => { 22 | device.getName('dummy').then((name) => { 23 | reject('Should get reject but got resolved promise'); 24 | }).catch((e) => { 25 | resolve(); 26 | }); 27 | }); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /src/person-tracking/person_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "person_info.h" 6 | 7 | PersonInfo::PersonInfo() 8 | : has_skeleton_(false), 9 | has_track_(false), 10 | has_gesture_(false), 11 | has_face_(false), 12 | has_pose_(false) { 13 | // TODO(widl-nan): init your members 14 | } 15 | 16 | PersonInfo::PersonInfo(const PersonInfo& rhs) { 17 | // TODO(widl-nan): copy from rhs if you want this behavior 18 | // Or mark ctor = delete in person_info.h 19 | } 20 | 21 | PersonInfo::~PersonInfo() { 22 | // TODO(widl-nan): do cleanup if necessary 23 | } 24 | 25 | PersonInfo& PersonInfo::operator = (const PersonInfo& rhs) { 26 | if (&rhs != this) { 27 | // TODO(widl-nan): copy members from rhs 28 | } 29 | return *this; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point2D/test-point2d-getCoords.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point2D API Test', function() { 11 | describe('getCoords Test', function() { 12 | it.skip('no parameter, result type should be array', function() { 13 | let obj = new pt.Point2D(1.0, 2.0); 14 | let coords = obj.getCoords(); 15 | assert.ok(Array.isArray(coords)); 16 | }); 17 | 18 | it.skip('parameter is one string', function() { 19 | let obj = new pt.Point2D(1.0, 2.0); 20 | let coords = obj.getCoords('illegal'); 21 | assert.ok(Array.isArray(coords)); 22 | }); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/librealsense/test/Device/test-getSerial.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('node_librealsense'); 8 | 9 | describe('Test Device interfaces', function() { 10 | let context = new addon.Context; 11 | let device = null; 12 | 13 | before(function(done) { 14 | context.getDevice(0).then((availableDevice) => { 15 | device = availableDevice; 16 | done(); 17 | }); 18 | }); 19 | 20 | it('Negative - Call getSerial with 1 option', function() { 21 | return new Promise((resolve, reject) => { 22 | device.getSerial('dummy').then((name) => { 23 | reject('Should get reject but got resolved promise'); 24 | }).catch((e) => { 25 | resolve(); 26 | }); 27 | }); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point3D/test-point3d-getCoords.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point3D API Test', function() { 11 | describe('getCoords Test', function() { 12 | it.skip('no parameter, result type should be array', function() { 13 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 14 | let coords = obj.getCoords(); 15 | assert.ok(Array.isArray(coords)); 16 | }); 17 | 18 | it.skip('parameter is one string', function() { 19 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 20 | let coords = obj.getCoords('illegal'); 21 | assert.ok(Array.isArray(coords)); 22 | }); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/slam/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "node-slam", 3 | "version": "0.10.1", 4 | "description": "Node.js SLAM based on Intel® RealSense™ technology", 5 | "main": "index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/01org/node-realsense.git" 9 | }, 10 | "scripts": { 11 | "install": "node -e \"require('./common/scripts/build_utils.js').runNodeGyp();\"", 12 | "maketarball": "bash ./common/scripts/make_tarball.sh node-slam", 13 | "test": "mocha" 14 | }, 15 | "contributors": [ 16 | "Donna Wu (https://github.com/DonnaWuDongxia)", 17 | "Lisha Guo (https://github.com/lisa0314)" 18 | ], 19 | "license": "MIT", 20 | "dependencies": { 21 | "bindings": "^1.2.1", 22 | "nan": "^2.4.0", 23 | "widl-nan": "^0.1.23" 24 | }, 25 | "devDependencies": { 26 | "spawn-npm-install": "^1.2.0", 27 | "tmp": "0.0.31" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/common/geometry/point2d.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/geometry/point2d.h" 6 | 7 | Point2D::Point2D() { 8 | } 9 | 10 | Point2D::Point2D(const double& x, const double& y) : Point2DBase(x, y) { 11 | } 12 | 13 | Point2D::Point2D(const ArrayHelper& coords) { 14 | setCoords(coords); 15 | } 16 | 17 | Point2D::Point2D(const Point2D& rhs) : Point2DBase(rhs) { 18 | } 19 | 20 | void Point2D::setCoords(const ArrayHelper& coords) { 21 | if (coords.Length() > 0) { 22 | x_ = coords.GetFloat(0); 23 | } 24 | 25 | if (coords.Length() > 1) { 26 | y_ = coords.GetFloat(1); 27 | } 28 | 29 | NotifyChange(); 30 | } 31 | 32 | ArrayHelper Point2D::getCoords() { 33 | ArrayHelper helper; 34 | helper.SetT(0, x_); 35 | helper.SetT(1, y_); 36 | return helper; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/person-tracking/gesture_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "gesture_info.h" 6 | 7 | GestureInfo::GestureInfo() 8 | : isPointing_(false), 9 | has_pointing_info_(false) { 10 | // TODO(widl-nan): init your members 11 | } 12 | 13 | GestureInfo::GestureInfo(const GestureInfo& rhs) { 14 | // TODO(widl-nan): copy from rhs if you want this behavior 15 | // Or mark ctor = delete in gesture_info.h 16 | } 17 | 18 | GestureInfo::~GestureInfo() { 19 | // TODO(widl-nan): do cleanup if necessary 20 | } 21 | 22 | GestureInfo& GestureInfo::operator = (const GestureInfo& rhs) { 23 | if (&rhs != this) { 24 | isPointing_ = rhs.isPointing_; 25 | has_pointing_info_ = rhs.has_pointing_info_; 26 | pointingInfo_ = rhs.pointingInfo_; 27 | } 28 | 29 | return *this; 30 | } 31 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point2D/test-point2d-setCoords.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point2D API Test', function() { 11 | describe('setCoords Test', function() { 12 | it.skip('parameters are two numbers', function() { 13 | let obj = new pt.Point2D(1.0, 2.0); 14 | obj.setCoords(3.0, 4.0); 15 | assert.equal(obj.x, 3.0); 16 | assert.equal(obj.y, 4.0); 17 | }); 18 | 19 | it.skip('parameter is one sequence', function() { 20 | let obj = new pt.Point2D(1.0, 2.0); 21 | obj.setCoords([3.0, 4.0]); 22 | assert.equal(obj.x, 3.0); 23 | assert.equal(obj.y, 4.0); 24 | }); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/oic-post: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | if test "x$2x" == "xx"; then 26 | API_SERVER_FILE="post-light-values.json" 27 | else 28 | API_SERVER_FILE=$2 29 | fi 30 | 31 | 32 | echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 33 | 34 | curl -X POST --noproxy "*" -w "\nHTTP: %{http_code}\n" -H "Content-Type: application/json" -T ${API_SERVER_FILE} ${CERT} \ 35 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 36 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/oic-post: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | if test "x$2x" == "xx"; then 26 | API_SERVER_FILE="post-light-values.json" 27 | else 28 | API_SERVER_FILE=$2 29 | fi 30 | 31 | 32 | echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 33 | 34 | curl -X POST --noproxy "*" -w "\nHTTP: %{http_code}\n" -H "Content-Type: application/json" -T ${API_SERVER_FILE} ${CERT} \ 35 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 36 | -------------------------------------------------------------------------------- /src/librealsense/test/Device/test-getFirmwareVersion.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('bindings')('node_librealsense'); 8 | 9 | describe('Test Device interfaces', function() { 10 | let context = new addon.Context; 11 | let device = null; 12 | 13 | before(function(done) { 14 | context.getDevice(0).then((availableDevice) => { 15 | device = availableDevice; 16 | done(); 17 | }); 18 | }); 19 | 20 | it('Negative - Call getFirmwareVersion with 1 option', function() { 21 | return new Promise((resolve, reject) => { 22 | device.getFirmwareVersion('dummy').then((name) => { 23 | reject('Should get reject but got resolved promise'); 24 | }).catch((e) => { 25 | resolve(); 26 | }); 27 | }); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/oic-put: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | if test "x$2x" == "xx"; then 26 | API_SERVER_FILE="put-light-values.json" 27 | else 28 | API_SERVER_FILE=$2 29 | fi 30 | 31 | 32 | echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 33 | 34 | curl -X PUT --noproxy "*" -w "\nHTTP: %{http_code}\n" -H "Content-Type: application/json" -T ${API_SERVER_FILE} ${CERT} \ 35 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 36 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/oic-put: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if test "x${API_SERVER_PORT}x" == "xx"; then 4 | API_SERVER_PORT=8000 5 | fi 6 | 7 | if test "x${API_SERVER_HOST}x" == "xx"; then 8 | API_SERVER_HOST=localhost 9 | fi 10 | 11 | if test "x${API_SERVER_HTTPS}x" == "xx"; then 12 | API_SERVER_PROTO=http 13 | CERT="" 14 | else 15 | API_SERVER_PROTO=https 16 | CERT="--cacert ../config/certificate.pem " 17 | fi 18 | 19 | if test "x$1x" == "xx"; then 20 | API_SERVER_URL="/a/light" 21 | else 22 | API_SERVER_URL=$1 23 | fi 24 | 25 | if test "x$2x" == "xx"; then 26 | API_SERVER_FILE="put-light-values.json" 27 | else 28 | API_SERVER_FILE=$2 29 | fi 30 | 31 | 32 | echo $API_SERVER_HOST":"$API_SERVER_PORT $API_SERVER_URL 33 | 34 | curl -X PUT --noproxy "*" -w "\nHTTP: %{http_code}\n" -H "Content-Type: application/json" -T ${API_SERVER_FILE} ${CERT} \ 35 | ${API_SERVER_PROTO}://${API_SERVER_HOST}:${API_SERVER_PORT}/api/oic${API_SERVER_URL} 36 | -------------------------------------------------------------------------------- /src/librealsense/rs_payload.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _RS_PAYLOAD_H_ 6 | #define _RS_PAYLOAD_H_ 7 | 8 | #include 9 | 10 | #include "common/task/async_task.h" 11 | 12 | class AsyncTaskPayloadWithErrorMsg : public AsyncTaskPayload { 13 | public: 14 | void SetErrorMsg(const std::string& err) { err_ = err; } 15 | std::string ErrorMsg() { return err_; } 16 | 17 | private: 18 | std::string err_; 19 | }; 20 | 21 | template 22 | class RSPayload : public AsyncTaskPayloadWithErrorMsg { 23 | public: 24 | T GetPayloadData() { return data_; } 25 | void SetPayloadData(const T& data) { 26 | data_ = data; 27 | } 28 | 29 | private: 30 | T data_; 31 | }; 32 | 33 | template<> 34 | class RSPayload : public AsyncTaskPayloadWithErrorMsg { 35 | }; 36 | 37 | #endif // _RS_PAYLOAD_H_ 38 | -------------------------------------------------------------------------------- /src/person-tracking/expression_info_collection.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "expression_info_collection.h" 6 | 7 | ExpressionInfoCollection::ExpressionInfoCollection() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | ExpressionInfoCollection::ExpressionInfoCollection( 12 | const ExpressionInfoCollection& rhs) { 13 | // TODO(widl-nan): copy from rhs if you want this behavior 14 | // Or mark ctor = delete in expression_info_collection.h 15 | } 16 | 17 | ExpressionInfoCollection::~ExpressionInfoCollection() { 18 | infoCollection_.FreeArray(); 19 | } 20 | 21 | ExpressionInfoCollection& ExpressionInfoCollection::operator = ( 22 | const ExpressionInfoCollection& rhs) { 23 | if (&rhs != this) { 24 | // TODO(widl-nan): copy members from rhs 25 | } 26 | 27 | return *this; 28 | } 29 | 30 | -------------------------------------------------------------------------------- /src/object-recognition/recognition_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "recognition_info.h" 6 | 7 | RecognitionInfo::RecognitionInfo() { 8 | label_ = ""; 9 | probability_ = 0; 10 | } 11 | 12 | RecognitionInfo::RecognitionInfo(const std::string& label, double probability) { 13 | label_ = label; 14 | probability_ = probability; 15 | } 16 | 17 | RecognitionInfo::RecognitionInfo(const RecognitionInfo& rhs) { 18 | CopyFrom(rhs); 19 | } 20 | 21 | RecognitionInfo::~RecognitionInfo() { 22 | } 23 | 24 | RecognitionInfo& RecognitionInfo::operator = (const RecognitionInfo& rhs) { 25 | CopyFrom(rhs); 26 | return *this; 27 | } 28 | 29 | void RecognitionInfo::CopyFrom(const RecognitionInfo& rhs) { 30 | if (&rhs != this) { 31 | label_ = rhs.label_; 32 | probability_ = rhs.probability_; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/slam/instance_creator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _INSTANCE_CREATOR_H_ 6 | #define _INSTANCE_CREATOR_H_ 7 | 8 | #include "gen/promise-helper.h" 9 | #include "gen/camera_options.h" 10 | #include "gen/instance_options.h" 11 | 12 | class InstanceCreator : public PromiseWorkQueueHelper { 13 | public: 14 | InstanceCreator(const DictionaryInstanceOptions& instance_options, 15 | const DictionaryCameraOptions& camera_options); 16 | 17 | ~InstanceCreator(); 18 | 19 | virtual bool DoWork(); 20 | virtual void OnWorkDone(); 21 | 22 | virtual v8::Local GetResolved(); 23 | virtual v8::Local GetRejected(); 24 | 25 | static void DestroyInstance(); 26 | 27 | private: 28 | class InstanceCreatorD* d_; 29 | }; 30 | 31 | NAN_METHOD(CreateSlamInstance); 32 | 33 | #endif // _INSTANCE_CREATOR_H_ 34 | -------------------------------------------------------------------------------- /src/common/camera-options/camera_options_default.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _CAMERA_OPTIONS_DEFAULT_H_ 6 | #define _CAMERA_OPTIONS_DEFAULT_H_ 7 | 8 | #include "camera_options_type.h" 9 | 10 | // 11 | // I have to admit this is poor naming... but at least it's straightforward 12 | // Let me know good replacements, thanks. -- Kenny 13 | // 14 | class CameraOptionsDefault { 15 | CameraOptionsDefault(const CameraOptionsDefault&) = delete; 16 | CameraOptionsDefault& operator = (const CameraOptionsDefault&) = delete; 17 | 18 | public: 19 | CameraOptionsDefault() {} 20 | 21 | // Actually nobody will delete a pointer using this interface 22 | virtual ~CameraOptionsDefault() {} 23 | 24 | // Restore default 25 | virtual void ResetDefault(CameraOptionsType* target) const = 0; 26 | }; 27 | 28 | #endif // _CAMERA_OPTIONS_DEFAULT_H_ 29 | -------------------------------------------------------------------------------- /src/object-recognition/examples/create-and-exit.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | 9 | addon.createObjectRecognizer().then((objectRecognizer) => { 10 | objectRecognizer.setCameraOptions({ 11 | color: { 12 | width: 640, 13 | height: 480, 14 | frameRate: 30, 15 | isEnabled: true, 16 | }, 17 | depth: { 18 | width: 320, 19 | height: 240, 20 | frameRate: 30, 21 | isEnabled: true, 22 | }, 23 | }).then(() => { 24 | return objectRecognizer.start(); 25 | }).then(() => { 26 | console.log("So far so good"); 27 | return objectRecognizer.getRecognizableObjectNames(); 28 | }).then((names) => { 29 | console.log(names); 30 | console.log(objectRecognizer); 31 | }).catch((e) => { 32 | console.log(e); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /tools/Dockerfile.template: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | COPY ./install_realsense_pkgs.sh /root 3 | ENV docker_user="" 4 | ENV git_user_name="" 5 | ENV git_user_email="" 6 | 7 | RUN apt-get update \ 8 | && apt-get install -y udev sudo \ 9 | && apt-get install -y nodejs npm git \ 10 | && apt-get install -y netcat-openbsd expect \ 11 | && ln -s /usr/bin/nodejs /usr/bin/node \ 12 | && adduser --disabled-password --gecos "" ${docker_user} \ 13 | && adduser ${docker_user} sudo \ 14 | && echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopass \ 15 | && echo "Defaults env_keep += \"http_proxy https_proxy no_proxy\"" > /etc/sudoers.d/env_keep \ 16 | && sudo -H -u ${docker_user} echo "[user]" > /home/${docker_user}/.gitconfig \ 17 | && sudo -H -u ${docker_user} echo "name=${git_user_name}" >> /home/${docker_user}/.gitconfig \ 18 | && sudo -H -u ${docker_user} echo "email=${git_user_email}" >> /home/${docker_user}/.gitconfig \ 19 | && bash /root/install_realsense_pkgs.sh 20 | -------------------------------------------------------------------------------- /src/person-tracking/worker/utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _WORKER_UTILS_H 6 | #define _WORKER_UTILS_H 7 | 8 | #include 9 | 10 | #ifdef DEBUG 11 | extern void DebugInfoMessage(); 12 | extern void DebugErrorMessage(); 13 | template 14 | void DebugInfoMessage(T value, Rest... rest) { 15 | std::cout << value; 16 | DebugInfoMessage(rest...); 17 | } 18 | 19 | template 20 | void DebugErrorMessage(T value, Rest... rest) { 21 | std::cerr << value; 22 | DebugErrorMessage(rest...); 23 | } 24 | 25 | #define DEBUG_INFO(...) \ 26 | std::cout << "Info: ";\ 27 | DebugInfoMessage(__VA_ARGS__); 28 | 29 | #define DEBUG_ERROR(...) \ 30 | std::cerr << "Error: ";\ 31 | DebugErrorMessage(__VA_ARGS__); 32 | 33 | #else 34 | #define DEBUG_INFO(...) 35 | #define DEBUG_ERROR(...) 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/object-recognition/instance_creator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _INSTANCE_CREATOR_H_ 6 | #define _INSTANCE_CREATOR_H_ 7 | 8 | #include "gen/promise-helper.h" 9 | #include "gen/camera_options.h" 10 | #include "gen/object_recognition_options.h" 11 | 12 | class InstanceCreator : public PromiseWorkQueueHelper { 13 | public: 14 | InstanceCreator(const DictionaryObjectRecognitionOptions& instance_options, 15 | const DictionaryCameraOptions& camera_options); 16 | 17 | ~InstanceCreator(); 18 | 19 | virtual bool DoWork(); 20 | virtual void OnWorkDone(); 21 | 22 | virtual v8::Local GetResolved(); 23 | virtual v8::Local GetRejected(); 24 | 25 | static void DestroyInstance(); 26 | 27 | private: 28 | class InstanceCreatorD* d_; 29 | }; 30 | 31 | NAN_METHOD(CreateObjectRecognizerInstance); 32 | 33 | #endif // _INSTANCE_CREATOR_H_ 34 | -------------------------------------------------------------------------------- /src/slam/scripts/build.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | const spawn = require('child_process').spawn; 6 | const w = require('widl-nan'); 7 | const g = w.generator; 8 | 9 | function build() { 10 | return new Promise((resolve, reject) => { 11 | const buildProc = spawn('node-gyp', ['rebuild'], {cwd: '.'}); 12 | 13 | buildProc.on('exit', function(code) { 14 | if (code !== 0) { 15 | process.exit(code); 16 | } 17 | 18 | resolve(code); 19 | }); 20 | }); 21 | } 22 | 23 | Promise.all([ 24 | g.addFile('idl/common/realsense-camera.widl'), 25 | g.addFile('idl/common/geometry.widl'), 26 | g.addFile('idl/slam/slam.widl'), 27 | ]).then(function() { 28 | g.compile(); 29 | g.writeToDir('gen'); 30 | build().then(function(code) { 31 | console.log('Success'); 32 | }); 33 | }).catch((e) => { 34 | console.log(e); 35 | }); 36 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "pointing_info.h" 6 | 7 | #include 8 | 9 | PointingInfo::PointingInfo() { 10 | // TODO(widl-nan): init your members 11 | } 12 | 13 | PointingInfo::PointingInfo(const PointingInfo& rhs) { 14 | // TODO(widl-nan): copy from rhs if you want this behavior 15 | // Or mark ctor = delete in pointing_info.h 16 | } 17 | 18 | PointingInfo::~PointingInfo() { 19 | // TODO(widl-nan): do cleanup if necessary 20 | } 21 | 22 | PointingInfo& PointingInfo::operator = (const PointingInfo& rhs) { 23 | if (&rhs != this) { 24 | // TODO(widl-nan): copy members from rhs 25 | worldPointingData_ = rhs.worldPointingData_; 26 | colorPointingData_ = rhs.colorPointingData_; 27 | confidence_ = rhs.confidence_; 28 | gestureStartTimeStamp_ = rhs.gestureStartTimeStamp_; 29 | } 30 | 31 | return *this; 32 | } 33 | -------------------------------------------------------------------------------- /src/common/geometry/point3d.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/geometry/point3d.h" 6 | 7 | Point3D::Point3D() { 8 | } 9 | 10 | Point3D::Point3D(const double& x, const double& y, const double& z) 11 | : Point3DBase(x, y, z) { 12 | } 13 | 14 | Point3D::Point3D(const ArrayHelper& coords) { 15 | setCoords(coords); 16 | } 17 | 18 | Point3D::Point3D(const Point3D& rhs) : Point3DBase(rhs) { 19 | } 20 | 21 | void Point3D::setCoords(const ArrayHelper& coords) { 22 | if (coords.Length() > 0) { 23 | x_ = coords.GetFloat(0); 24 | } 25 | 26 | if (coords.Length() > 1) { 27 | y_ = coords.GetFloat(1); 28 | } 29 | 30 | if (coords.Length() > 2) { 31 | z_ = coords.GetFloat(2); 32 | } 33 | } 34 | 35 | ArrayHelper Point3D::getCoords() { 36 | ArrayHelper helper; 37 | helper.SetT(0, x_); 38 | helper.SetT(1, y_); 39 | helper.SetT(2, z_); 40 | return helper; 41 | } 42 | -------------------------------------------------------------------------------- /src/slam/scripts/generateAndBuild.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | const spawn = require('child_process').spawn; 6 | const w = require('widl-nan'); 7 | const g = w.generator; 8 | 9 | function build() { 10 | return new Promise((resolve, reject) => { 11 | const buildProc = spawn('node-gyp', ['rebuild'], {cwd: '.'}); 12 | 13 | buildProc.on('exit', function(code) { 14 | if (code !== 0) { 15 | process.exit(code); 16 | } 17 | 18 | resolve(code); 19 | }); 20 | }); 21 | } 22 | 23 | Promise.all([ 24 | g.addFile('idl/common/realsense-camera.widl'), 25 | g.addFile('idl/common/geometry.widl'), 26 | g.addFile('idl/slam/slam.widl'), 27 | ]).then(function() { 28 | g.compile(); 29 | g.writeToDir('gen'); 30 | build().then(function(code) { 31 | console.log('Success'); 32 | }); 33 | }).catch((e) => { 34 | console.log(e); 35 | }); 36 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point3D/test-point3d-setCoords.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point3D API Test', function() { 11 | describe('setCoords Test', function() { 12 | it.skip('parameters are three numbers', function() { 13 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 14 | obj.setCoords(3.0, 4.0, 5.0); 15 | assert.equal(obj.x, 3.0); 16 | assert.equal(obj.y, 4.0); 17 | assert.equal(obj.z, 5.0); 18 | }); 19 | 20 | it.skip('parameter is one sequence', function() { 21 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 22 | obj.setCoords([3.0, 4.0, 5.0]); 23 | assert.equal(obj.x, 3.0); 24 | assert.equal(obj.y, 4.0); 25 | assert.equal(obj.z, 5.0); 26 | }); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo1/test/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Environment Variables 3 | 4 | * `API_SERVER_HOST` - Hostname/address where API server is running 5 | (default: localhost) 6 | * `API_SERVER_PORT` - Port where API server is running (default: 8000) 7 | * `API_SERVER_HTTPS` - To use https instead of http (default: http) 8 | 9 | ## Examples 10 | 11 | ### oic-get 12 | 13 | ```sh 14 | # Resource discovery (/oic/res) 15 | ./oic-get "/res" 16 | 17 | # Device discovery discovery (/oic/d) 18 | ./oic-get "/d" 19 | 20 | # Platform discovery (/oic/p) 21 | ./oic-get "/p" 22 | 23 | # Resource get (/a/light?di=) 24 | ./oic-get "/a/light?di=" 25 | 26 | # Resource get with query filter (/a/light?di= with power less than 50) 27 | ./oic-get "/a/light?di=?di=&power<50" 28 | 29 | # Resource observe (/a/light?di=&obs=1) 30 | ./oic-get "/a/light?di=&obs=1" 31 | ``` 32 | 33 | ### oic-post 34 | 35 | ```sh 36 | # Resource post (/a/light?di= from a file: post-light-values.txt) 37 | ./oic-post "/a/light?di=" 38 | ``` 39 | -------------------------------------------------------------------------------- /samples/ocf-realsense/demo2/test/README.md: -------------------------------------------------------------------------------- 1 | 2 | ## Environment Variables 3 | 4 | * `API_SERVER_HOST` - Hostname/address where API server is running 5 | (default: localhost) 6 | * `API_SERVER_PORT` - Port where API server is running (default: 8000) 7 | * `API_SERVER_HTTPS` - To use https instead of http (default: http) 8 | 9 | ## Examples 10 | 11 | ### oic-get 12 | 13 | ```sh 14 | # Resource discovery (/oic/res) 15 | ./oic-get "/res" 16 | 17 | # Device discovery discovery (/oic/d) 18 | ./oic-get "/d" 19 | 20 | # Platform discovery (/oic/p) 21 | ./oic-get "/p" 22 | 23 | # Resource get (/a/light?di=) 24 | ./oic-get "/a/light?di=" 25 | 26 | # Resource get with query filter (/a/light?di= with power less than 50) 27 | ./oic-get "/a/light?di=?di=&power<50" 28 | 29 | # Resource observe (/a/light?di=&obs=1) 30 | ./oic-get "/a/light?di=&obs=1" 31 | ``` 32 | 33 | ### oic-post 34 | 35 | ```sh 36 | # Resource post (/a/light?di= from a file: post-light-values.txt) 37 | ./oic-post "/a/light?di=" 38 | ``` 39 | -------------------------------------------------------------------------------- /src/common/motion_sample.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/motion_sample.h" 6 | 7 | MotionSample::MotionSample() : timestamp_(0), frame_number_(0) { 8 | ZerofillArray(data_store_, DATA_SIZE); 9 | Setup(); 10 | } 11 | 12 | MotionSample::MotionSample(const MotionSample& rhs) { 13 | CopyFrom(rhs); 14 | } 15 | 16 | MotionSample::~MotionSample() { 17 | } 18 | 19 | MotionSample& MotionSample::operator = (const MotionSample& rhs) { 20 | CopyFrom(rhs); 21 | return *this; 22 | } 23 | 24 | void MotionSample::Setup() { 25 | SetupTypedArrayHelper(&data_, 26 | data_store_, 27 | DATA_SIZE); 28 | } 29 | 30 | void MotionSample::CopyFrom(const MotionSample& rhs) { 31 | if (this != &rhs) { 32 | frame_number_ = rhs.frame_number_; 33 | timestamp_ = rhs.timestamp_; 34 | Setup(); 35 | DeepCopyFromTypedArrayHelper(rhs.data_, 36 | data_store_, DATA_SIZE); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/person-tracking/mask_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "mask_info.h" 6 | 7 | #include 8 | 9 | MaskInfo::MaskInfo() 10 | : width_(0), 11 | height_(0), 12 | timestamp_(0), 13 | maskData_({0}) { 14 | // TODO(widl-nan): init your members 15 | } 16 | 17 | MaskInfo::MaskInfo(const MaskInfo& rhs) { 18 | // TODO(widl-nan): copy from rhs if you want this behavior 19 | // Or mark ctor = delete in mask_info.h 20 | } 21 | 22 | MaskInfo::~MaskInfo() { 23 | if (maskData_.data) 24 | free(maskData_.data); 25 | } 26 | 27 | MaskInfo& MaskInfo::operator = (const MaskInfo& rhs) { 28 | if (&rhs != this) { 29 | width_ = rhs.width_; 30 | height_ = rhs.height_; 31 | maskData_.size = rhs.maskData_.size; 32 | maskData_.data = static_cast(malloc(maskData_.size)); 33 | memcpy(maskData_.data, rhs.maskData_.data, maskData_.size); 34 | } 35 | 36 | return *this; 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/common/geometry/point3d.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _COMMON_GEOMETRY_POINT3D_H_ 6 | #define _COMMON_GEOMETRY_POINT3D_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | 16 | #include "common/geometry/point_base.h" 17 | 18 | class Point3D : public Point3DBase { 19 | public: 20 | Point3D(); 21 | 22 | explicit Point3D(const double& x, const double& y, const double& z); 23 | 24 | explicit Point3D(const ArrayHelper& coords); 25 | 26 | Point3D(const Point3D& rhs); 27 | 28 | public: 29 | void setCoords(const ArrayHelper& coords); 30 | using Point3DBase::setCoords; 31 | 32 | ArrayHelper getCoords(); 33 | 34 | void SetJavaScriptThis(v8::Local obj) { 35 | // Ignore this if you don't need it 36 | // Typical usage: emit an event on `obj` 37 | } 38 | }; 39 | 40 | #endif // _COMMON_GEOMETRY_POINT3D_H_ 41 | -------------------------------------------------------------------------------- /src/person-tracking/skeleton_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _SKELETON_INFO_H_ 6 | #define _SKELETON_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | #include "skeleton_point_info.h" 16 | 17 | class SkeletonInfo { 18 | public: 19 | SkeletonInfo(); 20 | 21 | SkeletonInfo(const SkeletonInfo& rhs); 22 | 23 | ~SkeletonInfo(); 24 | 25 | SkeletonInfo& operator = (const SkeletonInfo& rhs); 26 | 27 | public: 28 | ArrayHelper get_skeletonJoints() const { 29 | return this->skeletonJoints_; 30 | } 31 | 32 | void SetJavaScriptThis(v8::Local obj) { 33 | // Ignore this if you don't need it 34 | // Typical usage: emit an event on `obj` 35 | } 36 | 37 | private: 38 | mutable ArrayHelperStorage skeletonJoints_; 39 | friend class PersonDataInternal; 40 | }; 41 | 42 | #endif // _SKELETON_INFO_H_ 43 | -------------------------------------------------------------------------------- /src/common/geometry/point2d.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _COMMON_GEOMETRY_POINT2D_H_ 6 | #define _COMMON_GEOMETRY_POINT2D_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | 16 | #include "common/geometry/point_base.h" 17 | 18 | class Point2D : public Point2DBase { 19 | public: 20 | Point2D(); 21 | 22 | explicit Point2D(const double& x, const double& y); 23 | 24 | explicit Point2D(const ArrayHelper& coords); 25 | 26 | Point2D(const Point2D& rhs); 27 | 28 | ~Point2D() {} 29 | 30 | public: 31 | using Point2DBase::setCoords; 32 | void setCoords(const ArrayHelper& coords); 33 | 34 | ArrayHelper getCoords(); 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | }; 41 | 42 | #endif // _COMMON_GEOMETRY_POINT2D_H_ 43 | -------------------------------------------------------------------------------- /src/object-recognition/object_recognition_label_name_translator.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "object_recognition_label_name_translator.h" 6 | 7 | class ObjectRecognitionLabelNameTranslatorD { 8 | ObjectRecognitionLabelNameTranslatorD(); 9 | ~ObjectRecognitionLabelNameTranslatorD(); 10 | friend class ObjectRecognitionLabelNameTranslator; 11 | }; 12 | 13 | ObjectRecognitionLabelNameTranslatorD::ObjectRecognitionLabelNameTranslatorD() { // NOLINT(*) 14 | } 15 | 16 | ObjectRecognitionLabelNameTranslatorD::~ObjectRecognitionLabelNameTranslatorD() { // NOLINT(*) 17 | } 18 | 19 | ObjectRecognitionLabelNameTranslator::ObjectRecognitionLabelNameTranslator() { 20 | d_ = new ObjectRecognitionLabelNameTranslatorD(); 21 | } 22 | 23 | ObjectRecognitionLabelNameTranslator::~ObjectRecognitionLabelNameTranslator() { 24 | delete d_; 25 | } 26 | 27 | std::string ObjectRecognitionLabelNameTranslator::Translate(size_t id) { 28 | return DoTranslate(id); 29 | } 30 | -------------------------------------------------------------------------------- /src/person-tracking/person_registration_data.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "person_registration_data.h" 6 | 7 | PersonRegistrationData::PersonRegistrationData() : 8 | trackID_(-1), 9 | recognitionID_(-1), 10 | descriptorID_(-1) { 11 | } 12 | 13 | PersonRegistrationData::PersonRegistrationData( 14 | const PersonRegistrationData& rhs) { 15 | trackID_ = rhs.trackID_; 16 | recognitionID_ = rhs.recognitionID_; 17 | descriptorID_ = rhs.descriptorID_; 18 | status_ = rhs.status_; 19 | } 20 | 21 | PersonRegistrationData::~PersonRegistrationData() { 22 | // TODO(widl-nan): do cleanup if necessary 23 | } 24 | 25 | PersonRegistrationData& PersonRegistrationData::operator = ( 26 | const PersonRegistrationData& rhs) { 27 | if (&rhs != this) { 28 | trackID_ = rhs.trackID_; 29 | recognitionID_ = rhs.recognitionID_; 30 | descriptorID_ = rhs.descriptorID_; 31 | status_ = rhs.status_; 32 | } 33 | return *this; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/librealsense/test/test-context.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const assert = require('assert'); 8 | const addon = require('bindings')('node_librealsense'); 9 | 10 | describe('Test Context interfaces', function() { 11 | let context = new addon.Context; 12 | 13 | it('Get the device count', function() { 14 | return new Promise((resolve, reject) => { 15 | context.getDeviceCount().then((count) => { 16 | assert.equal(typeof count, 'number'); 17 | console.log('device count equals to ' + count); 18 | resolve(); 19 | }).catch((e) => { 20 | reject(e); 21 | }); 22 | }); 23 | }); 24 | 25 | it('Get device', function() { 26 | return new Promise((resolve, reject) =>{ 27 | context.getDevice(0).then((device) => { 28 | assert(device instanceof addon.Device); 29 | resolve(); 30 | }).catch((e) => { 31 | reject(e); 32 | }); 33 | }); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /src/person-tracking/pose_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POSE_INFO_H_ 6 | #define _POSE_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class PoseInfo { 17 | public: 18 | PoseInfo(); 19 | 20 | PoseInfo(const PoseInfo& rhs); 21 | 22 | ~PoseInfo(); 23 | 24 | PoseInfo& operator = (const PoseInfo& rhs); 25 | 26 | public: 27 | std::string get_position() const { 28 | return this->position_; 29 | } 30 | 31 | int32_t get_confidence() const { 32 | return this->confidence_; 33 | } 34 | 35 | void SetJavaScriptThis(v8::Local obj) { 36 | // Ignore this if you don't need it 37 | // Typical usage: emit an event on `obj` 38 | } 39 | 40 | private: 41 | std::string position_; 42 | 43 | int32_t confidence_; 44 | friend class PersonTrackerAdapter; 45 | }; 46 | 47 | #endif // _POSE_INFO_H_ 48 | -------------------------------------------------------------------------------- /src/common/image.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/image.h" 6 | 7 | Image::Image() 8 | : width_(0), 9 | height_(0), 10 | timestamp_(0), 11 | frame_number_(0), 12 | data_({0}), 13 | own_data_(true) { 14 | // TODO(widl-nan): init your members 15 | } 16 | 17 | Image::~Image() { 18 | if (data_.data && own_data_) { 19 | delete [] data_.data; 20 | } 21 | } 22 | 23 | Image& Image::operator = (const Image& rhs) { 24 | if (&rhs != this) { 25 | // TODO(widl-nan): copy members from rhs 26 | } 27 | return *this; 28 | } 29 | 30 | void Image::Assign(Image* img) { 31 | if (img && img != this) { 32 | width_ = img->width_; 33 | height_ = img->height_; 34 | format_ = img->format_; 35 | timestamp_ = img->timestamp_; 36 | frame_number_ = img->frame_number_; 37 | data_ = img->data_; 38 | // TODO(Donna): this is a walkaround to avoid multiple free data memory. 39 | memset(img, 0, sizeof(Image)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tools/try_build_realsense_js.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2017 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | 8 | set -e 9 | 10 | MOUDLES=" 11 | object-recognition 12 | person-tracking 13 | slam 14 | " 15 | 16 | pushd $(dirname $0) > /dev/null 17 | 18 | NPM_CMDS="install;test" 19 | 20 | # Execute for each module 21 | function build_module { 22 | module_name=$1 23 | 24 | echo -e "\n\n---------Building ${module_name}----------" 25 | 26 | cd src/${module_name} 27 | # Cleanup environment 28 | rm -rf node_modules/ build/ *.tar.gz 29 | 30 | error="0" 31 | IFS=';' 32 | for cmd in ${NPM_CMDS}; do 33 | echo -e "\n\nRun npm $cmd" 34 | eval "npm $cmd" || error="$cmd" 35 | done 36 | 37 | if [ "$error" = "0" ]; then 38 | msg="${module_name}: SUCCEED" 39 | else 40 | msg="${module_name}: FAILED on $error" 41 | fi 42 | 43 | echo -e "\n\n ${msg}" 44 | 45 | cd ../.. 46 | } 47 | 48 | cd .. 49 | for i in ${MOUDLES}; do 50 | build_module $i 51 | done 52 | 53 | popd > /dev/null 54 | -------------------------------------------------------------------------------- /src/person-tracking/person_recognizer_data.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "person_recognizer_data.h" 6 | 7 | PersonRecognizerData::PersonRecognizerData() : 8 | recognized_(false), 9 | trackID_(0), 10 | recognitionID_(0), 11 | similarityScore_(0) { 12 | } 13 | 14 | PersonRecognizerData::PersonRecognizerData(const PersonRecognizerData& rhs) { 15 | recognized_ = rhs.recognized_; 16 | recognitionID_ = rhs.recognitionID_; 17 | trackID_ = rhs.trackID_; 18 | similarityScore_ = rhs.similarityScore_; 19 | } 20 | 21 | PersonRecognizerData::~PersonRecognizerData() { 22 | // TODO(widl-nan): do cleanup if necessary 23 | } 24 | 25 | PersonRecognizerData& PersonRecognizerData::operator = ( 26 | const PersonRecognizerData& rhs) { 27 | if (&rhs != this) { 28 | recognized_ = rhs.recognized_; 29 | recognitionID_ = rhs.recognitionID_; 30 | trackID_ = rhs.trackID_; 31 | similarityScore_ = rhs.similarityScore_; 32 | } 33 | return *this; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /src/person-tracking/orientation_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _ORIENTATION_INFO_H_ 6 | #define _ORIENTATION_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class OrientationInfo { 17 | public: 18 | OrientationInfo(); 19 | 20 | ~OrientationInfo(); 21 | 22 | OrientationInfo& operator = (const OrientationInfo& rhs); 23 | 24 | public: 25 | std::string get_orientation() const { 26 | return this->orientation_; 27 | } 28 | 29 | int32_t get_confidence() const { 30 | return this->confidence_; 31 | } 32 | 33 | void SetJavaScriptThis(v8::Local obj) { 34 | // Ignore this if you don't need it 35 | // Typical usage: emit an event on `obj` 36 | } 37 | 38 | private: 39 | std::string orientation_; 40 | 41 | int32_t confidence_; 42 | friend class PersonTrackerAdapter; 43 | }; 44 | 45 | #endif // _ORIENTATION_INFO_H_ 46 | -------------------------------------------------------------------------------- /src/person-tracking/worker/person_tracking_result_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _WORKER_PERSON_TRACKING_RESULT_INTERNAL_H_ 6 | #define _WORKER_PERSON_TRACKING_RESULT_INTERNAL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "common/frame_data_assembler.h" 12 | #include "person_tracking_result.h" 13 | #include "worker/person_data_internal.h" 14 | 15 | class PersonTrackResultInternal { 16 | public: 17 | PersonTrackResultInternal(); 18 | ~PersonTrackResultInternal(); 19 | 20 | PersonTrackingResult* ToPersonTrackResult(); 21 | void Reset(); 22 | 23 | // Transfer the owner ship of the framedata to the caller. 24 | // After this is called, the frame_data_ is reseted. 25 | FrameData* GrabFrameData(); 26 | private: 27 | std::vector> persons_; 28 | std::shared_ptr frame_data_; 29 | friend class PersonTrackerAdapter; 30 | }; 31 | 32 | #endif // _WORKER_PERSON_TRACKING_RESULT_INTERNAL_H_ 33 | -------------------------------------------------------------------------------- /src/slam/slam_handlers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _SLAM_HANDLERS_H_ 6 | #define _SLAM_HANDLERS_H_ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "async_channel.h" 13 | #include "output_holder.h" 14 | 15 | class SlamTrackingEventHandler : public rs::slam::tracking_event_handler { 16 | public: 17 | void on_restart() { 18 | // TODO(Donna): emit restart event to JS. 19 | } 20 | }; 21 | 22 | class SlamEventHandler 23 | : public rs::core::video_module_interface::processing_event_handler { 24 | private: 25 | OutputHolder* output_holder_; 26 | std::mutex mutex_; 27 | 28 | public: 29 | SlamEventHandler() : output_holder_(nullptr) {} 30 | 31 | ~SlamEventHandler() { 32 | if (output_holder_ != nullptr) delete output_holder_; 33 | } 34 | 35 | OutputHolder* MoveResult(); 36 | void module_output_ready(rs::core::video_module_interface* sender, 37 | rs::core::correlated_sample_set* sample); 38 | }; 39 | 40 | #endif // _SLAM_HANDLERS_H_ 41 | -------------------------------------------------------------------------------- /src/slam/tracking_event.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _TRACKING_EVENT_H_ 6 | #define _TRACKING_EVENT_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "event_info.h" 14 | #include "gen/array_helper.h" 15 | #include "gen/generator_helper.h" 16 | 17 | class TrackingEvent { 18 | public: 19 | TrackingEvent(); 20 | 21 | TrackingEvent(const TrackingEvent& rhs); 22 | 23 | ~TrackingEvent(); 24 | 25 | TrackingEvent& operator = (const TrackingEvent& rhs); 26 | 27 | public: 28 | std::string get_eventName() const { 29 | return this->eventName_; 30 | } 31 | 32 | EventInfo* get_data() const { 33 | return &this->data_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | std::string eventName_; 43 | 44 | mutable EventInfo data_; 45 | }; 46 | 47 | #endif // _TRACKING_EVENT_H_ 48 | -------------------------------------------------------------------------------- /src/person-tracking/expression_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _EXPRESSION_INFO_H_ 6 | #define _EXPRESSION_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class ExpressionInfo { 17 | public: 18 | ExpressionInfo(); 19 | 20 | ExpressionInfo(const ExpressionInfo& rhs); 21 | 22 | ~ExpressionInfo(); 23 | 24 | ExpressionInfo& operator = (const ExpressionInfo& rhs); 25 | 26 | public: 27 | std::string get_type() const { 28 | return this->type_; 29 | } 30 | 31 | int32_t get_confidence() const { 32 | return this->confidence_; 33 | } 34 | 35 | void SetJavaScriptThis(v8::Local obj) { 36 | // Ignore this if you don't need it 37 | // Typical usage: emit an event on `obj` 38 | } 39 | 40 | private: 41 | std::string type_; 42 | 43 | int32_t confidence_; 44 | friend class PersonTrackerAdapter; 45 | }; 46 | 47 | #endif // _EXPRESSION_INFO_H_ 48 | -------------------------------------------------------------------------------- /src/person-tracking/skeleton_point_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "skeleton_point_info.h" 6 | 7 | SkeletonPointInfo::SkeletonPointInfo() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | SkeletonPointInfo::SkeletonPointInfo(const SkeletonPointInfo& rhs) { 12 | jointType_ = rhs.jointType_; 13 | worldCoordinate_ = rhs.worldCoordinate_; 14 | imageCoordinate_ = rhs.imageCoordinate_; 15 | worldConfidence_ = rhs.worldConfidence_; 16 | imageConfidence_ = rhs.imageConfidence_; 17 | } 18 | 19 | SkeletonPointInfo::~SkeletonPointInfo() { 20 | // TODO(widl-nan): do cleanup if necessary 21 | } 22 | 23 | SkeletonPointInfo& SkeletonPointInfo::operator = ( 24 | const SkeletonPointInfo& rhs) { 25 | if (&rhs != this) { 26 | jointType_ = rhs.jointType_; 27 | worldCoordinate_ = rhs.worldCoordinate_; 28 | imageCoordinate_ = rhs.imageCoordinate_; 29 | worldConfidence_ = rhs.worldConfidence_; 30 | imageConfidence_ = rhs.imageConfidence_; 31 | } 32 | 33 | return *this; 34 | } 35 | -------------------------------------------------------------------------------- /src/librealsense/frame_data.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _FRAME_DATA_H_ 6 | #define _FRAME_DATA_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class FrameData { 17 | public: 18 | FrameData(); 19 | 20 | FrameData(const FrameData& rhs); 21 | 22 | ~FrameData(); 23 | 24 | FrameData& operator = (const FrameData& rhs); 25 | 26 | public: 27 | std::string get_stream() const { 28 | return this->stream_; 29 | } 30 | 31 | ArrayBuffer get_data() const { 32 | own_data_ = false; 33 | return this->data_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | std::string stream_; 43 | 44 | ArrayBuffer data_; 45 | 46 | mutable bool own_data_; 47 | 48 | friend class DeviceRunner; 49 | }; 50 | 51 | #endif // _FRAME_DATA_H_ 52 | -------------------------------------------------------------------------------- /src/person-tracking/person_tracking_result.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _PERSON_TRACKING_RESULT_H_ 6 | #define _PERSON_TRACKING_RESULT_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | #include "person_info.h" 16 | 17 | class PersonTrackingResult { 18 | public: 19 | PersonTrackingResult(); 20 | 21 | PersonTrackingResult(const PersonTrackingResult& rhs); 22 | 23 | ~PersonTrackingResult(); 24 | 25 | PersonTrackingResult& operator = (const PersonTrackingResult& rhs); 26 | 27 | public: 28 | ArrayHelper get_persons() const { 29 | return this->persons_; 30 | } 31 | 32 | void SetJavaScriptThis(v8::Local obj) { 33 | // Ignore this if you don't need it 34 | // Typical usage: emit an event on `obj` 35 | } 36 | 37 | private: 38 | mutable ArrayHelperStorage persons_; 39 | friend class PersonTrackResultInternal; 40 | }; 41 | 42 | #endif // _PERSON_TRACKING_RESULT_H_ 43 | -------------------------------------------------------------------------------- /src/slam/async_channel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "async_channel.h" 6 | 7 | AsyncChannel::~AsyncChannel() { 8 | async_ = nullptr; 9 | emitter_.reset(); 10 | } 11 | 12 | AsyncChannel::AsyncChannel(uv_async_t* async, 13 | std::shared_ptr emitter, 14 | bool tracking_event_enabled, 15 | bool error_event_enabled) 16 | : async_(async), emitter_(emitter), 17 | tracking_event_enabled_(tracking_event_enabled), 18 | error_event_enabled_(error_event_enabled) {} 19 | 20 | AsyncChannel& AsyncChannel::operator=(const AsyncChannel& rhs) { 21 | if (&rhs != this) { 22 | async_ = rhs.async_; 23 | emitter_ = rhs.emitter_; 24 | } 25 | return *this; 26 | } 27 | 28 | void AsyncChannel::SendNotice(AsyncMessage* msg) { 29 | async_->data = msg; 30 | uv_async_send(async_); 31 | } 32 | 33 | void AsyncChannel::emitEvent(int argc, v8::Local* argv) const { 34 | emitter_->emit(argc, argv); 35 | } 36 | -------------------------------------------------------------------------------- /src/object-recognition/localization_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "localization_info.h" 6 | 7 | LocalizationInfo::LocalizationInfo() { 8 | label_ = ""; 9 | probability_ = 0; 10 | } 11 | 12 | LocalizationInfo::LocalizationInfo(const std::string& label, double probability, 13 | const Rect2D& roi, const Point3D& objectCenter) { 14 | label_ = label; 15 | probability_ = probability; 16 | roi_ = roi; 17 | objectCenter_ = objectCenter; 18 | } 19 | 20 | LocalizationInfo::LocalizationInfo(const LocalizationInfo& rhs) { 21 | CopyFrom(rhs); 22 | } 23 | 24 | LocalizationInfo::~LocalizationInfo() { 25 | } 26 | 27 | LocalizationInfo& LocalizationInfo::operator = (const LocalizationInfo& rhs) { 28 | CopyFrom(rhs); 29 | return *this; 30 | } 31 | 32 | void LocalizationInfo::CopyFrom(const LocalizationInfo& rhs) { 33 | if (&rhs != this) { 34 | label_ = rhs.label_; 35 | probability_ = rhs.probability_; 36 | roi_ = rhs.roi_; 37 | objectCenter_ = rhs.objectCenter_; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/common/geometry/point_base.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "point_base.h" 6 | 7 | double Point2DBase::distance(const Point2DBase& p1, const Point2DBase& p2) { 8 | return distance(p1.x_, p1.y_, p2.x_, p2.y_); 9 | } 10 | 11 | double Point2DBase::distance(const double& x1, const double& y1, 12 | const double& x2, const double& y2) { 13 | return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); 14 | } 15 | 16 | double Point3DBase::distance(const Point3DBase& p1, const Point3DBase& p2) { 17 | return distance(p1.x_, p1.y_, p1.z_, p2.x_, p2.y_, p2.z_); 18 | } 19 | 20 | double Point3DBase::distance(const double& x1, 21 | const double& y1, 22 | const double& z1, 23 | const double& x2, 24 | const double& y2, 25 | const double& z2) { 26 | auto dx = x1 - x2; 27 | auto dy = y1 - y2; 28 | auto dz = z1 - z2; 29 | 30 | return sqrt(dx*dx + dy*dy + dz*dz); 31 | } 32 | -------------------------------------------------------------------------------- /src/slam/occupancy_tile.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _OCCUPANCY_TILE_H_ 6 | #define _OCCUPANCY_TILE_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class OccupancyTile { 17 | public: 18 | OccupancyTile(); 19 | 20 | OccupancyTile(const OccupancyTile& rhs); 21 | 22 | ~OccupancyTile(); 23 | 24 | OccupancyTile& operator = (const OccupancyTile& rhs); 25 | 26 | public: 27 | int32_t get_x() const { 28 | return this->x_; 29 | } 30 | 31 | int32_t get_y() const { 32 | return this->y_; 33 | } 34 | 35 | int32_t get_occupancy() const { 36 | return this->occupancy_; 37 | } 38 | 39 | void SetJavaScriptThis(v8::Local obj) { 40 | // Ignore this if you don't need it 41 | // Typical usage: emit an event on `obj` 42 | } 43 | 44 | private: 45 | int32_t x_; 46 | 47 | int32_t y_; 48 | 49 | int32_t occupancy_; 50 | }; 51 | 52 | #endif // _OCCUPANCY_TILE_H_ 53 | -------------------------------------------------------------------------------- /src/person-tracking/person_tracking.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _PERSON_TRACKING_H_ 6 | #define _PERSON_TRACKING_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | #include "worker/person_tracker_adapter.h" 16 | 17 | class PersonTracking { 18 | public: 19 | PersonTracking(); 20 | 21 | PersonTracking(const PersonTracking& rhs); 22 | 23 | ~PersonTracking(); 24 | 25 | PersonTracking& operator = (const PersonTracking& rhs); 26 | 27 | public: 28 | v8::Handle startTrackingPerson(const int32_t& trackID); 29 | 30 | v8::Handle stopTrackingPerson(const int32_t& trackID); 31 | 32 | v8::Handle resetTracking(); 33 | 34 | void SetJavaScriptThis(v8::Local obj) { 35 | // Ignore this if you don't need it 36 | // Typical usage: emit an event on `obj` 37 | } 38 | 39 | private: 40 | PersonTrackerAdapter* tracker; 41 | }; 42 | 43 | #endif // _PERSON_TRACKING_H_ 44 | -------------------------------------------------------------------------------- /src/person-tracking/pose_euler_angles.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POSE_EULER_ANGLES_H_ 6 | #define _POSE_EULER_ANGLES_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class PoseEulerAngles { 17 | public: 18 | PoseEulerAngles(); 19 | 20 | ~PoseEulerAngles(); 21 | 22 | PoseEulerAngles& operator = (const PoseEulerAngles& rhs); 23 | 24 | public: 25 | double get_yaw() const { 26 | return this->yaw_; 27 | } 28 | 29 | double get_pitch() const { 30 | return this->pitch_; 31 | } 32 | 33 | double get_roll() const { 34 | return this->roll_; 35 | } 36 | 37 | void SetJavaScriptThis(v8::Local obj) { 38 | // Ignore this if you don't need it 39 | // Typical usage: emit an event on `obj` 40 | } 41 | 42 | private: 43 | double yaw_; 44 | 45 | double pitch_; 46 | 47 | double roll_; 48 | friend class PersonTrackerAdapter; 49 | }; 50 | 51 | #endif // _POSE_EULER_ANGLES_H_ 52 | -------------------------------------------------------------------------------- /src/slam/event_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _EVENT_INFO_H_ 6 | #define _EVENT_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class EventInfo { 17 | public: 18 | EventInfo(); 19 | EventInfo(std::string accuracy, ArrayHelper pose) 20 | : accuracy_(accuracy), camera_pose_(pose) {} 21 | 22 | EventInfo(const EventInfo& rhs); 23 | 24 | ~EventInfo(); 25 | 26 | EventInfo& operator = (const EventInfo& rhs); 27 | 28 | public: 29 | std::string get_accuracy() const { 30 | return this->accuracy_; 31 | } 32 | 33 | ArrayHelper get_cameraPose() const { 34 | return this->camera_pose_; 35 | } 36 | 37 | void SetJavaScriptThis(v8::Local obj) { 38 | // Ignore this if you don't need it 39 | // Typical usage: emit an event on `obj` 40 | } 41 | 42 | private: 43 | std::string accuracy_; 44 | 45 | ArrayHelperStorage camera_pose_; 46 | }; 47 | 48 | #endif // _EVENT_INFO_H_ 49 | -------------------------------------------------------------------------------- /samples/ocf-realsense/ocf-servers/config/security.boilerplate.json: -------------------------------------------------------------------------------- 1 | { 2 | "acl": { 3 | "aclist2": [ 4 | { 5 | "subject": { "conntype": "anon-clear" }, 6 | "resources": [ 7 | { "href": "/oic/res" }, 8 | { "href": "/oic/d" }, 9 | { "href": "/oic/p" } 10 | ], 11 | "permission": 2 12 | }, 13 | { 14 | "subject": { "conntype": "auth-crypt" }, 15 | "resources": [ 16 | { "href": "/oic/res" }, 17 | { "href": "/oic/d" }, 18 | { "href": "/oic/p"} 19 | ], 20 | "permission": 2 21 | }, 22 | { 23 | "subject": { "conntype": "anon-clear" }, 24 | "resources": [ 25 | { "href": "/oic/sec/doxm" } 26 | ], 27 | "permission": 14 28 | }, 29 | { 30 | "subject": { "conntype": "auth-crypt" }, 31 | "resources": [ 32 | { "href": "/oic/sec/doxm" }, 33 | { "href": "/oic/sec/roles" } 34 | ], 35 | "permission": 14 36 | } 37 | ] 38 | }, 39 | "pstat": { 40 | "dos": { "s": 1, "p": false }, 41 | "isop": false, 42 | "cm": 2, 43 | "tm": 0, 44 | "om": 4, 45 | "sm": 4 46 | }, 47 | "doxm": { 48 | "oxms": [ 0 ], 49 | "oxmsel": 0, 50 | "sct": 1, 51 | "owned": false, 52 | "devowneruuid": "" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/person-tracking/lying_pose_recognition.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _LYING_POSE_RECOGNITION_H_ 6 | #define _LYING_POSE_RECOGNITION_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class LyingPoseRecognition { 17 | public: 18 | LyingPoseRecognition(); 19 | 20 | LyingPoseRecognition(const LyingPoseRecognition& rhs); 21 | 22 | ~LyingPoseRecognition(); 23 | 24 | LyingPoseRecognition& operator = (const LyingPoseRecognition& rhs); 25 | 26 | public: 27 | v8::Handle setRecognitionState(const std::string& state); 28 | 29 | v8::Handle getRecognitionState(); 30 | 31 | v8::Handle getCandidatesCount(); 32 | 33 | v8::Handle getCandidatesData(); 34 | 35 | void SetJavaScriptThis(v8::Local obj) { 36 | // Ignore this if you don't need it 37 | // Typical usage: emit an event on `obj` 38 | } 39 | 40 | private: 41 | }; 42 | 43 | #endif // _LYING_POSE_RECOGNITION_H_ 44 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_data2d.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POINTING_DATA2D_H_ 6 | #define _POINTING_DATA2D_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/geometry/point2d.h" 14 | #include "gen/generator_helper.h" 15 | #include "gen/array_helper.h" 16 | 17 | class PointingData2D { 18 | public: 19 | PointingData2D(); 20 | 21 | PointingData2D(const PointingData2D& rhs); 22 | 23 | ~PointingData2D(); 24 | 25 | PointingData2D& operator = (const PointingData2D& rhs); 26 | 27 | public: 28 | Point2D* get_origin() const { 29 | return &this->origin_; 30 | } 31 | 32 | Point2D* get_direction() const { 33 | return &this->direction_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable Point2D origin_; 43 | 44 | mutable Point2D direction_; 45 | friend class PersonTrackerAdapter; 46 | }; 47 | 48 | #endif // _POINTING_DATA2D_H_ 49 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_data3d.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POINTING_DATA3D_H_ 6 | #define _POINTING_DATA3D_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/geometry/point3d.h" 14 | #include "gen/generator_helper.h" 15 | #include "gen/array_helper.h" 16 | 17 | class PointingData3D { 18 | public: 19 | PointingData3D(); 20 | 21 | PointingData3D(const PointingData3D& rhs); 22 | 23 | ~PointingData3D(); 24 | 25 | PointingData3D& operator = (const PointingData3D& rhs); 26 | 27 | public: 28 | Point3D* get_origin() const { 29 | return &this->origin_; 30 | } 31 | 32 | Point3D* get_direction() const { 33 | return &this->direction_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable Point3D origin_; 43 | 44 | mutable Point3D direction_; 45 | friend class PersonTrackerAdapter; 46 | }; 47 | 48 | #endif // _POINTING_DATA3D_H_ 49 | -------------------------------------------------------------------------------- /src/person-tracking/worker/person_data_internal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _WORKER_PERSON_DATA_INTERNAL_H_ 6 | #define _WORKER_PERSON_DATA_INTERNAL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "expression_info.h" 12 | #include "gesture_info.h" 13 | #include "person_info.h" 14 | #include "skeleton_point_info.h" 15 | #include "tracking_info.h" 16 | 17 | class PersonDataInternal { 18 | public: 19 | PersonDataInternal(); 20 | ~PersonDataInternal(); 21 | 22 | PersonInfo* ToPersonInfo(); 23 | private: 24 | std::vector skeleton_joints_; 25 | std::shared_ptr track_data_; 26 | std::shared_ptr ges_data_; 27 | 28 | // person face related data 29 | std::vector expression_info_; 30 | std::vector landmarks_; 31 | int32_t landmark_confidence_; 32 | PoseEulerAngles head_pose_; 33 | bool has_head_pose_; 34 | 35 | std::shared_ptr pose_data_; 36 | friend class PersonTrackerAdapter; 37 | }; 38 | 39 | #endif // _WORKER_PERSON_DATA_INTERNAL_H_ 40 | -------------------------------------------------------------------------------- /src/person-tracking/bounding_box2d_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _BOUNDING_BOX2D_INFO_H_ 6 | #define _BOUNDING_BOX2D_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/geometry/rect2d.h" 14 | #include "gen/generator_helper.h" 15 | #include "gen/array_helper.h" 16 | 17 | class BoundingBox2DInfo { 18 | public: 19 | BoundingBox2DInfo(); 20 | 21 | BoundingBox2DInfo(const BoundingBox2DInfo& rhs); 22 | 23 | ~BoundingBox2DInfo(); 24 | 25 | BoundingBox2DInfo& operator = (const BoundingBox2DInfo& rhs); 26 | 27 | public: 28 | Rect2D* get_rect() const { 29 | return &this->rect_; 30 | } 31 | 32 | int32_t get_confidence() const { 33 | return this->confidence_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable Rect2D rect_; 43 | 44 | int32_t confidence_; 45 | friend class PersonTrackerAdapter; 46 | }; 47 | 48 | #endif // _BOUNDING_BOX2D_INFO_H_ 49 | -------------------------------------------------------------------------------- /src/person-tracking/expression_info_collection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _EXPRESSION_INFO_COLLECTION_H_ 6 | #define _EXPRESSION_INFO_COLLECTION_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "expression_info.h" 14 | #include "gen/array_helper.h" 15 | #include "gen/generator_helper.h" 16 | 17 | class ExpressionInfoCollection { 18 | public: 19 | ExpressionInfoCollection(); 20 | 21 | ExpressionInfoCollection(const ExpressionInfoCollection& rhs); 22 | 23 | ~ExpressionInfoCollection(); 24 | 25 | ExpressionInfoCollection& operator = ( 26 | const ExpressionInfoCollection& rhs); 27 | 28 | public: 29 | ArrayHelper get_infoCollection() const { 30 | return this->infoCollection_; 31 | } 32 | 33 | void SetJavaScriptThis(v8::Local obj) { 34 | // Ignore this if you don't need it 35 | // Typical usage: emit an event on `obj` 36 | } 37 | 38 | private: 39 | mutable ArrayHelperStorage infoCollection_; 40 | friend class PersonDataInternal; 41 | }; 42 | 43 | #endif // _EXPRESSION_INFO_COLLECTION_H_ 44 | -------------------------------------------------------------------------------- /src/person-tracking/face_landmark.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _FACE_LANDMARK_H_ 6 | #define _FACE_LANDMARK_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/geometry/point3d.h" 14 | #include "gen/array_helper.h" 15 | #include "gen/generator_helper.h" 16 | 17 | class FaceLandmark { 18 | public: 19 | FaceLandmark(); 20 | 21 | FaceLandmark(const FaceLandmark& rhs); 22 | 23 | ~FaceLandmark(); 24 | 25 | FaceLandmark& operator = (const FaceLandmark& rhs); 26 | 27 | public: 28 | Point3D* get_imageCoordinate() const { 29 | return &this->imageCoordinate_; 30 | } 31 | 32 | Point3D* get_worldCoordinate() const { 33 | return &this->worldCoordinate_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable Point3D imageCoordinate_; 43 | 44 | mutable Point3D worldCoordinate_; 45 | friend class PersonTrackerAdapter; 46 | }; 47 | 48 | #endif // _FACE_LANDMARK_H_ 49 | -------------------------------------------------------------------------------- /src/librealsense/context.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "context.h" 6 | 7 | #include 8 | 9 | #include "common/task/async_task_runner_instance.h" 10 | #include "context_runner.h" 11 | #include "rs_task.h" 12 | 13 | #define POST_CONTEXT_PROMISE_TASK(type, method, message, ...) \ 14 | auto payload = new RSPayload(); \ 15 | return AsyncTaskRunnerInstance::GetInstance()->PostPromiseTask( \ 16 | new RSPromiseTask( \ 17 | std::bind(&ContextRunner::method, \ 18 | context_runner_.get(), \ 19 | ##__VA_ARGS__)), \ 20 | payload, \ 21 | #message); \ 22 | 23 | Context::Context() { 24 | context_runner_.reset(new ContextRunner()); 25 | } 26 | 27 | Context::~Context() { 28 | } 29 | 30 | v8::Handle Context::getDeviceCount() { 31 | POST_CONTEXT_PROMISE_TASK(int, GetDeviceCount, {{GET_DEVICE_COUNT MESSAGE}}); 32 | } 33 | 34 | v8::Handle Context::getDevice(const int32_t& index) { 35 | POST_CONTEXT_PROMISE_TASK(rs::device*, GetRSDevice, {{GET_RS_DEVICE MESSAGE}}, 36 | index); 37 | } 38 | -------------------------------------------------------------------------------- /src/person-tracking/face_landmark_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _FACE_LANDMARK_INFO_H_ 6 | #define _FACE_LANDMARK_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "face_landmark.h" 14 | #include "gen/array_helper.h" 15 | #include "gen/generator_helper.h" 16 | 17 | class FaceLandmarkInfo { 18 | public: 19 | FaceLandmarkInfo(); 20 | 21 | FaceLandmarkInfo(const FaceLandmarkInfo& rhs); 22 | 23 | ~FaceLandmarkInfo(); 24 | 25 | FaceLandmarkInfo& operator = (const FaceLandmarkInfo& rhs); 26 | 27 | public: 28 | ArrayHelper get_landmarks() const { 29 | return this->landmarks_; 30 | } 31 | 32 | int32_t get_confidence() const { 33 | return this->confidence_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable ArrayHelperStorage landmarks_; 43 | 44 | int32_t confidence_; 45 | friend class PersonDataInternal; 46 | }; 47 | 48 | #endif // _FACE_LANDMARK_INFO_H_ 49 | -------------------------------------------------------------------------------- /src/person-tracking/gesture_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _GESTURE_INFO_H_ 6 | #define _GESTURE_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | #include "pointing_info.h" 16 | 17 | class GestureInfo { 18 | public: 19 | GestureInfo(); 20 | 21 | GestureInfo(const GestureInfo& rhs); 22 | 23 | ~GestureInfo(); 24 | 25 | GestureInfo& operator = (const GestureInfo& rhs); 26 | 27 | public: 28 | bool get_isPointing() const { 29 | return this->isPointing_; 30 | } 31 | 32 | PointingInfo* get_pointingInfo() const { 33 | return has_pointing_info_ ? &this->pointingInfo_ : nullptr; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | bool isPointing_; 43 | 44 | mutable PointingInfo pointingInfo_; 45 | bool has_pointing_info_; 46 | friend class PersonTrackerAdapter; 47 | }; 48 | 49 | #endif // _GESTURE_INFO_H_ 50 | -------------------------------------------------------------------------------- /src/slam/occupancy_map_data.cpp: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #include "occupancy_map_data.h" 4 | 5 | OccupancyMapData::OccupancyMapData() 6 | : is_data_pending_(false), tile_count_(0), data_store_(nullptr) { 7 | } 8 | 9 | OccupancyMapData::OccupancyMapData(const OccupancyMapData& rhs) { 10 | // TODO(widl-nan): copy from rhs if you want this behavior 11 | // Or mark ctor = delete in occupancy_map_data.h 12 | } 13 | 14 | OccupancyMapData::~OccupancyMapData() { 15 | if (data_store_) delete [] data_store_; 16 | } 17 | 18 | OccupancyMapData& OccupancyMapData::operator = (const OccupancyMapData& rhs) { 19 | if (&rhs != this) { 20 | // TODO(widl-nan): copy members from rhs 21 | } 22 | return *this; 23 | } 24 | 25 | void OccupancyMapData::SetData(bool is_data_pending, int32_t tile_count, 26 | const int32_t* data) { 27 | is_data_pending_ = is_data_pending; 28 | tile_count_ = tile_count; 29 | if (data_store_ != nullptr) delete data_store_; 30 | 31 | data_store_ = new int32_t[3 * tile_count_]; 32 | memcpy(data_store_, data, 3 * tile_count_); 33 | } 34 | 35 | void OccupancyMapData::SetupTypedArray() { 36 | SetupTypedArrayHelper(&data_, 37 | data_store_, 38 | tile_count_ * 3); 39 | } 40 | -------------------------------------------------------------------------------- /src/object-recognition/recognition_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _RECOGNITION_INFO_H_ 6 | #define _RECOGNITION_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class RecognitionInfo { 17 | public: 18 | RecognitionInfo(); 19 | 20 | RecognitionInfo(const std::string& label, double probability); 21 | 22 | RecognitionInfo(const RecognitionInfo& rhs); 23 | 24 | ~RecognitionInfo(); 25 | 26 | RecognitionInfo& operator = (const RecognitionInfo& rhs); 27 | 28 | void CopyFrom(const RecognitionInfo& rhs); 29 | 30 | public: 31 | std::string get_label() const { 32 | return this->label_; 33 | } 34 | 35 | double get_probability() const { 36 | return this->probability_; 37 | } 38 | 39 | void SetJavaScriptThis(v8::Local obj) { 40 | // Ignore this if you don't need it 41 | // Typical usage: emit an event on `obj` 42 | } 43 | 44 | private: 45 | std::string label_; 46 | 47 | double probability_; 48 | }; 49 | 50 | #endif // _RECOGNITION_INFO_H_ 51 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - "4" 5 | 6 | sudo: required 7 | 8 | services: 9 | # Travis CI does not support Ubuntu 16.04, so we use docker to match RealSense requirement. 10 | - docker 11 | 12 | branches: 13 | only: 14 | - master 15 | 16 | before_install: 17 | # Run linter 18 | - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git && export PATH=$PATH:$(pwd)/depot_tools 19 | - cd tools && npm install && cd .. 20 | - python ./tools/node_modules/widl-nan/tools/lint.py 21 | 22 | # Pull container 23 | - sudo docker pull ubuntu:16.04 24 | 25 | # Install dependencies described as Dockerfile 26 | - sudo git submodule update --init --recursive 27 | - sudo mkdir ./tools/.docker 28 | - sudo cat ./tools/Dockerfile.template | sed 's//mrbuild/g' | sed 's//Mr. Build/g' | sed 's//node-realsense@github.com/g' > /tmp/Dockerfile 29 | - sudo cp /tmp/Dockerfile ./tools/.docker/Dockerfile 30 | - sudo cp ./tools/install_realsense_pkgs.sh ./tools/.docker/ 31 | - sudo docker build -t realsense ./tools/.docker 32 | 33 | script: 34 | - sudo docker run -v $(pwd):/home/mrbuild/node-realsense --rm realsense bash -c "sudo -H -u mrbuild /home/mrbuild/node-realsense/tools/try_build_realsense_js.sh" 35 | -------------------------------------------------------------------------------- /samples/ocf-realsense/ocf-servers/README.md: -------------------------------------------------------------------------------- 1 | # JavaScript OCF servers 2 | This folder contains JavaScript implementation of the following OCF servers: 3 | * Buzzer (x1) 4 | * RGB LED (x1) 5 | 6 | 7 | # Setting up the OCF servers 8 | ## Setting up the HW 9 | You need the devce and sensors in the following list: 10 | * 1 x [MinnowBoard Turbot](https://store.netgate.com/Turbot2.aspx) 11 | * 1 x [Grove Buzzer](http://www.seeedstudio.com/wiki/Grove_-_Buzzer) 12 | * 1 x [Grove Chainable RGB LED](http://www.seeedstudio.com/depot/twig-chainable-rgb-led-p-850.html?cPath=156_157) 13 | 14 | ### Wiring 15 | For MinnowBoard Turbot pin number, please refer to [here](https://github.com/intel-iot-devkit/mraa/blob/master/docs/minnow_max.md#interface-notes) 16 | 17 | | Sensor | Pin | Link | 18 | |:-----------------:|:------:|:------------------------:| 19 | | Buzzer | GPIO 12 |[Grove Buzzer](https://www.seeedstudio.com/Grove-Buzzer-p-768.html) | 20 | | RGB LED | 14--Clock, 16--Data | [Grove Chainable RGB LED](http://www.seeedstudio.com/depot/twig-chainable-rgb-led-p-850.html?cPath=156_157) | 21 | 22 | Mount RGB LED with MinnowBoard Turbot as shown in the following picture(buzzer need to connect `SIG` to Pin `GPIO 12`): 23 | 24 | ![](../doc/sensor_connection.png) 25 | -------------------------------------------------------------------------------- /src/person-tracking/person_recognizer_data_with_status.h: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #ifndef _PERSON_RECOGNIZER_DATA_WITH_STATUS_H_ 4 | #define _PERSON_RECOGNIZER_DATA_WITH_STATUS_H_ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "gen/generator_helper.h" 12 | #include "gen/array_helper.h" 13 | 14 | #include "person_recognizer_data.h" 15 | 16 | class PersonRecognizerDataWithStatus { 17 | public: 18 | PersonRecognizerDataWithStatus(); 19 | 20 | PersonRecognizerDataWithStatus(const PersonRecognizerDataWithStatus& rhs); 21 | 22 | ~PersonRecognizerDataWithStatus(); 23 | 24 | PersonRecognizerDataWithStatus& operator = ( 25 | const PersonRecognizerDataWithStatus& rhs); 26 | 27 | public: 28 | PersonRecognizerData* get_data() const { 29 | return &this->data_; 30 | } 31 | 32 | std::string get_status() const { 33 | return this->status_; 34 | } 35 | 36 | void SetJavaScriptThis(v8::Local obj) { 37 | // Ignore this if you don't need it 38 | // Typical usage: emit an event on `obj` 39 | } 40 | 41 | private: 42 | mutable PersonRecognizerData data_; 43 | 44 | std::string status_; 45 | friend class PersonTrackerAdapter; 46 | }; 47 | 48 | #endif // _PERSON_RECOGNIZER_DATA_WITH_STATUS_H_ 49 | -------------------------------------------------------------------------------- /src/person-tracking/worker/person_tracking_result_internal.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "worker/person_tracking_result_internal.h" 6 | 7 | #include 8 | 9 | #include "gen/nan__person_info.h" 10 | 11 | PersonTrackResultInternal::PersonTrackResultInternal() { 12 | } 13 | 14 | PersonTrackResultInternal::~PersonTrackResultInternal() { 15 | Reset(); 16 | } 17 | 18 | FrameData* PersonTrackResultInternal::GrabFrameData() { 19 | if (frame_data_) { 20 | FrameData* ptr = frame_data_->ToFrameData(); 21 | frame_data_.reset(); 22 | return ptr; 23 | } 24 | return nullptr; 25 | } 26 | 27 | void PersonTrackResultInternal::Reset() { 28 | persons_.clear(); 29 | } 30 | 31 | PersonTrackingResult* PersonTrackResultInternal::ToPersonTrackResult() { 32 | auto result = new PersonTrackingResult; 33 | std::vector array; 34 | 35 | for ( unsigned int i = 0; i < persons_.size(); i++ ) { 36 | array.push_back(persons_[i]->ToPersonInfo()); 37 | } 38 | 39 | ArrayHelper helper; 40 | helper.FromArrayOfImplT(array.begin(), array.end()); 41 | result->persons_.FromArrayHelper(helper); 42 | return result; 43 | } 44 | -------------------------------------------------------------------------------- /src/person-tracking/point_combined_info.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "point_combined_info.h" 6 | 7 | #include 8 | 9 | PointCombinedInfo::PointCombinedInfo() 10 | : worldConfidence_(0), 11 | imageConfidence_(0) { 12 | // TODO(widl-nan): init your members 13 | } 14 | 15 | PointCombinedInfo::PointCombinedInfo(const PointCombinedInfo& rhs) { 16 | worldCoordinate_ = rhs.worldCoordinate_; 17 | imageCoordinate_ = rhs.imageCoordinate_; 18 | worldConfidence_ = rhs.worldConfidence_; 19 | imageConfidence_ = rhs.imageConfidence_; 20 | } 21 | 22 | PointCombinedInfo::~PointCombinedInfo() { 23 | // TODO(widl-nan): do cleanup if necessary 24 | } 25 | 26 | PointCombinedInfo& PointCombinedInfo::operator = ( 27 | const PointCombinedInfo& rhs) { 28 | if (&rhs != this) { 29 | // TODO(widl-nan): copy members from rhs 30 | // memcpy((void*)this, (void*)&rhs, sizeof(PointCombinedInfo)); // NOLINT 31 | worldCoordinate_ = rhs.worldCoordinate_; 32 | imageCoordinate_ = rhs.imageCoordinate_; 33 | worldConfidence_ = rhs.worldConfidence_; 34 | imageConfidence_ = rhs.imageConfidence_; 35 | } 36 | 37 | return *this; 38 | } 39 | -------------------------------------------------------------------------------- /src/common/image_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _IMAGE_UTILS_H_ 6 | #define _IMAGE_UTILS_H_ 7 | 8 | namespace image_utils { 9 | inline int8_t GetPixelSize(rs::format format) { 10 | switch (format) { 11 | case rs::format::any: 12 | return 0; 13 | 14 | case rs::format::z16: 15 | return 2; 16 | 17 | case rs::format::disparity16: 18 | return 2; 19 | 20 | case rs::format::xyz32f: 21 | return 4; 22 | 23 | case rs::format::yuyv: 24 | return 2; 25 | 26 | case rs::format::rgb8: 27 | return 3; 28 | 29 | case rs::format::bgr8: 30 | return 3; 31 | 32 | case rs::format::rgba8: 33 | return 4; 34 | 35 | case rs::format::bgra8: 36 | return 4; 37 | 38 | case rs::format::y8: 39 | return 1; 40 | 41 | case rs::format::y16: 42 | return 2; 43 | 44 | case rs::format::raw8: 45 | return 1; 46 | 47 | case rs::format::raw10: 48 | return 0; // not supported 49 | 50 | case rs::format::raw16: 51 | return 2; 52 | 53 | default: 54 | return 0; 55 | } 56 | } 57 | } // namespace image_utils 58 | 59 | 60 | #endif // _IMAGE_UTILS_H_ 61 | -------------------------------------------------------------------------------- /src/slam/occupancy_map_data.h: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #ifndef _OCCUPANCY_MAP_DATA_H_ 4 | #define _OCCUPANCY_MAP_DATA_H_ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "default_values.h" 12 | #include "gen/generator_helper.h" 13 | #include "gen/array_helper.h" 14 | 15 | class OccupancyMapData { 16 | public: 17 | OccupancyMapData(); 18 | 19 | OccupancyMapData(const OccupancyMapData& rhs); 20 | 21 | ~OccupancyMapData(); 22 | 23 | OccupancyMapData& operator = (const OccupancyMapData& rhs); 24 | 25 | public: 26 | bool get_isDataPending() const { 27 | return this->is_data_pending_; 28 | } 29 | 30 | int32_t get_tileCount() const { 31 | return this->tile_count_; 32 | } 33 | 34 | Int32ArrayHelper get_data() const { 35 | return this->data_; 36 | } 37 | 38 | void SetData(bool is_data_pending, int32_t tile_count, const int32_t* data); 39 | 40 | void SetupTypedArray(); 41 | 42 | void SetJavaScriptThis(v8::Local obj) { 43 | // Ignore this if you don't need it 44 | // Typical usage: emit an event on `obj` 45 | } 46 | 47 | private: 48 | bool is_data_pending_; 49 | int32_t tile_count_; 50 | Int32ArrayHelper data_; 51 | int32_t* data_store_; 52 | }; 53 | 54 | #endif // _OCCUPANCY_MAP_DATA_H_ 55 | -------------------------------------------------------------------------------- /src/slam/depth_of_interest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _DEPTH_OF_INTEREST_H_ 6 | #define _DEPTH_OF_INTEREST_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class DepthOfInterest { 17 | public: 18 | DepthOfInterest(); 19 | 20 | DepthOfInterest(const DepthOfInterest& rhs); 21 | 22 | ~DepthOfInterest(); 23 | 24 | DepthOfInterest& operator = (const DepthOfInterest& rhs); 25 | 26 | public: 27 | double get_minDepth() const { 28 | return this->minDepth_; 29 | } 30 | 31 | void set_minDepth(const double& new_value) { 32 | this->minDepth_ = new_value; 33 | } 34 | 35 | double get_maxDepth() const { 36 | return this->maxDepth_; 37 | } 38 | 39 | void set_maxDepth(const double& new_value) { 40 | this->maxDepth_ = new_value; 41 | } 42 | 43 | void SetJavaScriptThis(v8::Local obj) { 44 | // Ignore this if you don't need it 45 | // Typical usage: emit an event on `obj` 46 | } 47 | 48 | private: 49 | double minDepth_; 50 | 51 | double maxDepth_; 52 | }; 53 | 54 | #endif // _DEPTH_OF_INTEREST_H_ 55 | -------------------------------------------------------------------------------- /src/librealsense/rs_extrinsics.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _RS_EXTRINSICS_H_ 6 | #define _RS_EXTRINSICS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | #include "common/extrinsics.h" 15 | #include "gen/generator_helper.h" 16 | #include "gen/array_helper.h" 17 | 18 | class RSExtrinsics : public Extrinsics { 19 | public: 20 | RSExtrinsics() {} 21 | 22 | explicit RSExtrinsics(const RSExtrinsics& rhs) = delete; 23 | 24 | explicit RSExtrinsics(rs::extrinsics extrinsics); 25 | 26 | RSExtrinsics& operator = (const RSExtrinsics& rhs); 27 | 28 | public: 29 | bool get_isIdentity() const { 30 | return this->isIdentity_; 31 | } 32 | 33 | Float32ArrayHelper transform(const Float32ArrayHelper& point); // NOLINT 34 | 35 | void SetJavaScriptThis(v8::Local obj) { 36 | // Ignore this if you don't need it 37 | // Typical usage: emit an event on `obj` 38 | } 39 | 40 | private: 41 | rs::extrinsics extrinsics_; 42 | 43 | bool isIdentity_; 44 | 45 | Float32ArrayHelper transform_; 46 | float transform_store_[TRANSLATION_SIZE]; 47 | }; 48 | 49 | #endif // _RS_EXTRINSICS_H_ 50 | -------------------------------------------------------------------------------- /src/common/extrinsics.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/extrinsics.h" 6 | 7 | Extrinsics::Extrinsics() { 8 | ZerofillArray(rotation_store_, ROTATION_SIZE); 9 | ZerofillArray(translation_store_, TRANSLATION_SIZE); 10 | Setup(); 11 | } 12 | 13 | Extrinsics::Extrinsics(const float* rotations, const float* translations) { 14 | Setup(); 15 | SetRotation(rotations); 16 | SetTranslation(translations); 17 | } 18 | 19 | Extrinsics::Extrinsics(const Extrinsics& rhs) { 20 | CopyFrom(rhs); 21 | } 22 | 23 | Extrinsics::~Extrinsics() { 24 | } 25 | 26 | Extrinsics& Extrinsics::operator = (const Extrinsics& rhs) { 27 | CopyFrom(rhs); 28 | return *this; 29 | } 30 | 31 | void Extrinsics::Setup() { 32 | SetupTypedArrayHelper(&rotation_, 33 | rotation_store_, 34 | ROTATION_SIZE); 35 | SetupTypedArrayHelper(&translation_, 36 | translation_store_, 37 | TRANSLATION_SIZE); 38 | } 39 | 40 | void Extrinsics::CopyFrom(const Extrinsics& rhs) { 41 | if (this != &rhs) { 42 | Setup(); 43 | DeepCopyFromTypedArrayHelper(rhs.rotation_, 44 | rotation_store_, ROTATION_SIZE); 45 | DeepCopyFromTypedArrayHelper(rhs.translation_, 46 | translation_store_, TRANSLATION_SIZE); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/person-tracking/test/PersonTracking/test-persontracking-api-existence.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('PersonTracking API Test', function() { 11 | describe('API Existance', function() { 12 | let obj; 13 | before(function(done) { 14 | // eslint-disable-next-line no-invalid-this 15 | this.timeout(10000); 16 | pt.createPersonTracker().then((instance) => { 17 | obj = instance.personTracking; 18 | done(); 19 | }); 20 | }); 21 | it('pt.PersonTracking is exist', function() { 22 | assert.ok(typeof (obj) !== 'undefined'); 23 | }); 24 | 25 | it('pt.PersonTracking type is correct', function() { 26 | assert.equal(typeof (obj), 'object'); 27 | }); 28 | 29 | it('new PersonTracking object has a method .startTrackingPerson', function() { 30 | assert.equal(typeof (obj.startTrackingPerson), 'function'); 31 | }); 32 | 33 | it('new PersonTracking object has a method .stopTrackingPerson', function() { 34 | assert.equal(typeof (obj.stopTrackingPerson), 'function'); 35 | }); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point2D/test-point2d-equal.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point2D API Test', function() { 11 | describe('equal Test', function() { 12 | it.skip('arameter is one point2D object', function() { 13 | let obj = new pt.Point2D(1.0, 2.0); 14 | let objTest = new pt.Point2D(1.0, 2.0); 15 | let result = obj.equal(objTest); 16 | assert.ok(result); 17 | }); 18 | 19 | it.skip('parameters are two numbers', function() { 20 | let obj = new pt.Point2D(1.0, 2.0); 21 | let result = obj.equal(1.0, 2.0); 22 | assert.ok(result); 23 | }); 24 | 25 | it.skip('(1.0, 2.0) is not equal (3.0, 4.0)', function() { 26 | let obj = new pt.Point2D(1.0, 2.0); 27 | let result = obj.equal(3.0, 4.0); 28 | assert.ok(!result); 29 | }); 30 | 31 | it.skip('(1.0, 2.0) is not equal point(3.0, 4.0)', function() { 32 | let obj = new pt.Point2D(1.0, 2.0); 33 | let objTest = new pt.Point2D(3.0, 4.0); 34 | let result = obj.equal(objTest); 35 | assert.ok(!result); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /src/person-tracking/person_tracking.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include 6 | 7 | #include "person_tracking.h" 8 | #include "worker/person_tracker_runner_proxy.h" 9 | 10 | PersonTracking::PersonTracking() {} 11 | 12 | PersonTracking::PersonTracking(const PersonTracking& rhs) { 13 | // TODO(widl-nan): copy from rhs if you want this behavior 14 | // Or mark ctor = delete in person_tracking.h 15 | } 16 | 17 | PersonTracking::~PersonTracking() { 18 | // TODO(widl-nan): do cleanup if necessary 19 | } 20 | 21 | PersonTracking& PersonTracking::operator = (const PersonTracking& rhs) { 22 | if (&rhs != this) { 23 | // TODO(widl-nan): copy members from rhs 24 | } 25 | 26 | return *this; 27 | } 28 | 29 | v8::Handle PersonTracking::startTrackingPerson( 30 | const int32_t& trackID) { 31 | return PersonTrackerRunnerProxy::GetInstance()->StartTrackingPerson(trackID); 32 | } 33 | 34 | v8::Handle PersonTracking::stopTrackingPerson( 35 | const int32_t& trackID) { 36 | return PersonTrackerRunnerProxy::GetInstance()->StopTrackingPerson(trackID); 37 | } 38 | 39 | v8::Handle PersonTracking::resetTracking() { 40 | return PersonTrackerRunnerProxy::GetInstance()->ResetTracking(); 41 | } 42 | -------------------------------------------------------------------------------- /src/object-recognition/u.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const addon = require('.'); 4 | 5 | function quick_test() { 6 | let instance = null; 7 | addon.createInstance().then(inst => { 8 | console.log('1. Creating instance'); 9 | instance = inst; 10 | console.log(instance); 11 | 12 | return instance.setInstanceOptions({enableObjectCenterEstimation: true}); 13 | }).then(function() { 14 | let firstEventTimestamp = undefined; 15 | console.log('2. Setup event listeners'); 16 | instance.on('recognition', function (data) { 17 | console.log('New [recognition] result is caught: ', data); 18 | instance.getFrameData().then((info) => { 19 | let currentTimestamp = new Date().getTime(); 20 | if (!firstEventTimestamp) { 21 | firstEventTimestamp = currentTimestamp; 22 | } 23 | const delta = currentTimestamp - firstEventTimestamp; 24 | console.log('>JavaScript incremental time in millisecond', delta); 25 | console.log(info); 26 | // console.log('>Diff between JavaScript time & frameNumber:', info.depth.frameNumber - delta); 27 | }); 28 | }); 29 | 30 | console.log('3. Start RealSense camera'); 31 | return instance.start(); 32 | }).then(function() { 33 | console.log('Camera started...'); 34 | }).catch(e => { 35 | console.log(`Something was wrong ${e}`); 36 | }); 37 | } 38 | 39 | quick_test(); 40 | -------------------------------------------------------------------------------- /src/common/geometry/size2d.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/geometry/size2d.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "common/geometry/float_equal.h" 11 | 12 | Size2D::Size2D() { 13 | w_ = h_ = 0; 14 | } 15 | 16 | Size2D::Size2D(const double& width, const double& height) { 17 | w_ = width; 18 | h_ = height; 19 | } 20 | 21 | Size2D::Size2D(const Size2D& rhs) { 22 | w_ = rhs.w_; 23 | h_ = rhs.h_; 24 | } 25 | 26 | Size2D::~Size2D() { 27 | } 28 | 29 | Size2D& Size2D::operator = (const Size2D& rhs) { 30 | if (&rhs != this) { 31 | w_ = rhs.w_; 32 | h_ = rhs.h_; 33 | } 34 | return *this; 35 | } 36 | 37 | bool Size2D::equal(const Size2D& size) { 38 | return equal(size.w_, size.h_); 39 | } 40 | 41 | bool Size2D::equal(const double& width, const double& height) { 42 | return double_equal(w_, width) && double_equal(h_, height); 43 | } 44 | 45 | bool Size2D::isEmpty() { 46 | return w_ == 0 || h_ == 0; 47 | } 48 | 49 | bool Size2D::isValid() { 50 | return !std::isnan(w_) && !std::isnan(h_) && w_ >= 0 && h_ >= 0; 51 | } 52 | 53 | std::string Size2D::ToString() const { 54 | std::stringstream ss; 55 | ss << "Size2D (" << get_width() << ", " << get_height() << ")"; 56 | return ss.str(); 57 | } 58 | -------------------------------------------------------------------------------- /src/person-tracking/worker/person_tracker_creator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _WORKER_PERSON_TRACKER_CREATOR_H_ 6 | #define _WORKER_PERSON_TRACKER_CREATOR_H_ 7 | 8 | #include 9 | 10 | #include "gen/camera_options.h" 11 | #include "gen/person_tracker_options.h" 12 | #include "gen/promise-helper.h" 13 | #include "worker/person_tracker_runner_proxy.h" 14 | 15 | class PersonTrackerCreator : public PromiseWorkQueueHelper { 16 | public: 17 | PersonTrackerCreator(); 18 | ~PersonTrackerCreator() {} 19 | virtual bool DoWork(); 20 | virtual void OnWorkDone(); 21 | virtual v8::Local GetResolved(); 22 | virtual v8::Local GetRejected(); 23 | static void DestroyInstance(); 24 | void SetTrackerOptions( 25 | const DictionaryPersonTrackerOptions& tracker_options); 26 | void SetCameraOptions(const DictionaryCameraOptions& camera_options); 27 | private: 28 | DictionaryPersonTrackerOptions tracker_options_; 29 | DictionaryCameraOptions camera_options_; 30 | bool have_tracker_options_; 31 | bool have_camera_options_; 32 | static Nan::Persistent* tracker_object_; 33 | std::string fail_reason_; 34 | }; 35 | 36 | NAN_METHOD(CreatePersonTracker); 37 | 38 | #endif // _WORKER_PERSON_TRACKER_CREATOR_H_ 39 | -------------------------------------------------------------------------------- /src/librealsense/rs_extrinsics.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "rs_extrinsics.h" 6 | 7 | RSExtrinsics::RSExtrinsics(rs::extrinsics extrinsics) 8 | : Extrinsics(extrinsics.rotation, extrinsics.translation), 9 | extrinsics_(extrinsics), 10 | isIdentity_(extrinsics.is_identity()) { 11 | SetupTypedArrayHelper(&transform_, transform_store_, TRANSLATION_SIZE); 12 | } 13 | 14 | Float32ArrayHelper RSExtrinsics::transform( 15 | const Float32ArrayHelper& point) { 16 | DeepCopyFromTypedArrayHelper(point, transform_store_, TRANSLATION_SIZE); 17 | rs::float3 transform; 18 | transform.x = transform_store_[0]; 19 | transform.y = transform_store_[1]; 20 | transform.z = transform_store_[2]; 21 | 22 | transform = extrinsics_.transform(transform); 23 | 24 | transform_store_[0] = transform.x; 25 | transform_store_[1] = transform.y; 26 | transform_store_[2] = transform.z; 27 | 28 | return transform_; 29 | } 30 | 31 | RSExtrinsics& RSExtrinsics::operator = (const RSExtrinsics& rhs) { 32 | if (this != &rhs) { 33 | extrinsics_ = rhs.extrinsics_; 34 | isIdentity_ = rhs.isIdentity_; 35 | 36 | for (uint i = 0; i < TRANSLATION_SIZE; i++) { 37 | transform_store_[i] = rhs.transform_store_[i]; 38 | } 39 | } 40 | return *this; 41 | } 42 | -------------------------------------------------------------------------------- /src/person-tracking/test/Point3D/test-point3d-equal.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | /* global describe, it */ 6 | 'use strict'; 7 | const assert = require('assert'); 8 | const pt = require('bindings')('realsense_person_tracking'); 9 | 10 | describe('Point3D API Test', function() { 11 | describe('equal Test', function() { 12 | it.skip('parameter is one Point3D object', function() { 13 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 14 | let objTest = new pt.Point3D(1.0, 2.0, 3.0); 15 | let result = obj.equal(objTest); 16 | assert.ok(result); 17 | }); 18 | 19 | it.skip('parameters are three numbers', function() { 20 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 21 | let result = obj.equal(1.0, 2.0, 3.0); 22 | assert.ok(result); 23 | }); 24 | 25 | it.skip('(1.0, 2.0, 3.0) is not equal (2.0, 3.0, 4.0)', function() { 26 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 27 | let result = obj.equal(2.0, 3.0, 4.0); 28 | assert.ok(!result); 29 | }); 30 | 31 | it.skip('(1.0, 2.0, 3.0) is not equal point(2.0, 3.0, 4.0)', function() { 32 | let obj = new pt.Point3D(1.0, 2.0, 3.0); 33 | let objTest = new pt.Point3D(2.0, 3.0, 4.0); 34 | let result = obj.equal(objTest); 35 | assert.ok(!result); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /src/object-recognition/t.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const addon = require('.'); 4 | 5 | function quick_test() { 6 | let or_instance; 7 | addon.createInstance().then(instance => { 8 | console.log('1. Creating instance'); 9 | console.log(instance); 10 | 11 | let firstEventTimestamp = undefined; 12 | console.log('2. Setup event listeners'); 13 | instance.on('recognition', function (data) { 14 | console.log('New [recognition] result is caught: ', data); 15 | // instance.getFrameData().then((info) => { 16 | // let currentTimestamp = new Date().getTime(); 17 | // if (!firstEventTimestamp) { 18 | // firstEventTimestamp = currentTimestamp; 19 | // } 20 | // const delta = currentTimestamp - firstEventTimestamp; 21 | // console.log('>JavaScript incremental time in millisecond', delta); 22 | // console.log(info); 23 | // console.log('>Diff between JavaScript time & frameNumber:', info.depth.frameNumber - delta); 24 | // }); 25 | }); 26 | or_instance = instance; 27 | return instance.setInstanceOptions({mode: 'localization', enableObjectCenterEstimation: true}); 28 | }).then(function() { 29 | console.log('3. Start RealSense camera'); 30 | return or_instance.start(); 31 | }).then(function() { 32 | console.log('Camera started...'); 33 | }).catch(e => { 34 | console.log(`Something was wrong ${e}`); 35 | }); 36 | } 37 | 38 | quick_test(); 39 | 40 | -------------------------------------------------------------------------------- /src/librealsense/README.md: -------------------------------------------------------------------------------- 1 | # Intel® RealSense™ technology with JavaScript API for Linux OS 2 | 3 | `node-librealsense`: Node.js librealsense module based on Intel® RealSense™ technology. 4 | 5 | Please refer to [Release Note](https://github.com/01org/node-realsense/releases) for details of current release. 6 | 7 | # Install 8 | Prepare [environment](https://01org.github.io/node-realsense/doc/setup_environment.html) and then execute the following command in shell: 9 | ``` 10 | npm install --save node-librealsense 11 | ``` 12 | 13 | # Examples 14 | The following example shows the basic usage of this module. Before executing it, connect an Intel® RealSense™ Camera to your computer or developer board. 15 | 16 | ``` 17 | const module = require('node-librealsense'); 18 | 19 | let context = new module.Context; 20 | 21 | context.getDevice(0).then((device) => { 22 | let mode = { 23 | width: 640, 24 | height: 480, 25 | format: 'z16', 26 | }; 27 | 28 | device.on('frameready', (frame) => { 29 | // A new frame was captured. 30 | }); 31 | 32 | device.enableStream('depth', mode).then(() => { 33 | device.start().then(() => { 34 | console.log('Camera started...'); 35 | }); 36 | }); 37 | }); 38 | 39 | ``` 40 | 41 | # Document 42 | Please refer to the [project document home page](https://01org.github.io/node-realsense/), and also the details page listed below: 43 | - [Intel® RealSense™ Cross Platform API](https://github.com/IntelRealSense/librealsense) 44 | -------------------------------------------------------------------------------- /src/person-tracking/lying_pose_recognition.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "lying_pose_recognition.h" 6 | 7 | LyingPoseRecognition::LyingPoseRecognition() { 8 | // TODO(widl-nan): init your members 9 | } 10 | 11 | LyingPoseRecognition::LyingPoseRecognition( 12 | const LyingPoseRecognition& rhs) { 13 | // TODO(widl-nan): copy from rhs if you want this behavior 14 | // Or mark ctor = delete in lying_pose_recognition.h 15 | } 16 | 17 | LyingPoseRecognition::~LyingPoseRecognition() { 18 | // TODO(widl-nan): do cleanup if necessary 19 | } 20 | 21 | LyingPoseRecognition& LyingPoseRecognition::operator = ( 22 | const LyingPoseRecognition& rhs) { 23 | if (&rhs != this) { 24 | // TODO(widl-nan): copy members from rhs 25 | } 26 | 27 | return *this; 28 | } 29 | 30 | v8::Handle LyingPoseRecognition::setRecognitionState( 31 | const std::string& state) { 32 | // TODO(widl-nan): fill your code here 33 | } 34 | 35 | v8::Handle LyingPoseRecognition::getRecognitionState() { 36 | // TODO(widl-nan): fill your code here 37 | } 38 | 39 | v8::Handle LyingPoseRecognition::getCandidatesCount() { 40 | // TODO(widl-nan): fill your code here 41 | } 42 | 43 | v8::Handle LyingPoseRecognition::getCandidatesData() { 44 | // TODO(widl-nan): fill your code here 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/object-recognition/examples/unplug-camera-while-running.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | 9 | function runObjectRecognition() { 10 | const options = { 11 | mode: 'single-recognition', 12 | confidenceThreshold: 0.35, 13 | computeEngine: 'CPU', 14 | enableSegmentation: true, 15 | maxReturnObjectCount: 2, 16 | enableObjectCenterEstimation: false, 17 | }; 18 | 19 | addon.createObjectRecognizer().then((inst) => { 20 | let instance = inst; 21 | inst.setCameraOptions({ 22 | color: { 23 | width: 640, 24 | height: 480, 25 | frameRate: 30, 26 | isEnabled: true, 27 | }, 28 | depth: { 29 | width: 320, 30 | height: 240, 31 | frameRate: 30, 32 | isEnabled: true, 33 | }, 34 | }).then(() => { 35 | return instance.setObjectRecognitionOptions(options); 36 | }).then(() => { 37 | instance.on('recognition', function(eventData) { 38 | process.stdout.write('.'); 39 | }); 40 | 41 | instance.start(); 42 | }).catch((e) => { 43 | console.log(`Something was wrong ${e}`); 44 | }); 45 | }); 46 | } 47 | 48 | process.on('uncaughtException', (err) => { 49 | console.log(`uncaughtException: ${er}`); 50 | }); 51 | 52 | runObjectRecognition(); 53 | -------------------------------------------------------------------------------- /src/person-tracking/person_recognizer_data.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _PERSON_RECOGNIZER_DATA_H_ 6 | #define _PERSON_RECOGNIZER_DATA_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | 16 | class PersonRecognizerData { 17 | public: 18 | PersonRecognizerData(); 19 | 20 | PersonRecognizerData(const PersonRecognizerData& rhs); 21 | 22 | ~PersonRecognizerData(); 23 | 24 | PersonRecognizerData& operator = (const PersonRecognizerData& rhs); 25 | 26 | public: 27 | bool get_recognized() const { 28 | return this->recognized_; 29 | } 30 | 31 | int32_t get_trackID() const { 32 | return this->trackID_; 33 | } 34 | 35 | int32_t get_recognitionID() const { 36 | return this->recognitionID_; 37 | } 38 | 39 | int32_t get_similarityScore() const { 40 | return this->similarityScore_; 41 | } 42 | 43 | void SetJavaScriptThis(v8::Local obj) { 44 | // Ignore this if you don't need it 45 | // Typical usage: emit an event on `obj` 46 | } 47 | 48 | private: 49 | bool recognized_; 50 | 51 | int32_t trackID_; 52 | 53 | int32_t recognitionID_; 54 | 55 | int32_t similarityScore_; 56 | friend class PersonTrackerAdapter; 57 | }; 58 | 59 | #endif // _PERSON_RECOGNIZER_DATA_H_ 60 | -------------------------------------------------------------------------------- /src/object-recognition/tracking_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _TRACKING_INFO_H_ 6 | #define _TRACKING_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | 16 | #include "rect2d.h" 17 | 18 | #include "point3d.h" 19 | 20 | class TrackingInfo { 21 | public: 22 | TrackingInfo(); 23 | 24 | TrackingInfo(const Rect2D& roi, const Point3D& object_center); 25 | 26 | TrackingInfo(const TrackingInfo& rhs); 27 | 28 | ~TrackingInfo(); 29 | 30 | TrackingInfo& operator = (const TrackingInfo& rhs); 31 | 32 | public: 33 | Rect2D* get_roi() const { 34 | return &this->roi_; 35 | } 36 | 37 | Point3D* get_objectCenter() const { 38 | return &this->object_center_; 39 | } 40 | 41 | void SetROI(const Rect2D& roi) { 42 | roi_ = roi; 43 | } 44 | 45 | void SetObjectCenter(const Point3D& object_center) { 46 | object_center_ = object_center; 47 | } 48 | 49 | void SetJavaScriptThis(v8::Local obj) { 50 | // Ignore this if you don't need it 51 | // Typical usage: emit an event on `obj` 52 | } 53 | 54 | private: 55 | void CopyFrom(const TrackingInfo&); 56 | 57 | private: 58 | mutable Rect2D roi_; 59 | mutable Point3D object_center_; 60 | }; 61 | 62 | #endif // _TRACKING_INFO_H_ 63 | -------------------------------------------------------------------------------- /src/slam/tracking_result.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _TRACKING_RESULT_H_ 6 | #define _TRACKING_RESULT_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "frame_data.h" 14 | #include "gen/array_helper.h" 15 | #include "gen/generator_helper.h" 16 | 17 | class TrackingResult { 18 | public: 19 | TrackingResult(); 20 | 21 | TrackingResult(const TrackingResult& rhs) = delete; 22 | 23 | ~TrackingResult(); 24 | 25 | TrackingResult& operator = (const TrackingResult& rhs); 26 | 27 | public: 28 | std::string get_accuracy() const { return this->accuracy_; } 29 | 30 | void set_accuracy(const std::string& accuracy) { accuracy_ = accuracy; } 31 | 32 | ArrayHelper get_cameraPose() const { return this->camera_pose_; } 33 | 34 | void set_camera_pose(ArrayHelper pose) { camera_pose_ = pose; } 35 | 36 | FrameData* get_frameData() const { return &this->frame_data_; } 37 | 38 | void set_frame_data(FrameData* info) { frame_data_ = *info; } 39 | 40 | void SetJavaScriptThis(v8::Local obj) { 41 | // Ignore this if you don't need it 42 | // Typical usage: emit an event on `obj` 43 | } 44 | 45 | private: 46 | std::string accuracy_; 47 | 48 | ArrayHelperStorage camera_pose_; 49 | 50 | mutable FrameData frame_data_; 51 | }; 52 | 53 | #endif // _TRACKING_RESULT_H_ 54 | -------------------------------------------------------------------------------- /src/person-tracking/test/StableTest/getUsageRecord.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2016 Intel Corporation. All rights reserved. 4 | # Use of this source code is governed by a MIT-style license that can be 5 | # found in the LICENSE file. 6 | # 7 | 8 | #set -x 9 | # Run script as root, unless permissions are dropped elsewhere." 10 | 11 | echo "Please input the test lasting time (seconds): " 12 | read num 13 | END=`expr $num / 10` 14 | cpu_log=cpu_used.dat 15 | mem_log=mem_info.dat 16 | gpu_log=gpu.dat 17 | echo "" > gpu.dat 18 | echo "#time cpu_used" > cpu_used.dat 19 | echo "#time total free used buff/cache" > mem_info.dat 20 | intel_gpu_top -o $gpu_log 2>&1 > /dev/null & 21 | sleep 10 22 | for ((i=1;i<=END;i++)) 23 | do 24 | top_info=`top -bn1 |grep -E "KiB Mem|$1"| paste -s -d "!"` 25 | cpu_used=`echo $top_info|awk -F '!' '{print $2}'|awk '{print $9}'|awk -F '.' '{print $1}'` 26 | mem_info=`echo $top_info|awk -F ' ' '{print $4,$6,$8,$10,$8/$4*100}'` 27 | n=`expr $i \* 10` 28 | echo $n $cpu_used >> $cpu_log 29 | echo $n $mem_info >> $mem_log 30 | remain=`expr $num - $i \* 10 + 10` 31 | h=`expr $remain / 3600` 32 | m=`expr $remain % 3600 / 60` 33 | s=`expr $remain % 60` 34 | echo "test remaining $h hour(s) $m minute(s) $s second(s)" 35 | sleep 10 36 | done 37 | gpu_pids=`ps aux | grep intel_gpu_top|grep -v grep| awk '{print $2}'` 38 | for pid in $gpu_pids;do 39 | kill -9 $pid 2>&1 > /dev/null 40 | done 41 | echo "Done. result kept at $cpu_log, $mem_log and $gpu_log" 42 | 43 | kill -9 $$ 44 | -------------------------------------------------------------------------------- /src/person-tracking/person_registration_data.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _PERSON_REGISTRATION_DATA_H_ 6 | #define _PERSON_REGISTRATION_DATA_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | 16 | class PersonRegistrationData { 17 | public: 18 | PersonRegistrationData(); 19 | 20 | PersonRegistrationData(const PersonRegistrationData& rhs); 21 | 22 | ~PersonRegistrationData(); 23 | 24 | PersonRegistrationData& operator = (const PersonRegistrationData& rhs); 25 | 26 | public: 27 | int32_t get_trackID() const { 28 | return this->trackID_; 29 | } 30 | 31 | int32_t get_recognitionID() const { 32 | return this->recognitionID_; 33 | } 34 | 35 | int32_t get_descriptorID() const { 36 | return this->descriptorID_; 37 | } 38 | 39 | std::string get_status() const { 40 | return this->status_; 41 | } 42 | 43 | void SetJavaScriptThis(v8::Local obj) { 44 | // Ignore this if you don't need it 45 | // Typical usage: emit an event on `obj` 46 | } 47 | 48 | private: 49 | int32_t trackID_; 50 | 51 | int32_t recognitionID_; 52 | 53 | int32_t descriptorID_; 54 | 55 | 56 | std::string status_; 57 | friend class PersonTrackerAdapter; 58 | }; 59 | 60 | #endif // _PERSON_REGISTRATION_DATA_H_ 61 | -------------------------------------------------------------------------------- /src/slam/occupancy_map_bounds.h: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #ifndef _OCCUPANCY_MAP_BOUNDS_H_ 4 | #define _OCCUPANCY_MAP_BOUNDS_H_ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | 11 | #include "gen/generator_helper.h" 12 | #include "gen/array_helper.h" 13 | 14 | class OccupancyMapBounds { 15 | public: 16 | OccupancyMapBounds(); 17 | 18 | OccupancyMapBounds(const OccupancyMapBounds& rhs); 19 | 20 | ~OccupancyMapBounds(); 21 | 22 | OccupancyMapBounds& operator = (const OccupancyMapBounds& rhs); 23 | 24 | public: 25 | int32_t get_minX() const { 26 | return this->minX_; 27 | } 28 | 29 | void set_minX(int32_t minx) { 30 | this->minX_ = minx; 31 | } 32 | 33 | int32_t get_minZ() const { 34 | return this->minZ_; 35 | } 36 | 37 | void set_minZ(int32_t minZ) { 38 | this->minZ_ = minZ; 39 | } 40 | 41 | int32_t get_maxX() const { 42 | return this->maxX_; 43 | } 44 | 45 | void set_maxX(int32_t maxX) { 46 | this->maxX_ = maxX; 47 | } 48 | 49 | int32_t get_maxZ() const { 50 | return this->maxZ_; 51 | } 52 | 53 | void set_maxZ(int32_t maxZ) { 54 | this->maxZ_ = maxZ; 55 | } 56 | 57 | void SetJavaScriptThis(v8::Local obj) { 58 | // Ignore this if you don't need it 59 | // Typical usage: emit an event on `obj` 60 | } 61 | 62 | private: 63 | int32_t minX_; 64 | 65 | int32_t minZ_; 66 | 67 | int32_t maxX_; 68 | 69 | int32_t maxZ_; 70 | }; 71 | 72 | #endif // _OCCUPANCY_MAP_BOUNDS_H_ 73 | -------------------------------------------------------------------------------- /src/object-recognition/examples/localization.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | 9 | function runLocalization() { 10 | const options = { 11 | mode: 'localization', 12 | confidenceThreshold: 0.75, 13 | computeEngine: 'CPU', 14 | enableSegmentation: true, 15 | enableObjectCenterEstimation: true, 16 | }; 17 | 18 | addon.createObjectRecognizer().then((objectRecognizer) => { 19 | let or = objectRecognizer; 20 | or.setCameraOptions({ 21 | color: { 22 | width: 640, 23 | height: 480, 24 | frameRate: 30, 25 | isEnabled: true, 26 | }, 27 | depth: { 28 | width: 320, 29 | height: 240, 30 | frameRate: 30, 31 | isEnabled: true, 32 | }, 33 | }).then(() => { 34 | return or.setObjectRecognitionOptions(options); 35 | }).then(() => { 36 | or.on('localization', function(eventData) { 37 | console.log('New [localization] event: ', eventData.length); 38 | eventData.forEach((item) => { 39 | console.log(item.label, item.probability, item.roi.toString(), item.objectCenter); 40 | }); 41 | console.log('----'); 42 | }); 43 | 44 | or.start(); 45 | }).catch((e) => { 46 | console.log(`Something was wrong ${e}`); 47 | }); 48 | }); 49 | } 50 | 51 | runLocalization(); 52 | -------------------------------------------------------------------------------- /src/librealsense/examples/get-frame.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | let fs = require('fs'); 9 | let jpeg = require('jpeg-turbo'); 10 | 11 | let context = new addon.Context; 12 | 13 | context.getDevice(0).then((device) => { 14 | let mode = { 15 | width: 640, 16 | height: 480, 17 | format: 'rgb', 18 | framerate: 30, 19 | }; 20 | 21 | let frameCount = 0; 22 | 23 | console.log('One frame will be saved as a JPEG file every 10 seconds.'); 24 | 25 | device.on('frameready', function(frame) { 26 | if (frameCount % 300 === 0) { 27 | let imageBuffer; 28 | imageBuffer = encodeToJPEG(frame.data, 640, 480); 29 | 30 | let fileName = 'frame_' + frameCount + '.jpg'; 31 | fs.writeFileSync(fileName, imageBuffer); 32 | console.log('Frame has been saved as ' + fileName); 33 | } 34 | 35 | frameCount ++; 36 | }); 37 | 38 | device.enableStream('color', mode).then(() => { 39 | device.start().catch((e) => { 40 | console.log(e); 41 | }); 42 | }); 43 | }).catch((e) => { 44 | console.log(e); 45 | }); 46 | 47 | function encodeToJPEG(buffer, width, height) { 48 | let options = { 49 | format: jpeg.FORMAT_RGB, 50 | width: width, 51 | height: height, 52 | quality: 80, 53 | }; 54 | let jpegImageData = jpeg.compressSync(buffer, options); 55 | return jpegImageData; 56 | } 57 | -------------------------------------------------------------------------------- /src/slam/examples/map-sample.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | // 5 | 'use strict'; 6 | 7 | let slamAddon = require('bindings')('realsense_slam'); 8 | 9 | let instance; 10 | function test1() { 11 | slamAddon.createInstance() 12 | .then(function(slamInstance) { 13 | instance = slamInstance; 14 | console.log('In JS: Succeed to create slamInstance.'); 15 | return slamInstance.start(); 16 | }).then(function() { 17 | console.log('In JS: Succeed to start.'); 18 | return instance.saveOccupancyMap(__dirname + '/map'); 19 | }).then(function() { 20 | console.log('success save occupancy map'); 21 | return instance.loadOccupancyMap(__dirname + '/map'); 22 | }).then(function() { 23 | console.log('success load occupancy map'); 24 | return instance.saveRelocalizationMap(__dirname + '/relocalizationMap'); 25 | }).then(function() { 26 | console.log('success save relocalization map'); 27 | return instance.loadRelocalizationMap(__dirname + '/relocalizationMap'); 28 | }).then(function() { 29 | console.log('success load relocalization map'); 30 | return instance.getRelocalizationPose(); 31 | }).then(function(pose) { 32 | console.log('success get pose: ' + pose); 33 | return slamInstance.stop(); 34 | }); 35 | } 36 | 37 | test1(); 38 | 39 | process.on('uncaughtException', function(err) { 40 | console.error('Error caught in uncaughtException event:', err); 41 | }); 42 | -------------------------------------------------------------------------------- /src/object-recognition/examples/single-recognition.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | 9 | function runObjectRecognition() { 10 | const options = { 11 | mode: 'single-recognition', 12 | confidenceThreshold: 0.35, 13 | computeEngine: 'CPU', 14 | enableSegmentation: true, 15 | maxReturnObjectCount: 2, 16 | enableObjectCenterEstimation: false, 17 | }; 18 | 19 | addon.createObjectRecognizer().then((objectRecognizer) => { 20 | let or = objectRecognizer; 21 | or.setCameraOptions({ 22 | color: { 23 | width: 640, 24 | height: 480, 25 | frameRate: 30, 26 | isEnabled: true, 27 | }, 28 | depth: { 29 | width: 320, 30 | height: 240, 31 | frameRate: 30, 32 | isEnabled: true, 33 | }, 34 | }).then(() => { 35 | return or.setObjectRecognitionOptions(options); 36 | }).then(() => { 37 | or.on('recognition', function(eventData) { 38 | console.log('[recognition] event, objects =', eventData.length); 39 | eventData.forEach((item) => { 40 | console.log(item.label, '|', item.probability); 41 | }); 42 | console.log('----'); 43 | }); 44 | 45 | or.start(); 46 | }).catch((e) => { 47 | console.log(`Something was wrong ${e}`); 48 | }); 49 | }); 50 | } 51 | 52 | runObjectRecognition(); 53 | -------------------------------------------------------------------------------- /src/person-tracking/pointing_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POINTING_INFO_H_ 6 | #define _POINTING_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/generator_helper.h" 14 | #include "gen/array_helper.h" 15 | #include "pointing_data2d.h" 16 | #include "pointing_data3d.h" 17 | 18 | class PointingInfo { 19 | public: 20 | PointingInfo(); 21 | 22 | PointingInfo(const PointingInfo& rhs); 23 | 24 | ~PointingInfo(); 25 | 26 | PointingInfo& operator = (const PointingInfo& rhs); 27 | 28 | public: 29 | PointingData3D* get_worldPointingData() const { 30 | return &this->worldPointingData_; 31 | } 32 | 33 | PointingData2D* get_colorPointingData() const { 34 | return &this->colorPointingData_; 35 | } 36 | 37 | int32_t get_confidence() const { 38 | return this->confidence_; 39 | } 40 | 41 | int32_t get_gestureStartTimeStamp() const { 42 | return this->gestureStartTimeStamp_; 43 | } 44 | 45 | void SetJavaScriptThis(v8::Local obj) { 46 | // Ignore this if you don't need it 47 | // Typical usage: emit an event on `obj` 48 | } 49 | 50 | private: 51 | mutable PointingData3D worldPointingData_; 52 | 53 | mutable PointingData2D colorPointingData_; 54 | 55 | int32_t confidence_; 56 | 57 | int32_t gestureStartTimeStamp_; 58 | friend class PersonTrackerAdapter; 59 | }; 60 | 61 | #endif // _POINTING_INFO_H_ 62 | -------------------------------------------------------------------------------- /src/person-tracking/mask_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _MASK_INFO_H_ 6 | #define _MASK_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | class MaskInfo { 17 | public: 18 | MaskInfo(); 19 | 20 | MaskInfo(const MaskInfo& rhs); 21 | 22 | ~MaskInfo(); 23 | 24 | MaskInfo& operator = (const MaskInfo& rhs); 25 | 26 | public: 27 | int32_t get_width() const { 28 | return this->width_; 29 | } 30 | 31 | int32_t get_height() const { 32 | return this->height_; 33 | } 34 | 35 | int32_t get_timestamp() const { 36 | return this->timestamp_; 37 | } 38 | 39 | ArrayBuffer get_maskData() { 40 | // When get_maskData is called, the owner ship is transferred to the 41 | // caller, so we empty the internal buffer to avolid mem leak. 42 | auto ret = this->maskData_; 43 | memset(&this->maskData_, 0, sizeof(ArrayBuffer)); 44 | return ret; 45 | } 46 | 47 | void SetJavaScriptThis(v8::Local obj) { 48 | // Ignore this if you don't need it 49 | // Typical usage: emit an event on `obj` 50 | } 51 | 52 | private: 53 | int32_t width_; 54 | 55 | int32_t height_; 56 | 57 | int32_t timestamp_; 58 | 59 | ArrayBuffer maskData_; 60 | friend class PersonTrackerAdapter; 61 | friend class PersonDataInternal; 62 | }; 63 | 64 | #endif // _MASK_INFO_H_ 65 | -------------------------------------------------------------------------------- /src/person-tracking/point_combined_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _POINT_COMBINED_INFO_H_ 6 | #define _POINT_COMBINED_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "common/geometry/point2d.h" 14 | #include "common/geometry/point3d.h" 15 | #include "gen/generator_helper.h" 16 | #include "gen/array_helper.h" 17 | 18 | class PointCombinedInfo { 19 | public: 20 | PointCombinedInfo(); 21 | 22 | PointCombinedInfo(const PointCombinedInfo& rhs); 23 | 24 | ~PointCombinedInfo(); 25 | 26 | PointCombinedInfo& operator = (const PointCombinedInfo& rhs); 27 | 28 | public: 29 | Point3D* get_worldCoordinate() const { 30 | return &this->worldCoordinate_; 31 | } 32 | 33 | Point2D* get_imageCoordinate() const { 34 | return &this->imageCoordinate_; 35 | } 36 | 37 | int32_t get_worldConfidence() const { 38 | return this->worldConfidence_; 39 | } 40 | 41 | int32_t get_imageConfidence() const { 42 | return this->imageConfidence_; 43 | } 44 | 45 | void SetJavaScriptThis(v8::Local obj) { 46 | // Ignore this if you don't need it 47 | // Typical usage: emit an event on `obj` 48 | } 49 | 50 | private: 51 | mutable Point3D worldCoordinate_; 52 | 53 | mutable Point2D imageCoordinate_; 54 | 55 | int32_t worldConfidence_; 56 | 57 | int32_t imageConfidence_; 58 | friend class PersonTrackerAdapter; 59 | }; 60 | 61 | #endif // _POINT_COMBINED_INFO_H_ 62 | -------------------------------------------------------------------------------- /src/object-recognition/addon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "gen/nan__extrinsics.h" 6 | #include "gen/nan__frame_data.h" 7 | #include "gen/nan__localization_info.h" 8 | #include "gen/nan__tracking_info.h" 9 | #include "gen/nan__image.h" 10 | #include "gen/nan__object_recognizer.h" 11 | #include "gen/nan__intrinsics.h" 12 | #include "gen/nan__motion_device_intrinsic.h" 13 | #include "gen/nan__motion_sample.h" 14 | #include "gen/nan__point2d.h" 15 | #include "gen/nan__point3d.h" 16 | #include "gen/nan__range.h" 17 | #include "gen/nan__rect2d.h" 18 | #include "gen/nan__recognition_info.h" 19 | #include "gen/nan__size2d.h" 20 | #include "gen/promise-helper.h" 21 | #include "instance_creator.h" 22 | 23 | void initModule(v8::Local exports) { 24 | NanExtrinsics::Init(exports); 25 | NanFrameData::Init(exports); 26 | NanImage::Init(exports); 27 | NanObjectRecognizer::Init(exports); 28 | NanIntrinsics::Init(exports); 29 | NanLocalizationInfo::Init(exports); 30 | NanTrackingInfo::Init(exports); 31 | NanMotionDeviceIntrinsic::Init(exports); 32 | NanMotionSample::Init(exports); 33 | NanPoint2D::Init(exports); 34 | NanPoint3D::Init(exports); 35 | NanRange::Init(exports); 36 | NanRecognitionInfo::Init(exports); 37 | NanRect2D::Init(exports); 38 | NanSize2D::Init(exports); 39 | 40 | Nan::Export(exports, 41 | "createObjectRecognizer", 42 | CreateObjectRecognizerInstance); 43 | } 44 | 45 | NODE_MODULE(realsense_or, initModule); 46 | -------------------------------------------------------------------------------- /src/common/geometry/range.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "common/geometry/range.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "common/geometry/float_equal.h" 11 | 12 | Range::Range() { 13 | begin_ = end_ = 0; 14 | } 15 | 16 | Range::Range(const double& begin, const double& end) { 17 | begin_ = begin; 18 | end_ = end; 19 | } 20 | 21 | Range::Range(const Range& rhs) { 22 | begin_ = rhs.begin_; 23 | end_ = rhs.end_; 24 | } 25 | 26 | Range::~Range() { 27 | } 28 | 29 | Range& Range::operator = (const Range& rhs) { 30 | if (&rhs != this) { 31 | begin_ = rhs.begin_; 32 | end_ = rhs.end_; 33 | } 34 | return *this; 35 | } 36 | 37 | bool Range::contains(const double& value) { 38 | return value >= begin_ && value <= end_; 39 | } 40 | 41 | bool Range::properlyContains(const double& value) { 42 | return value > begin_ && value < end_; 43 | } 44 | 45 | bool Range::equal(const Range& range) { 46 | return equal(range.begin_, range.end_); 47 | } 48 | 49 | bool Range::equal(const double& begin, const double& end) { 50 | return double_equal(begin_, begin) && double_equal(end_, end); 51 | } 52 | 53 | bool Range::isEmpty() { 54 | return begin_ == end_; 55 | } 56 | 57 | bool Range::isValid() { 58 | return !std::isnan(begin_) && !std::isnan(end_) && end_ >= begin_; 59 | } 60 | 61 | std::string Range::ToString() const { 62 | std::stringstream ss; 63 | ss << "Range (" << get_min() << " - " << get_max() << ")"; 64 | return ss.str(); 65 | } 66 | -------------------------------------------------------------------------------- /src/object-recognition/localization_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _LOCALIZATION_INFO_H_ 6 | #define _LOCALIZATION_INFO_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/generator_helper.h" 15 | 16 | #include "rect2d.h" 17 | #include "point3d.h" 18 | 19 | class LocalizationInfo { 20 | public: 21 | LocalizationInfo(); 22 | 23 | LocalizationInfo(const std::string& label, double probability, 24 | const Rect2D& roi, const Point3D& objectCenter); 25 | 26 | LocalizationInfo(const LocalizationInfo& rhs); 27 | 28 | ~LocalizationInfo(); 29 | 30 | LocalizationInfo& operator = (const LocalizationInfo& rhs); 31 | 32 | void CopyFrom(const LocalizationInfo& rhs); 33 | 34 | public: 35 | std::string get_label() const { 36 | return this->label_; 37 | } 38 | 39 | double get_probability() const { 40 | return this->probability_; 41 | } 42 | 43 | Rect2D* get_roi() const { 44 | return &this->roi_; 45 | } 46 | 47 | Point3D* get_objectCenter() const { 48 | return &this->objectCenter_; 49 | } 50 | 51 | void SetJavaScriptThis(v8::Local obj) { 52 | // Ignore this if you don't need it 53 | // Typical usage: emit an event on `obj` 54 | } 55 | 56 | private: 57 | std::string label_; 58 | 59 | double probability_; 60 | 61 | mutable Rect2D roi_; 62 | 63 | mutable Point3D objectCenter_; 64 | }; 65 | 66 | #endif // _LOCALIZATION_INFO_H_ 67 | -------------------------------------------------------------------------------- /src/slam/map_image.h: -------------------------------------------------------------------------------- 1 | // To add your copyright and license header 2 | 3 | #ifndef _MAP_IMAGE_H_ 4 | #define _MAP_IMAGE_H_ 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include "gen/generator_helper.h" 13 | #include "gen/array_helper.h" 14 | 15 | class MapImage { 16 | public: 17 | MapImage(); 18 | 19 | MapImage(const MapImage& rhs) = delete; 20 | 21 | ~MapImage(); 22 | 23 | MapImage& operator = (const MapImage& rhs); 24 | 25 | public: 26 | uint32_t get_width() const { 27 | return this->width_; 28 | } 29 | 30 | void set_width(uint32_t width) { 31 | this->width_ = width; 32 | } 33 | 34 | uint32_t get_height() const { 35 | return this->height_; 36 | } 37 | 38 | void set_height(uint32_t height) { 39 | this->height_ = height; 40 | } 41 | 42 | Uint8ArrayHelper get_data() const { 43 | return this->data_; 44 | } 45 | 46 | uint8_t* get_data_store(uint32_t width, uint32_t height) { 47 | data_store_.resize(4 * width * height); 48 | return data_store_.data(); 49 | } 50 | 51 | void set_data_store(uint8_t* external_data, uint32_t width, uint32_t height) { 52 | this->data_store_.assign(external_data, external_data + width * height * 4); 53 | } 54 | 55 | void SetupTypedArray(); 56 | 57 | void SetJavaScriptThis(v8::Local obj) { 58 | // Ignore this if you don't need it 59 | // Typical usage: emit an event on `obj` 60 | } 61 | 62 | private: 63 | uint32_t width_; 64 | uint32_t height_; 65 | Uint8ArrayHelper data_; 66 | std::vector data_store_; 67 | }; 68 | 69 | #endif // _MAP_IMAGE_H_ 70 | -------------------------------------------------------------------------------- /src/object-recognition/examples/frame-data.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | 'use strict'; 6 | 7 | const addon = require('..'); 8 | 9 | function runObjectRecognition() { 10 | const options = { 11 | mode: 'single-recognition', 12 | confidenceThreshold: 0.35, 13 | computeEngine: 'CPU', 14 | enableSegmentation: true, 15 | maxReturnObjectCount: 2, 16 | enableObjectCenterEstimation: false, 17 | }; 18 | 19 | addon.createObjectRecognizer().then((objectRecognizer) => { 20 | let or = objectRecognizer; 21 | or.setCameraOptions({ 22 | color: { 23 | width: 640, 24 | height: 480, 25 | frameRate: 30, 26 | isEnabled: true, 27 | }, 28 | depth: { 29 | width: 320, 30 | height: 240, 31 | frameRate: 30, 32 | isEnabled: true, 33 | }, 34 | }).then(() => { 35 | return or.setObjectRecognitionOptions(options); 36 | }).then(() => { 37 | or.on('recognition', function(eventData) { 38 | console.log('[recognition] event, objects =', eventData.length); 39 | eventData.forEach((item) => { 40 | console.log(item.label, '|', item.probability); 41 | }); 42 | console.log('----'); 43 | 44 | or.getFrameData().then(function(info) { 45 | console.log(info); 46 | }); 47 | }); 48 | 49 | or.start(); 50 | }).catch((e) => { 51 | console.log(`Something was wrong ${e}`); 52 | }); 53 | }); 54 | } 55 | 56 | runObjectRecognition(); 57 | -------------------------------------------------------------------------------- /src/object-recognition/object_recognizer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 Intel Corporation. All rights reserved. 2 | // Use of this source code is governed by a MIT-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef _INSTANCE_H_ 6 | #define _INSTANCE_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "gen/array_helper.h" 14 | #include "gen/camera_options.h" 15 | #include "gen/object_recognition_options.h" 16 | #include "gen/generator_helper.h" 17 | 18 | class ObjectRecognizer { 19 | public: 20 | ObjectRecognizer(); 21 | 22 | ObjectRecognizer(const ObjectRecognizer& rhs) = delete; 23 | 24 | ~ObjectRecognizer(); 25 | 26 | ObjectRecognizer& operator = (const ObjectRecognizer& rhs); 27 | 28 | public: 29 | std::string get_state() const; 30 | 31 | v8::Local getCameraOptions(); 32 | 33 | v8::Local getObjectRecognitionOptions(); 34 | 35 | v8::Local setObjectRecognitionOptions( 36 | const ObjectRecognitionOptions& options); 37 | 38 | v8::Local setCameraOptions(const CameraOptions& options); 39 | 40 | v8::Local start(); 41 | 42 | v8::Local pause(); 43 | 44 | v8::Local resume(); 45 | 46 | v8::Local stop(); 47 | 48 | v8::Local reset(); 49 | 50 | v8::Local restart(); 51 | 52 | v8::Local getFrameData(); 53 | 54 | v8::Local getRecognizableObjectNames(); 55 | 56 | void SetJavaScriptThis(v8::Local obj); 57 | 58 | private: 59 | class ObjectRecognizerD* d_; 60 | }; 61 | 62 | #endif // _INSTANCE_H_ 63 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | ## To make a fresh new image (Long wait, Coffee Time) 2 | ``` 3 | mkdir ./tools/.docker 4 | cp ./tools/Dockerfile.template ./tools/.docker/Dockerfile 5 | 6 | cp ./tools/install_realsense_pkgs.sh ./tools/.docker/ 7 | docker build -t realsense ./tools/.docker 8 | ``` 9 | 10 | * If you're behind firewall, please append proxy environment after `build` 11 | ``` 12 | --build-arg http_proxy= \ 13 | --build-arg https_proxy= \ 14 | --build-arg no_proxy= 15 | ``` 16 | 17 | ## To run container 18 | 19 | * Launch image with interactive mode 20 | ``` 21 | docker run -ti realsense bash 22 | ``` 23 | 24 | * If you need run realsense tests, you need add host video devices by appending 25 | ``` 26 | --device=/dev/video0:/dev/video0 \ 27 | --device=/dev/video1:/dev/video1 \ 28 | --device=/dev/video2:/dev/video2 \ 29 | --device=/dev/video3:/dev/video3 30 | ``` 31 | 32 | ** R200 only have three devices (video[0,1,2]), ZR300 have four devices (video[0,1,2,3]) 33 | 34 | * If you're behind firewall, please append proxy environment after `run` 35 | ``` 36 | -e "http_proxy=" \ 37 | -e "https_proxy=" \ 38 | -e "no_proxy=" 39 | ``` 40 | 41 | ## To customize&save the image 42 | 43 | * Do anything you want to customize the image, then 44 | ``` 45 | docker ps (to get id of running container) 46 | docker pause 47 | docker commit /realsense 48 | docker unpause 49 | ``` 50 | 51 | * (optional) Push repo remotely. 52 | ``` 53 | docker push /realsense 54 | ``` 55 | --------------------------------------------------------------------------------