<commit_before>// This program is handling intel realsense  R200 with infrared image.
// Note. This program surely is used on R200.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <librealsense/rs.hpp>
#include <boost/filesystem.hpp>


int main() try
{
    // Create a context object. This object owns the handles to all connected realsense devices.
    rs::context ctx;
    std::cout << "There are " << ctx.get_device_count() << " connected RealSense device.\n" << std::endl;
    if(ctx.get_device_count() == 0)
    {
      return EXIT_FAILURE;
    }


    // This tutorial will access only a single device, but it is trivial to extend to multiple devices
    rs::device * dev = ctx.get_device(0);
    float depth_scale = dev->get_depth_scale();
    std::cout << "\nUsing device 0, an " << dev->get_name() << std::endl;
    std::cout << "Serial number: " << dev->get_serial() << std::endl;
    std::cout << "Firmware version: " << dev->get_firmware_version() << std::endl;
    std::cout << "Depth scale : " << depth_scale << std::endl;


    // Configure depth to run at VGA resolution at 60 frames per second
    dev->enable_stream(rs::stream::color, 640, 480, rs::format::bgr8, 60);
    dev->start();


    // Make folders for saving current image
    int image_counter = 0;
    std::string image_file_name;
    std::string folder_name = "images/";
    std::string folder_create_command = "mkdir -p " + folder_name;
    system(folder_create_command.c_str());


    while(true)
    {
        dev->wait_for_frames();
        // Get color frame and Change the format to Mat files
        const void * color_frame = dev->get_frame_data(rs::stream::color);
        cv::Mat color(480, 640, CV_8UC3, (void*)color_frame);


        // change current image file name
        char image_index[255];
        sprintf(image_index, "%010d.png", image_counter);
        image_file_name = folder_name + image_index;
        std::cout << image_file_name << std::endl;
        image_counter++;


        // update and save the current image
        cv::imshow("color", color);
        cv::waitKey(1);
        cv::imwrite(image_file_name, color);
   }


   return EXIT_SUCCESS;
}


catch(const rs::error & e)
{
    // Method calls against librealsense objects may throw exceptions of type rs::error
    std::cout << "rs::error was thrown when calling " << e.get_failed_function().c_str() << "(" << e.get_failed_args().c_str() << ")" << std::endl;
    std::cout << e.what() << std::endl;
    return EXIT_FAILURE;
}

<commit_msg>save rectified_color stream (undistorted images).<commit_after>// This program is handling intel realsense  R200 with infrared image.
// Note. This program surely is used on R200.

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <librealsense/rs.hpp>
#include <boost/filesystem.hpp>


int main() try
{
    // Create a context object. This object owns the handles to all connected realsense devices.
    rs::context ctx;
    std::cout << "There are " << ctx.get_device_count() << " connected RealSense device.\n" << std::endl;
    if(ctx.get_device_count() == 0)
    {
      return EXIT_FAILURE;
    }


    // This tutorial will access only a single device, but it is trivial to extend to multiple devices
    rs::device * dev = ctx.get_device(0);
    float depth_scale = dev->get_depth_scale();
    std::cout << "\nUsing device 0, an " << dev->get_name() << std::endl;
    std::cout << "Serial number: " << dev->get_serial() << std::endl;
    std::cout << "Firmware version: " << dev->get_firmware_version() << std::endl;
    std::cout << "Depth scale : " << depth_scale << std::endl;


    // Configure depth to run at VGA resolution at 60 frames per second
    dev->enable_stream(rs::stream::color, 640, 480, rs::format::bgr8, 60);
    dev->start();


    // Make folders for saving current image
    int image_counter = 0;
    std::string image_file_name;
    std::string folder_name = "images/";
    std::string folder_create_command = "mkdir -p " + folder_name;
    system(folder_create_command.c_str());


    while(true)
    {
        dev->wait_for_frames();
        // Get color frame and Change the format to Mat files
        const void * color_frame = dev->get_frame_data(rs::stream::rectified_color);
        cv::Mat color(480, 640, CV_8UC3, (void*)color_frame);


        // change current image file name
        char image_index[255];
        sprintf(image_index, "%010d.png", image_counter);
        image_file_name = folder_name + image_index;
        std::cout << image_file_name << std::endl;
        image_counter++;


        // update and save the current image
        cv::imshow("color", color);
        cv::waitKey(1);
        cv::imwrite(image_file_name, color);
   }


   return EXIT_SUCCESS;
}


catch(const rs::error & e)
{
    // Method calls against librealsense objects may throw exceptions of type rs::error
    std::cout << "rs::error was thrown when calling " << e.get_failed_function().c_str() << "(" << e.get_failed_args().c_str() << ")" << std::endl;
    std::cout << e.what() << std::endl;
    return EXIT_FAILURE;
}


{'fraction_non_alphanumeric': 0.14113827349121466, 'fraction_numerical': 0.014896867838044309, 'mean_word_length': 3.285597381342062, 'pattern_counts': {'":': 0, '<': 119, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5392658', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1643, 'n_words': 452}