英特尔 RealSense D415 + OpenCV 4.0 + VS2017 配置方法
首先是Opencv 4.0 +VS2017的配置過程,網上已經有很多類似教程,這里不再累贅:https://www.cnblogs.com/xinxue/p/5766756.html
?
接下來開始配置D415的SDK,SDK可以在官方Guihub上下載:https://github.com/IntelRealSense/librealsense/releases
選擇其一選擇安裝即可
鑒于外網的網速感人,或者百度云下載:https://pan.baidu.com/s/1QwJzIsNNcDWay0e93Iqu7A ?提取碼:wtn9?
?
?
下載完后打開看到如下界面
一路Next一下即可完成安裝,完成后桌面會出現3個圖標
Examples for Intel RealSense SDK 2.0:可開發SDK解決方案,打開可以直接調用官方例程,但是這樣并不方便實際開發
Intel RealSense Viewer和Depth Quality Tool for Intel RealSense Cameras都是攝像頭的調試工具,打開可以直接調出深度和RGB圖像
如果出現類似提示,直接確認就行了
?
?
?
配置全局的RealSense SDK 2.0,此處的方法和配置OpenCV類似:
我的電腦>>屬性>>高級系統設置>>高級>>環境變量>>系統變量>>編輯、新建Path的值
要注意電腦是64位還是32位的操作系統。
?
打開VS2017,新建一個工程,打開 屬性管理器?
?
根據當前不同編譯方式選擇修改不同屬性的設置
?
VC++目錄>>包含目錄
?
VC++目錄>>庫目錄
一樣需要注意操作系統的位數
?
鏈接器>>輸入>>添加依賴項
?
至此基本上已經完畢,附上一個測試程序:
// License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2017 Intel Corporation. All Rights Reserved.#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API #include <opencv2/opencv.hpp> // Include OpenCV APIint main(int argc, char * argv[]) try {// Declare depth colorizer for pretty visualization of depth datars2::colorizer color_map;// Declare RealSense pipeline, encapsulating the actual device and sensorsrs2::pipeline pipe;// Start streaming with default recommended configurationpipe.start();using namespace cv;const auto window_name = "Display Image";namedWindow(window_name, WINDOW_AUTOSIZE);while (waitKey(1) < 0 ){rs2::frameset data = pipe.wait_for_frames(); // Wait for next set of frames from the camerars2::frame depth = data.get_depth_frame().apply_filter(color_map);// Query frame size (width and height)const int w = depth.as<rs2::video_frame>().get_width();const int h = depth.as<rs2::video_frame>().get_height();// Create OpenCV matrix of size (w,h) from the colorized depth dataMat image(Size(w, h), CV_8UC3, (void*)depth.get_data(), Mat::AUTO_STEP);// Update the window with new dataimshow(window_name, image);}return EXIT_SUCCESS; } catch (const rs2::error & e) {std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;return EXIT_FAILURE; } catch (const std::exception& e) {std::cerr << e.what() << std::endl;return EXIT_FAILURE; }?
運行測試:(左/右下角畫面的不正常是因為此處距離攝像頭低于最低檢測距離)
?
總結
以上是生活随笔為你收集整理的英特尔 RealSense D415 + OpenCV 4.0 + VS2017 配置方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 地震模拟在计算机,地震模拟计算机,sei
- 下一篇: 战地五自定义服务器在哪里,《战地5》推出