2020年1月8日学习小结---Intel RealSense SR300官方例子学习

2020年1月8日个人小结

    • 今日感悟
    • 今日所学
      • Examples for Intel RealSense SDK 2.0
    • 明日规划

今日感悟

今天去了一趟老师的公司,感触很深,收获颇丰。在所做课题“点云数据采集”上有了更明确的方向,对开源项目的门道也知晓了个大概,更重要的是对未来的学习方法以及选取工作类型的态度也有了转变------不要一直干拧螺丝类的重复性工作,因为你随时可以被替换掉,职业发展方向要偏向于具体某一个点,在这一点上做无可替代的工作。在此由衷的感谢赵岚老师给我机会见见世面,还感谢陆博士耐心为我解答问题,虽然部分技术点听得一知半解,但还是开拓了我的思路。

今日所学

在这里插入图片描述
仔细想想今天具体学习的东西真的不多啊,只是部署了下intel realsence sr300的工作环境以及粗略学习了下官方给出的例子代码,大部分时间用于下载了,不得不说这intel官网上下东西真的是太慢啦!!!不能忍,以防万一,我已将intel realsence SR300驱动+SDK上传至我的网盘,防止下次需要时再从官网上下,顺便给我们课题组里其他同学做个预留,当然了,数据采集这块貌似只有我需要用,他们可能都不需要。

Examples for Intel RealSense SDK 2.0

官方给的例子很多,其中的注释也很全面,赞!
贴几个看不太明白的

// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
#include 
#include 
#include 

int main(int argc, char * argv[]) try
{
     
    // Declare RealSense pipeline, encapsulating the actual device and sensors
    rs2::pipeline pipe;
    // Create a configuration for configuring the pipeline with a non default profile
    rs2::config cfg;
    // Add pose stream
    cfg.enable_stream(RS2_STREAM_POSE, RS2_FORMAT_6DOF);
    // Start pipeline with chosen configuration
    pipe.start(cfg);

    // Main loop
    while (true)
    {
     
        // Wait for the next set of frames from the camera
        auto frames = pipe.wait_for_frames();
        // Get a frame from the pose stream
        auto f = frames.first_or_default(RS2_STREAM_POSE);
        // Cast the frame to pose_frame and get its data
        auto pose_data = f.as<rs2::pose_frame>().get_pose_data();

        // Print the x, y, z values of the translation, relative to initial position
        std::cout << "\r" << "Device Position: " << std::setprecision(3) << std::fixed << pose_data.translation.x << " " <<
            pose_data.translation.y << " " << pose_data.translation.z << " (meters)";
    }

    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;
}

还有这个

// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.

#include  // Include RealSense Cross Platform API
#include 
#include 
#include 
#include 
#include 

// The callback example demonstrates asynchronous usage of the pipeline
int main(int argc, char * argv[]) try
{
     
    //rs2::log_to_console(RS2_LOG_SEVERITY_ERROR);

    std::map<int, int> counters;
    std::map<int, std::string> stream_names;
    std::mutex mutex;

    // Define frame callback
    // The callback is executed on a sensor thread and can be called simultaneously from multiple sensors
    // Therefore any modification to common memory should be done under lock
    auto callback = [&](const rs2::frame& frame)
    {
     
        std::lock_guard<std::mutex> lock(mutex);
        if (rs2::frameset fs = frame.as<rs2::frameset>())
        {
     
            // With callbacks, all synchronized stream will arrive in a single frameset
            for (const rs2::frame& f : fs)
                counters[f.get_profile().unique_id()]++;
        }
        else
        {
     
            // Stream that bypass synchronization (such as IMU) will produce single frames
            counters[frame.get_profile().unique_id()]++;
        }
    };

    // Declare RealSense pipeline, encapsulating the actual device and sensors.
    rs2::pipeline pipe;

    // Start streaming through the callback with default recommended configuration
    // The default video configuration contains Depth and Color streams
    // If a device is capable to stream IMU data, both Gyro and Accelerometer are enabled by default
    //
    rs2::pipeline_profile profiles = pipe.start(callback);

    // Collect the enabled streams names
    for (auto p : profiles.get_streams())
        stream_names[p.unique_id()] = p.stream_name();

    std::cout << "RealSense callback sample" << std::endl << std::endl;

    while (true)
    {
     
        std::this_thread::sleep_for(std::chrono::seconds(1));

        std::lock_guard<std::mutex> lock(mutex);

        std::cout << "\r";
        for (auto p : counters)
        {
     
            std::cout << stream_names[p.first] << "[" << p.first << "]: " << p.second << " [frames] || ";
        }
    }

    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;
}

留着明后天慢慢查资料学习

明日规划

明天上完JAVA的课后把上课所学先复习着敲一下,完成后学习如何利用realsence sr300弄出来点云图(PCB格式)并保存,再利用之前vs2015结合qt做的pcb查看器看看导出的数据如何

PS:
十一点了,防秃早睡!

你可能感兴趣的:(好像没干啥)