書籍「KINECT for Windows SDKプログラミング Kinect for Windows v2センサー対応版」では執筆当時(2015/5/21)の最新バージョンの開発環境を用いていますが、現在(2016/9/14)は執筆当時より新しいバージョンの開発環境がリリースされており、そちらを利用したい開発者もいると思います。
このドキュメントでは、サンプルプログラムを新しいバージョンの開発環境で動作させるための方法を解説します。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pcd_writer License | |
The MIT License | |
Copyright (c) 2017 Tsukasa SUGIURA | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// kinect2_serialization | |
// | |
// kinect2_serialization is definitions of Boost.Serialization (XML) for body data that retrieved using Kinect SDK v2. | |
// You will be able to serialize and deserialize body data using this definitions. | |
// kinect2_serialization are requires Boost.Serialization and Kinect SDK v2 when serializing data. | |
// kinect2_serialization are requires only Boost.Serialization when deserialize data. | |
// | |
// This source code is licensed under the MIT license. Please see the License in License.txt. | |
// Copyright (c) 2017 Tsukasa SUGIURA | |
// t.sugiura0204@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve Body Frame | |
ComPtr<IBodyFrame> bodyFrame; | |
const HRESULT ret = bodyFrameReader->AcquireLatestFrame( &bodyFrame ); | |
if( FAILED( ret ) ){ | |
return; | |
} | |
// Retrieve Body Data | |
std::vector<ComPtr<IBody>> bodies( BODY_COUNT ); | |
ERROR_CHECK( bodyFrame->GetAndRefreshBodyData( static_cast<UINT>( bodies.size() ), &bodies[0] ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <opencv2/opencv.hpp> | |
#include <opencv2/face.hpp> | |
int main( int argc, char* argv[] ) | |
{ | |
// Read Image | |
cv::Mat image = cv::imread( "image.jpg", cv::IMREAD_GRAYSCALE ); |
-
OpenCV Advent Calendar 2017 https://qiita.com/advent-calendar/2017/opencv
-
C++ Advent Calendar 2017 https://qiita.com/advent-calendar/2017/cpp
-
初心者C++er Advent Calendar 2017 https://qiita.com/advent-calendar/2017/syoshinsya-cpper
-
Visual Studio Advent Calendar 2017 https://qiita.com/advent-calendar/2017/vs
-
Visual Studio Code Advent Calendar 2017 https://qiita.com/advent-calendar/2017/vscode
-
数学とコンピュータ Advent Calendar 2017 https://qiita.com/advent-calendar/2017/math-and-computer
-
数学とコンピュータⅡ Advent Calendar 2017 https://qiita.com/advent-calendar/2017/math-and-computer2
-
ROS Advent Calendar 2017 https://qiita.com/advent-calendar/2017/ros
-
TensorFlow Advent Calendar 2017 https://qiita.com/advent-calendar/2017/tensorflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable Error C4996 that occur when using Boost.Signals2. | |
#ifdef _DEBUG | |
#define _SCL_SECURE_NO_WARNINGS | |
#endif | |
#include "kinect2_grabber.h" | |
#include <pcl/visualization/pcl_visualizer.h> | |
template <typename PointType> | |
class Viewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<ImportGroup Label="PropertySheets"/> | |
<!-- Debug|Win32 --> | |
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
</PropertyGroup> | |
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
<ClCompile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrieve Focal Length | |
rs2::video_stream_profile profile = pipeline_profile.get_stream( rs2_stream::RS2_STREAM_DEPTH ).as<rs2::video_stream_profile>(); | |
const float focal_length = profile.get_intrinsics().fx; | |
// Retriece Base Line | |
const float baseline = disparity_frame.as<rs2::disparity_frame>().get_baseline(); | |
// Target Pixel (e.g. Center of Image) | |
const uint32_t x = disparity_width / 2; | |
const uint32_t y = disparity_height / 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Retrrieve Flame | |
rs2::video_frame color_frame = frameset.get_color_frame(); | |
// Retrieve Flame Size | |
const uint32_t color_width = color_frame.as<rs2::video_frame>().get_width(); | |
const uint32_t color_height = color_frame.as<rs2::video_frame>().get_height(); | |
// Retrive Data | |
const uint8_t* color_data = reinterpret_cast<const uint8_t*>( color_frame.get_data() ); |