From 30c2c44560c2114f4a4b9360a62ea81478e8cc73 Mon Sep 17 00:00:00 2001 From: oddity Date: Sat, 17 Jun 2023 22:03:36 +0800 Subject: [PATCH] Make changes on the basis of the recording example in the Android sample program, introduce the openCV library, realize pressing the snapshot button, save the aligned color map, pseudo-color depth map, and grayscale depth map locally on the Android device, and use the getData method to save The depth data is a .csv file. --- wrappers/CMakeLists.txt | 11 +- .../android/examples/capture/build.gradle | 13 +- .../intel/realsense/capture/MainActivity.java | 151 +- .../src/main/res/layout/activity_main.xml | 17 +- .../capture/src/main/res/values/strings.xml | 1 + .../examples/java_example/app/build.gradle | 14 +- .../app/src/main/res/layout/activity_main.xml | 4 +- .../examples/java_example/build.gradle | 6 +- .../examples/java_example/gradle.properties | 2 - .../gradle/wrapper/gradle-wrapper.properties | 6 - .../android/examples/multicam/build.gradle | 10 +- .../android/examples/playback/build.gradle | 10 +- .../android/examples/processing/build.gradle | 10 +- .../android/examples/recording/build.gradle | 13 +- .../recording/src/main/AndroidManifest.xml | 1 + .../realsense/recording/MainActivity.java | 319 +- .../src/main/res/layout/activity_main.xml | 15 +- .../recording/src/main/res/values/strings.xml | 1 + wrappers/android/examples/sensor/build.gradle | 10 +- .../stream_pipeline_callback/build.gradle | 10 +- wrappers/android/gradle.properties | 1 + wrappers/android/gradlew | 2 + wrappers/android/gradlew.bat | 25 +- wrappers/android/librealsense/build.gradle | 10 +- .../realsense/librealsense/DeviceList.java | 2 +- .../realsense/librealsense/Extension.java | 2 +- .../realsense/librealsense/GLMotionFrame.java | 51 +- .../realsense/librealsense/GLPointsFrame.java | 6 - .../realsense/librealsense/GLRenderer.java | 87 +- .../intel/realsense/librealsense/Option.java | 7 +- .../realsense/librealsense/Pipeline.java | 13 - .../intel/realsense/librealsense/Sensor.java | 11 +- .../realsense/librealsense/StreamFormat.java | 3 +- wrappers/android/openCVLibrary/build.gradle | 23 + wrappers/android/openCVLibrary/lint.xml | 9 + .../src/main/AndroidManifest.xml | 8 + .../opencv/engine/OpenCVEngineInterface.aidl | 33 + .../opencv/android/AsyncServiceHelper.java | 391 + .../opencv/android/BaseLoaderCallback.java | 141 + .../org/opencv/android/Camera2Renderer.java | 302 + .../opencv/android/CameraBridgeViewBase.java | 495 ++ .../opencv/android/CameraGLRendererBase.java | 440 ++ .../opencv/android/CameraGLSurfaceView.java | 119 + .../org/opencv/android/CameraRenderer.java | 166 + .../java/org/opencv/android/FpsMeter.java | 66 + .../android/InstallCallbackInterface.java | 34 + .../org/opencv/android/JavaCameraView.java | 358 + .../android/LoaderCallbackInterface.java | 40 + .../java/org/opencv/android/OpenCVLoader.java | 116 + .../java/org/opencv/android/StaticHelper.java | 104 + .../main/java/org/opencv/android/Utils.java | 139 + .../main/java/org/opencv/calib3d/Calib3d.java | 1506 ++++ .../java/org/opencv/calib3d/StereoBM.java | 330 + .../org/opencv/calib3d/StereoMatcher.java | 253 + .../java/org/opencv/calib3d/StereoSGBM.java | 229 + .../main/java/org/opencv/core/Algorithm.java | 78 + .../src/main/java/org/opencv/core/Core.java | 2638 +++++++ .../java/org/opencv/core/CvException.java | 15 + .../src/main/java/org/opencv/core/CvType.java | 136 + .../src/main/java/org/opencv/core/DMatch.java | 61 + .../main/java/org/opencv/core/KeyPoint.java | 83 + .../src/main/java/org/opencv/core/Mat.java | 1316 ++++ .../main/java/org/opencv/core/MatOfByte.java | 79 + .../java/org/opencv/core/MatOfDMatch.java | 83 + .../java/org/opencv/core/MatOfDouble.java | 79 + .../main/java/org/opencv/core/MatOfFloat.java | 79 + .../java/org/opencv/core/MatOfFloat4.java | 79 + .../java/org/opencv/core/MatOfFloat6.java | 79 + .../main/java/org/opencv/core/MatOfInt.java | 80 + .../main/java/org/opencv/core/MatOfInt4.java | 80 + .../java/org/opencv/core/MatOfKeyPoint.java | 86 + .../main/java/org/opencv/core/MatOfPoint.java | 78 + .../java/org/opencv/core/MatOfPoint2f.java | 78 + .../java/org/opencv/core/MatOfPoint3.java | 79 + .../java/org/opencv/core/MatOfPoint3f.java | 79 + .../main/java/org/opencv/core/MatOfRect.java | 81 + .../src/main/java/org/opencv/core/Point.java | 68 + .../src/main/java/org/opencv/core/Point3.java | 79 + .../src/main/java/org/opencv/core/Range.java | 82 + .../src/main/java/org/opencv/core/Rect.java | 100 + .../java/org/opencv/core/RotatedRect.java | 113 + .../src/main/java/org/opencv/core/Scalar.java | 90 + .../src/main/java/org/opencv/core/Size.java | 69 + .../java/org/opencv/core/TermCriteria.java | 92 + .../main/java/org/opencv/core/TickMeter.java | 180 + .../java/org/opencv/features2d/AKAZE.java | 298 + .../features2d/AgastFeatureDetector.java | 164 + .../java/org/opencv/features2d/BFMatcher.java | 80 + .../features2d/BOWImgDescriptorExtractor.java | 121 + .../opencv/features2d/BOWKMeansTrainer.java | 88 + .../org/opencv/features2d/BOWTrainer.java | 132 + .../java/org/opencv/features2d/BRISK.java | 87 + .../features2d/DescriptorExtractor.java | 195 + .../opencv/features2d/DescriptorMatcher.java | 411 + .../features2d/FastFeatureDetector.java | 164 + .../java/org/opencv/features2d/Feature2D.java | 260 + .../opencv/features2d/FeatureDetector.java | 216 + .../org/opencv/features2d/Features2d.java | 155 + .../opencv/features2d/FlannBasedMatcher.java | 60 + .../org/opencv/features2d/GFTTDetector.java | 257 + .../main/java/org/opencv/features2d/KAZE.java | 264 + .../main/java/org/opencv/features2d/MSER.java | 214 + .../main/java/org/opencv/features2d/ORB.java | 365 + .../java/org/opencv/features2d/Params.java | 670 ++ .../java/org/opencv/imgcodecs/Imgcodecs.java | 215 + .../main/java/org/opencv/imgproc/CLAHE.java | 130 + .../main/java/org/opencv/imgproc/Imgproc.java | 3456 +++++++++ .../opencv/imgproc/LineSegmentDetector.java | 99 + .../main/java/org/opencv/imgproc/Moments.java | 244 + .../java/org/opencv/imgproc/Subdiv2D.java | 403 + .../src/main/java/org/opencv/ml/ANN_MLP.java | 467 ++ .../src/main/java/org/opencv/ml/Boost.java | 152 + .../src/main/java/org/opencv/ml/DTrees.java | 356 + .../src/main/java/org/opencv/ml/EM.java | 311 + .../src/main/java/org/opencv/ml/KNearest.java | 211 + .../org/opencv/ml/LogisticRegression.java | 300 + .../src/main/java/org/opencv/ml/Ml.java | 23 + .../org/opencv/ml/NormalBayesClassifier.java | 70 + .../src/main/java/org/opencv/ml/RTrees.java | 163 + .../src/main/java/org/opencv/ml/SVM.java | 474 ++ .../src/main/java/org/opencv/ml/SVMSGD.java | 316 + .../main/java/org/opencv/ml/StatModel.java | 190 + .../main/java/org/opencv/ml/TrainData.java | 703 ++ .../objdetect/BaseCascadeClassifier.java | 26 + .../opencv/objdetect/CascadeClassifier.java | 263 + .../org/opencv/objdetect/HOGDescriptor.java | 591 ++ .../java/org/opencv/objdetect/Objdetect.java | 52 + .../java/org/opencv/photo/AlignExposures.java | 48 + .../main/java/org/opencv/photo/AlignMTB.java | 219 + .../java/org/opencv/photo/CalibrateCRF.java | 47 + .../org/opencv/photo/CalibrateDebevec.java | 128 + .../org/opencv/photo/CalibrateRobertson.java | 111 + .../java/org/opencv/photo/MergeDebevec.java | 63 + .../java/org/opencv/photo/MergeExposures.java | 47 + .../java/org/opencv/photo/MergeMertens.java | 165 + .../java/org/opencv/photo/MergeRobertson.java | 63 + .../src/main/java/org/opencv/photo/Photo.java | 742 ++ .../main/java/org/opencv/photo/Tonemap.java | 78 + .../java/org/opencv/photo/TonemapDrago.java | 94 + .../java/org/opencv/photo/TonemapDurand.java | 162 + .../java/org/opencv/photo/TonemapMantiuk.java | 94 + .../org/opencv/photo/TonemapReinhard.java | 128 + .../java/org/opencv/utils/Converters.java | 736 ++ .../opencv/video/BackgroundSubtractor.java | 71 + .../opencv/video/BackgroundSubtractorKNN.java | 264 + .../video/BackgroundSubtractorMOG2.java | 434 ++ .../org/opencv/video/DenseOpticalFlow.java | 61 + .../org/opencv/video/DualTVL1OpticalFlow.java | 461 ++ .../opencv/video/FarnebackOpticalFlow.java | 325 + .../java/org/opencv/video/KalmanFilter.java | 455 ++ .../org/opencv/video/SparseOpticalFlow.java | 54 + .../opencv/video/SparsePyrLKOpticalFlow.java | 224 + .../src/main/java/org/opencv/video/Video.java | 289 + .../java/org/opencv/videoio/VideoCapture.java | 293 + .../java/org/opencv/videoio/VideoWriter.java | 202 + .../main/java/org/opencv/videoio/Videoio.java | 575 ++ .../src/main/res/values/attrs.xml | 11 + wrappers/android/settings.gradle | 3 + wrappers/android/tools/camera/build.gradle | 28 +- .../tools/camera/src/main/AndroidManifest.xml | 3 - .../camera/FirmwareUpdateProgressDialog.java | 19 +- .../realsense/camera/PlaybackActivity.java | 25 - .../realsense/camera/PreviewActivity.java | 39 +- .../realsense/camera/RecordingActivity.java | 46 +- .../realsense/camera/SettingsActivity.java | 121 +- .../com/intel/realsense/camera/Streamer.java | 144 +- .../main/res/layout-land/activity_preview.xml | 30 +- .../src/main/res/layout/activity_preview.xml | 27 +- wrappers/csharp/CMakeLists.txt | 2 +- .../Devices/AutoCalibratedDevice.cs | 56 - .../Intel.RealSense/Devices/CMakeLists.txt | 1 - .../Intel.RealSense/Devices/DebugDevice.cs | 33 - .../Intel.RealSense/Devices/ProxyDevice.cs | 22 - .../Intel.RealSense/Frames/FrameQueue.cs | 9 - .../Intel.RealSense/Helpers/ObjectPool.cs | 18 +- .../csharp/Intel.RealSense/NativeMethods.cs | 32 +- .../Intel.RealSense/Processing/CMakeLists.txt | 1 + .../Processing/DepthHuffmanDecoder.cs | 32 + .../Intel.RealSense/Types/Enums/Extension.cs | 2 +- .../Intel.RealSense/Types/Enums/Format.cs | 7 +- .../Intel.RealSense/Types/Enums/Matchers.cs | 4 - .../csharp/tutorial/capture/CMakeLists.txt | 2 +- .../csharp/tutorial/d400-occ/CMakeLists.txt | 2 +- wrappers/csharp/tutorial/depth/CMakeLists.txt | 2 +- wrappers/csharp/tutorial/pose/CMakeLists.txt | 2 +- .../csharp/tutorial/processing/CMakeLists.txt | 2 +- .../tutorial/software-dev/CMakeLists.txt | 2 +- wrappers/dlib/CMakeLists.txt | 2 +- wrappers/matlab/CMakeLists.txt | 8 +- wrappers/matlab/option.m | 4 +- wrappers/nodejs/.eslintrc.json | 24 + wrappers/nodejs/.gitignore | 13 + wrappers/nodejs/.jshintrc | 4 + wrappers/nodejs/CMakeLists.txt | 24 + wrappers/nodejs/README.md | 147 + wrappers/nodejs/binding.gyp | 129 + wrappers/nodejs/doc/jsdoc-template/README.md | 12 + wrappers/nodejs/doc/jsdoc-template/publish.js | 703 ++ .../static/fonts/OpenSans-Bold-webfont.eot | Bin 0 -> 19544 bytes .../static/fonts/OpenSans-Bold-webfont.svg | 1830 +++++ .../static/fonts/OpenSans-Bold-webfont.woff | Bin 0 -> 22432 bytes .../fonts/OpenSans-BoldItalic-webfont.eot | Bin 0 -> 20133 bytes .../fonts/OpenSans-BoldItalic-webfont.svg | 1830 +++++ .../fonts/OpenSans-BoldItalic-webfont.woff | Bin 0 -> 23048 bytes .../static/fonts/OpenSans-Italic-webfont.eot | Bin 0 -> 20265 bytes .../static/fonts/OpenSans-Italic-webfont.svg | 1830 +++++ .../static/fonts/OpenSans-Italic-webfont.woff | Bin 0 -> 23188 bytes .../static/fonts/OpenSans-Light-webfont.eot | Bin 0 -> 19514 bytes .../static/fonts/OpenSans-Light-webfont.svg | 1831 +++++ .../static/fonts/OpenSans-Light-webfont.woff | Bin 0 -> 22248 bytes .../fonts/OpenSans-LightItalic-webfont.eot | Bin 0 -> 20535 bytes .../fonts/OpenSans-LightItalic-webfont.svg | 1835 +++++ .../fonts/OpenSans-LightItalic-webfont.woff | Bin 0 -> 23400 bytes .../static/fonts/OpenSans-Regular-webfont.eot | Bin 0 -> 19836 bytes .../static/fonts/OpenSans-Regular-webfont.svg | 1831 +++++ .../fonts/OpenSans-Regular-webfont.woff | Bin 0 -> 22660 bytes .../static/scripts/linenumber.js | 29 + .../static/scripts/prettify/lang-css.js | 2 + .../static/scripts/prettify/prettify.js | 28 + .../static/styles/jsdoc-default.css | 362 + .../static/styles/prettify-jsdoc.css | 111 + .../static/styles/prettify-tomorrow.css | 132 + .../doc/jsdoc-template/tmpl/augments.tmpl | 10 + .../doc/jsdoc-template/tmpl/container.tmpl | 184 + .../doc/jsdoc-template/tmpl/details.tmpl | 143 + .../doc/jsdoc-template/tmpl/example.tmpl | 2 + .../doc/jsdoc-template/tmpl/examples.tmpl | 13 + .../doc/jsdoc-template/tmpl/exceptions.tmpl | 32 + .../doc/jsdoc-template/tmpl/layout.tmpl | 38 + .../doc/jsdoc-template/tmpl/mainpage.tmpl | 14 + .../doc/jsdoc-template/tmpl/members.tmpl | 38 + .../doc/jsdoc-template/tmpl/method.tmpl | 119 + .../doc/jsdoc-template/tmpl/params.tmpl | 131 + .../doc/jsdoc-template/tmpl/properties.tmpl | 108 + .../doc/jsdoc-template/tmpl/returns.tmpl | 19 + .../doc/jsdoc-template/tmpl/source.tmpl | 8 + .../doc/jsdoc-template/tmpl/tutorial.tmpl | 19 + .../nodejs/doc/jsdoc-template/tmpl/type.tmpl | 7 + wrappers/nodejs/examples/glfw-window.js | 165 + wrappers/nodejs/examples/nodejs-align.js | 124 + wrappers/nodejs/examples/nodejs-capture.js | 43 + wrappers/nodejs/examples/nodejs-pointcloud.js | 51 + .../nodejs/examples/nodejs-save-to-disk.js | 39 + wrappers/nodejs/examples/package-lock.json | 305 + wrappers/nodejs/examples/package.json | 13 + .../nodejs/examples/realsense_viewer/index.js | 404 + .../examples/realsense_viewer/package.json | 16 + .../examples/realsense_viewer/public/app.js | 519 ++ .../realsense_viewer/public/common.js | 164 + .../realsense_viewer/public/index.html | 74 + .../examples/realsense_viewer/public/vue | 6 + .../sensor_control/nodejs-sensor-control.js | 314 + wrappers/nodejs/index.js | 6655 +++++++++++++++++ wrappers/nodejs/package-lock.json | 228 + wrappers/nodejs/package.json | 37 + .../nodejs/scripts/generate-dist-package.js | 50 + wrappers/nodejs/scripts/generate-doc.js | 36 + wrappers/nodejs/scripts/npm_dist/.gitignore | 1 + wrappers/nodejs/scripts/npm_dist/README.md | 107 + wrappers/nodejs/scripts/npm_dist/binding.gyp | 105 + .../nodejs/scripts/npm_dist/build-dist-mac.sh | 33 + .../nodejs/scripts/npm_dist/build-dist.bat | 33 + .../nodejs/scripts/npm_dist/build-dist.sh | 36 + .../scripts/npm_dist/build-librealsense.js | 71 + wrappers/nodejs/scripts/npm_dist/gen-dist.sh | 39 + wrappers/nodejs/src/addon.cpp | 5074 +++++++++++++ wrappers/nodejs/test/README.md | 18 + wrappers/nodejs/test/package.json | 10 + wrappers/nodejs/test/test-align.js | 80 + wrappers/nodejs/test/test-colorizer.js | 92 + wrappers/nodejs/test/test-config.js | 322 + wrappers/nodejs/test/test-context.js | 182 + wrappers/nodejs/test/test-depthframe.js | 195 + wrappers/nodejs/test/test-depthsensor.js | 55 + wrappers/nodejs/test/test-device.js | 137 + wrappers/nodejs/test/test-devicehub.js | 96 + wrappers/nodejs/test/test-devicelist.js | 144 + wrappers/nodejs/test/test-frame.js | 182 + wrappers/nodejs/test/test-frameset.js | 130 + .../nodejs/test/test-functional-online.js | 661 ++ wrappers/nodejs/test/test-functional.js | 909 +++ wrappers/nodejs/test/test-pipeline.js | 272 + wrappers/nodejs/test/test-pipelineprofile.js | 144 + wrappers/nodejs/test/test-playbackdevice.js | 482 ++ wrappers/nodejs/test/test-pointcloud.js | 117 + wrappers/nodejs/test/test-points.js | 227 + wrappers/nodejs/test/test-recorderdevice.js | 375 + .../nodejs/test/test-sensor-extensions.js | 105 + wrappers/nodejs/test/test-sensor.js | 545 ++ wrappers/nodejs/test/test-streamprofile.js | 154 + wrappers/nodejs/test/test-videoframe.js | 187 + .../nodejs/test/test-videostreamprofile.js | 136 + wrappers/nodejs/tools/enums.py | 75 + wrappers/nodejs/tools/linter.js | 78 + wrappers/nodejs/tools/package-lock.json | 1219 +++ wrappers/nodejs/tools/package.json | 22 + wrappers/open3d/CMakeLists.txt | 2 +- wrappers/opencv/CMakeLists.txt | 2 +- .../opencv/latency-tool/latency-detector.h | 2 +- wrappers/openvino/dnn/rs-dnn-vino.cpp | 2 +- wrappers/openvino/face/rs-face-vino.cpp | 2 +- .../openvino/rs-vino/age-gender-detection.cpp | 2 +- wrappers/openvino/rs-vino/base-detection.cpp | 4 +- .../openvino/rs-vino/object-detection.cpp | 2 +- wrappers/openvino/rs-vino/openvino-helpers.h | 2 +- wrappers/pcl/CMakeLists.txt | 4 +- .../pointcloud-stitching/CMakeLists.txt | 24 - .../doc/pointcloud-stitching-demo.md | 208 - .../export_calibratrion.m | 25 - .../pointcloud-stitching/load_intrinsics.m | 3 - .../pointcloud/pointcloud-stitching/readme.md | 8 - .../rs-pointcloud-stitching.cpp | 1232 --- .../rs-pointcloud-stitching.h | 204 - wrappers/python/CMakeLists.txt | 102 +- wrappers/python/c_files.cpp | 11 +- .../examples/auto_calibration_config.json | 8 +- .../depth_auto_calibration_example.py | 317 +- .../python/examples/depth_ucal_example.py | 203 - wrappers/python/examples/net_viewer.py | 73 + .../python-rs400-advanced-mode-example.py | 2 +- wrappers/python/examples/readme.md | 7 +- wrappers/python/examples/t265_example.py | 39 + wrappers/python/examples/t265_rpy.py | 53 + wrappers/python/examples/t265_stereo.py | 265 + .../t265_wheel_odometry.py | 63 + wrappers/python/pybackend.cpp | 5 - wrappers/python/pyrealsense2.cpp | 127 - wrappers/python/pyrs_advanced_mode.cpp | 6 +- wrappers/python/pyrs_context.cpp | 4 +- wrappers/python/pyrs_device.cpp | 128 +- wrappers/python/pyrs_export.cpp | 4 +- wrappers/python/pyrs_frame.cpp | 39 +- wrappers/python/pyrs_internal.cpp | 147 +- wrappers/python/pyrs_net.cpp | 27 + wrappers/python/pyrs_options.cpp | 8 +- wrappers/python/pyrs_pipeline.cpp | 19 +- wrappers/python/pyrs_processing.cpp | 55 +- wrappers/python/pyrs_record_playback.cpp | 4 +- wrappers/python/pyrs_sensor.cpp | 25 +- wrappers/python/pyrs_types.cpp | 4 +- wrappers/python/pyrsutil.cpp | 15 +- wrappers/python/python.cpp | 79 + .../python/{pyrealsense2.h => python.hpp} | 26 +- wrappers/python/readme.md | 29 +- wrappers/python/setup.py | 5 +- wrappers/readme.md | 3 +- .../Source/RealSense/Public/RealSenseTypes.h | 2 - 347 files changed, 69135 insertions(+), 3437 deletions(-) delete mode 100644 wrappers/android/examples/java_example/gradle/wrapper/gradle-wrapper.properties create mode 100644 wrappers/android/openCVLibrary/build.gradle create mode 100644 wrappers/android/openCVLibrary/lint.xml create mode 100644 wrappers/android/openCVLibrary/src/main/AndroidManifest.xml create mode 100644 wrappers/android/openCVLibrary/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/AsyncServiceHelper.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/BaseLoaderCallback.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/Camera2Renderer.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/CameraBridgeViewBase.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/CameraGLRendererBase.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/CameraGLSurfaceView.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/CameraRenderer.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/FpsMeter.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/InstallCallbackInterface.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/JavaCameraView.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/LoaderCallbackInterface.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/OpenCVLoader.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/StaticHelper.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/android/Utils.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/calib3d/Calib3d.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/calib3d/StereoBM.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/calib3d/StereoMatcher.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/calib3d/StereoSGBM.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Algorithm.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Core.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/CvException.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/CvType.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/DMatch.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/KeyPoint.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Mat.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfByte.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfDMatch.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfDouble.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfFloat.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfFloat4.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfFloat6.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfInt.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfInt4.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfKeyPoint.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfPoint.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfPoint2f.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfPoint3.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfPoint3f.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/MatOfRect.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Point.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Point3.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Range.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Rect.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/RotatedRect.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Scalar.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/Size.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/TermCriteria.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/core/TickMeter.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/AKAZE.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/AgastFeatureDetector.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/BFMatcher.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/BOWImgDescriptorExtractor.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/BOWKMeansTrainer.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/BOWTrainer.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/BRISK.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/DescriptorExtractor.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/DescriptorMatcher.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/FastFeatureDetector.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/Feature2D.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/FeatureDetector.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/Features2d.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/FlannBasedMatcher.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/GFTTDetector.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/KAZE.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/MSER.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/ORB.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/features2d/Params.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgcodecs/Imgcodecs.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgproc/CLAHE.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgproc/Imgproc.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgproc/LineSegmentDetector.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgproc/Moments.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/imgproc/Subdiv2D.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/ANN_MLP.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/Boost.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/DTrees.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/EM.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/KNearest.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/LogisticRegression.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/Ml.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/NormalBayesClassifier.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/RTrees.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/SVM.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/SVMSGD.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/StatModel.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/ml/TrainData.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/objdetect/CascadeClassifier.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/objdetect/HOGDescriptor.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/objdetect/Objdetect.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/AlignExposures.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/AlignMTB.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/CalibrateCRF.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/CalibrateDebevec.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/CalibrateRobertson.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/MergeDebevec.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/MergeExposures.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/MergeMertens.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/MergeRobertson.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/Photo.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/Tonemap.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/TonemapDrago.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/TonemapDurand.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/TonemapMantiuk.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/photo/TonemapReinhard.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/utils/Converters.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/BackgroundSubtractor.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/BackgroundSubtractorKNN.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/BackgroundSubtractorMOG2.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/DenseOpticalFlow.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/DualTVL1OpticalFlow.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/FarnebackOpticalFlow.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/KalmanFilter.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/SparseOpticalFlow.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/SparsePyrLKOpticalFlow.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/video/Video.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/videoio/VideoCapture.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/videoio/VideoWriter.java create mode 100644 wrappers/android/openCVLibrary/src/main/java/org/opencv/videoio/Videoio.java create mode 100644 wrappers/android/openCVLibrary/src/main/res/values/attrs.xml delete mode 100644 wrappers/csharp/Intel.RealSense/Devices/ProxyDevice.cs create mode 100644 wrappers/csharp/Intel.RealSense/Processing/DepthHuffmanDecoder.cs create mode 100644 wrappers/nodejs/.eslintrc.json create mode 100644 wrappers/nodejs/.gitignore create mode 100644 wrappers/nodejs/.jshintrc create mode 100644 wrappers/nodejs/CMakeLists.txt create mode 100644 wrappers/nodejs/README.md create mode 100644 wrappers/nodejs/binding.gyp create mode 100644 wrappers/nodejs/doc/jsdoc-template/README.md create mode 100644 wrappers/nodejs/doc/jsdoc-template/publish.js create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Bold-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Bold-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Bold-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Italic-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Italic-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Italic-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Light-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Light-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Light-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Regular-webfont.eot create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Regular-webfont.svg create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/fonts/OpenSans-Regular-webfont.woff create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/scripts/linenumber.js create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/scripts/prettify/lang-css.js create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/scripts/prettify/prettify.js create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/styles/jsdoc-default.css create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/styles/prettify-jsdoc.css create mode 100644 wrappers/nodejs/doc/jsdoc-template/static/styles/prettify-tomorrow.css create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/augments.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/container.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/details.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/example.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/examples.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/exceptions.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/layout.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/mainpage.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/members.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/method.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/params.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/properties.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/returns.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/source.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/tutorial.tmpl create mode 100644 wrappers/nodejs/doc/jsdoc-template/tmpl/type.tmpl create mode 100644 wrappers/nodejs/examples/glfw-window.js create mode 100644 wrappers/nodejs/examples/nodejs-align.js create mode 100644 wrappers/nodejs/examples/nodejs-capture.js create mode 100644 wrappers/nodejs/examples/nodejs-pointcloud.js create mode 100644 wrappers/nodejs/examples/nodejs-save-to-disk.js create mode 100644 wrappers/nodejs/examples/package-lock.json create mode 100644 wrappers/nodejs/examples/package.json create mode 100644 wrappers/nodejs/examples/realsense_viewer/index.js create mode 100644 wrappers/nodejs/examples/realsense_viewer/package.json create mode 100644 wrappers/nodejs/examples/realsense_viewer/public/app.js create mode 100644 wrappers/nodejs/examples/realsense_viewer/public/common.js create mode 100644 wrappers/nodejs/examples/realsense_viewer/public/index.html create mode 100644 wrappers/nodejs/examples/realsense_viewer/public/vue create mode 100644 wrappers/nodejs/examples/sensor_control/nodejs-sensor-control.js create mode 100644 wrappers/nodejs/index.js create mode 100644 wrappers/nodejs/package-lock.json create mode 100644 wrappers/nodejs/package.json create mode 100644 wrappers/nodejs/scripts/generate-dist-package.js create mode 100644 wrappers/nodejs/scripts/generate-doc.js create mode 100644 wrappers/nodejs/scripts/npm_dist/.gitignore create mode 100644 wrappers/nodejs/scripts/npm_dist/README.md create mode 100644 wrappers/nodejs/scripts/npm_dist/binding.gyp create mode 100644 wrappers/nodejs/scripts/npm_dist/build-dist-mac.sh create mode 100644 wrappers/nodejs/scripts/npm_dist/build-dist.bat create mode 100644 wrappers/nodejs/scripts/npm_dist/build-dist.sh create mode 100644 wrappers/nodejs/scripts/npm_dist/build-librealsense.js create mode 100644 wrappers/nodejs/scripts/npm_dist/gen-dist.sh create mode 100644 wrappers/nodejs/src/addon.cpp create mode 100644 wrappers/nodejs/test/README.md create mode 100644 wrappers/nodejs/test/package.json create mode 100644 wrappers/nodejs/test/test-align.js create mode 100644 wrappers/nodejs/test/test-colorizer.js create mode 100644 wrappers/nodejs/test/test-config.js create mode 100644 wrappers/nodejs/test/test-context.js create mode 100644 wrappers/nodejs/test/test-depthframe.js create mode 100644 wrappers/nodejs/test/test-depthsensor.js create mode 100644 wrappers/nodejs/test/test-device.js create mode 100644 wrappers/nodejs/test/test-devicehub.js create mode 100644 wrappers/nodejs/test/test-devicelist.js create mode 100644 wrappers/nodejs/test/test-frame.js create mode 100644 wrappers/nodejs/test/test-frameset.js create mode 100644 wrappers/nodejs/test/test-functional-online.js create mode 100644 wrappers/nodejs/test/test-functional.js create mode 100644 wrappers/nodejs/test/test-pipeline.js create mode 100644 wrappers/nodejs/test/test-pipelineprofile.js create mode 100644 wrappers/nodejs/test/test-playbackdevice.js create mode 100644 wrappers/nodejs/test/test-pointcloud.js create mode 100644 wrappers/nodejs/test/test-points.js create mode 100644 wrappers/nodejs/test/test-recorderdevice.js create mode 100644 wrappers/nodejs/test/test-sensor-extensions.js create mode 100644 wrappers/nodejs/test/test-sensor.js create mode 100644 wrappers/nodejs/test/test-streamprofile.js create mode 100644 wrappers/nodejs/test/test-videoframe.js create mode 100644 wrappers/nodejs/test/test-videostreamprofile.js create mode 100644 wrappers/nodejs/tools/enums.py create mode 100644 wrappers/nodejs/tools/linter.js create mode 100644 wrappers/nodejs/tools/package-lock.json create mode 100644 wrappers/nodejs/tools/package.json delete mode 100644 wrappers/pointcloud/pointcloud-stitching/CMakeLists.txt delete mode 100644 wrappers/pointcloud/pointcloud-stitching/doc/pointcloud-stitching-demo.md delete mode 100644 wrappers/pointcloud/pointcloud-stitching/export_calibratrion.m delete mode 100644 wrappers/pointcloud/pointcloud-stitching/load_intrinsics.m delete mode 100644 wrappers/pointcloud/pointcloud-stitching/readme.md delete mode 100644 wrappers/pointcloud/pointcloud-stitching/rs-pointcloud-stitching.cpp delete mode 100644 wrappers/pointcloud/pointcloud-stitching/rs-pointcloud-stitching.h delete mode 100644 wrappers/python/examples/depth_ucal_example.py create mode 100644 wrappers/python/examples/net_viewer.py create mode 100644 wrappers/python/examples/t265_example.py create mode 100644 wrappers/python/examples/t265_rpy.py create mode 100644 wrappers/python/examples/t265_stereo.py create mode 100644 wrappers/python/examples/t265_wheel_odometry/t265_wheel_odometry.py delete mode 100644 wrappers/python/pyrealsense2.cpp create mode 100644 wrappers/python/pyrs_net.cpp create mode 100644 wrappers/python/python.cpp rename wrappers/python/{pyrealsense2.h => python.hpp} (95%) diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index 4968f13a72..01cd0951bf 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -9,10 +9,13 @@ if (BUILD_PYTHON_BINDINGS OR BUILD_PYTHON_DOCS) if (NOT INTERNET_CONNECTION) message(WARNING "No internet connection. Cloning Python bindings may fail") endif() - add_subdirectory(python) - + add_subdirectory(python) + endif() +if (BUILD_NODEJS_BINDINGS) + add_subdirectory(nodejs) +endif() if (BUILD_CV_EXAMPLES) add_subdirectory(opencv) @@ -62,7 +65,3 @@ endif() if(BUILD_OPENNI2_BINDINGS) add_subdirectory(openni2) endif() - -if(BUILD_PC_STITCHING) - add_subdirectory(pointcloud/pointcloud-stitching) -endif() diff --git a/wrappers/android/examples/capture/build.gradle b/wrappers/android/examples/capture/build.gradle index b8b54f9100..166e7fba02 100644 --- a/wrappers/android/examples/capture/build.gradle +++ b/wrappers/android/examples/capture/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 28 defaultConfig { applicationId "com.intel.realsense.capture" - minSdkVersion 19 - targetSdkVersion 30 + minSdkVersion 26 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' @@ -16,12 +16,19 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + buildToolsVersion '27.0.3' + ndkVersion '21.0.6113669' } dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation project(path: ':openCVLibrary') testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' diff --git a/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java b/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java index 60afef6424..0dd11f915c 100644 --- a/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java +++ b/wrappers/android/examples/capture/src/main/java/com/intel/realsense/capture/MainActivity.java @@ -3,6 +3,7 @@ import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; +import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; import androidx.core.app.ActivityCompat; @@ -10,22 +11,51 @@ import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import android.view.View; +import android.widget.Button; import android.widget.TextView; +import com.intel.realsense.librealsense.Align; import com.intel.realsense.librealsense.Colorizer; import com.intel.realsense.librealsense.Config; +import com.intel.realsense.librealsense.DepthFrame; import com.intel.realsense.librealsense.DeviceList; import com.intel.realsense.librealsense.DeviceListener; +import com.intel.realsense.librealsense.Extension; +import com.intel.realsense.librealsense.Frame; +import com.intel.realsense.librealsense.FrameReleaser; import com.intel.realsense.librealsense.FrameSet; import com.intel.realsense.librealsense.GLRsSurfaceView; import com.intel.realsense.librealsense.Pipeline; import com.intel.realsense.librealsense.PipelineProfile; import com.intel.realsense.librealsense.RsContext; import com.intel.realsense.librealsense.StreamType; +import com.intel.realsense.librealsense.VideoFrame; + +import org.opencv.android.OpenCVLoader; +import org.opencv.core.CvType; +import org.opencv.core.Mat; + +import java.io.File; +import java.io.FileOutputStream; +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.Date; public class MainActivity extends AppCompatActivity { + + static { + if(!OpenCVLoader.initDebug()) + { + Log.d("opencv","初始化失败"); + } + } + private static final String TAG = "librs capture example"; private static final int PERMISSIONS_REQUEST_CAMERA = 0; + private static final int PERMISSIONS_REQUEST_WRITE = 1; private boolean mPermissionsGranted = false; @@ -47,12 +77,22 @@ protected void onCreate(Bundle savedInstanceState) { mAppContext = getApplicationContext(); mBackGroundText = findViewById(R.id.connectCameraText); mGLSurfaceView = findViewById(R.id.glSurfaceView); + + Button button1 = (Button) findViewById(R.id.startRecordFab); + button1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + toggleRecording(); + } + }); + mGLSurfaceView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); + // Android 9 also requires camera permissions if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.O && @@ -61,6 +101,11 @@ protected void onCreate(Bundle savedInstanceState) { return; } + if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); + return; + } + mPermissionsGranted = true; } @@ -73,9 +118,15 @@ protected void onDestroy() { @Override public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) { if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { - ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSIONS_REQUEST_CAMERA); + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, PERMISSIONS_REQUEST_WRITE); + return; + } + + if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 0); return; } + mPermissionsGranted = true; } @@ -144,10 +195,9 @@ public void onDeviceDetach() { @Override public void run() { try { - try(FrameSet frames = mPipeline.waitForFrames()) { - try(FrameSet processed = frames.applyFilter(mColorizer)) { - mGLSurfaceView.upload(processed); - } + try(FrameReleaser fr = new FrameReleaser()) { + FrameSet framesProcessed = mPipeline.waitForFrames().releaseWith(fr); + mGLSurfaceView.upload(framesProcessed); } mHandler.post(mStreaming); } @@ -196,4 +246,85 @@ private synchronized void stop() { Log.d(TAG, "failed to stop streaming"); } } + + public void toggleRecording() { + try (FrameReleaser fr = new FrameReleaser()) { + try (FrameSet frames = mPipeline.waitForFrames().releaseWith(fr)) { +// Frame depth = frames.first(StreamType.DEPTH).releaseWith(fr); +// DepthFrame depthFrame = depth.as(Extension.DEPTH_FRAME); +// depthFrame.releaseWith(fr); + // saving raw depth data +// Mat mDepth = new Mat(depthFrame.getHeight(), depthFrame.getWidth(), CvType.CV_16UC1); +// int size = (int) (mDepth.total() * mDepth.elemSize()); +// byte[] return_buff_depth = new byte[size]; +// depthFrame.getData(return_buff_depth); +// short[] shorts = new short[size / 2]; +// ByteBuffer.wrap(return_buff_depth).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().get(shorts); +// mDepth.put(0, 0, shorts); + Align align = new Align(StreamType.COLOR); + String folderPath = "/storage/emulated/0/graduateDesign/"; + String profile = "lhh"; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); + String currentDateAndTime = sdf.format(new Date()); + + //Path path = Paths.get(folderPath, String.format("%spixelDepthData%s.npy", profile, currentDateAndTime)); + //NpyFile.write(path, shorts); + // applying Colorizer + try (FrameSet processed = frames.applyFilter(align).releaseWith(fr).applyFilter(mColorizer).releaseWith(fr)) { + Frame depthColored = processed.first(StreamType.DEPTH).releaseWith(fr); + DepthFrame depthColorFrame = depthColored.as(Extension.DEPTH_FRAME); + depthColorFrame.releaseWith(fr); + Frame color = processed.first(StreamType.COLOR).releaseWith(fr); + VideoFrame colorFrame = color.as(Extension.VIDEO_FRAME); + colorFrame.releaseWith(fr); + + // capturing color image + Mat mRGB = new Mat(colorFrame.getHeight(), colorFrame.getWidth(), CvType.CV_8UC3); + byte[] return_buff = new byte[colorFrame.getDataSize()]; + colorFrame.getData(return_buff); + mRGB.put(0, 0, return_buff); + + Bitmap bmp = Bitmap.createBitmap(mRGB.cols(), mRGB.rows(), Bitmap.Config.ARGB_8888); + org.opencv.android.Utils.matToBitmap(mRGB, bmp); + + File imgFile = new File(folderPath, profile + "colorFrame-" + currentDateAndTime + ".jpg"); + try { + FileOutputStream out2 = new FileOutputStream(imgFile); + bmp.compress(Bitmap.CompressFormat.JPEG, 100, out2); + out2.flush(); + out2.close(); + } catch (Exception e) { + e.printStackTrace(); + } + + // capturing colorized depth image + Mat mDepthColorized = new Mat(depthColorFrame.getHeight(), depthColorFrame.getWidth(), CvType.CV_8UC3); + byte[] return_buff_DepthColor = new byte[depthColorFrame.getDataSize()]; + depthColorFrame.getData(return_buff_DepthColor); + mDepthColorized.put(0, 0, return_buff_DepthColor); + + Bitmap bmpDepthColor = Bitmap.createBitmap(mDepthColorized.cols(), mDepthColorized.rows(), Bitmap.Config.ARGB_8888); + org.opencv.android.Utils.matToBitmap(mDepthColorized, bmpDepthColor); + + File imgFileDepthColor = new File(folderPath, profile + "depthFrame-" + currentDateAndTime + ".jpg"); + try { + FileOutputStream out3 = new FileOutputStream(imgFileDepthColor); + bmpDepthColor.compress(Bitmap.CompressFormat.JPEG, 100, out3); + out3.flush(); + out3.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + diff --git a/wrappers/android/examples/capture/src/main/res/layout/activity_main.xml b/wrappers/android/examples/capture/src/main/res/layout/activity_main.xml index b03e9ca254..983b6a8b93 100644 --- a/wrappers/android/examples/capture/src/main/res/layout/activity_main.xml +++ b/wrappers/android/examples/capture/src/main/res/layout/activity_main.xml @@ -3,13 +3,14 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/black" android:orientation="horizontal"> + android:layout_height="match_parent" /> +