2 ColorSpace DepthSpace CameraSpace Kinect V2 Kinect V2 BOdyIndex 3. NtKinect Kinect V2 C++ NtKinect [4] NtKinect = Kinect SDK + + STL(C++) + OpenCV +

Similar documents
OpenCV IS Report No Report Medical Information System Labratry

,,,,., C Java,,.,,.,., ,,.,, i

平成 29 年度卒業研究 初心者のためのゲームプログラミング用 教材の開発 函館工業高等専門学校生産システム工学科情報コース 5 年 25 番細見政央指導教員東海林智也

2006 [3] Scratch Squeak PEN [4] PenFlowchart 2 3 PenFlowchart 4 PenFlowchart PEN xdncl PEN [5] PEN xdncl DNCL 1 1 [6] 1 PEN Fig. 1 The PEN

解きながら学ぶC++入門編

新・明解Java入門

Java演習(4) -- 変数と型 --

IPSJ SIG Technical Report Secret Tap Secret Tap Secret Flick 1 An Examination of Icon-based User Authentication Method Using Flick Input for

1 Web [2] Web [3] [4] [5], [6] [7] [8] S.W. [9] 3. MeetingShelf Web MeetingShelf MeetingShelf (1) (2) (3) (4) (5) Web MeetingShelf

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

28 Docker Design and Implementation of Program Evaluation System Using Docker Virtualized Environment

WikiWeb Wiki Web Wiki 2. Wiki 1 STAR WARS [3] Wiki Wiki Wiki 2 3 Wiki 5W1H Wiki Web 2.2 5W1H 5W1H 5W1H 5W1H 5W1H 5W1H 5W1H 2.3 Wiki 2015 Informa

& Vol.5 No (Oct. 2015) TV 1,2,a) , Augmented TV TV AR Augmented Reality 3DCG TV Estimation of TV Screen Position and Ro

IPSJ SIG Technical Report Vol.2009-HCI-134 No /7/17 1. RDB Wiki Wiki RDB SQL Wiki Wiki RDB Wiki RDB Wiki A Wiki System Enhanced by Visibl

1 C STL(1) C C C libc C C C++ STL(Standard Template Library ) libc libc C++ C STL libc STL iostream Algorithm libc STL string vector l


: : : TSTank 2

Microsoft Word - DT-5100Lib_Manual_DotNet.doc

2

. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr


3_23.dvi

Vol.55 No (Jan. 2014) saccess 6 saccess 7 saccess 2. [3] p.33 * B (A) (B) (C) (D) (E) (F) *1 [3], [4] Web PDF a m

IPSJ SIG Technical Report Vol.2012-IS-119 No /3/ Web A Multi-story e-picture Book with the Degree-of-interest Extraction Function

‚æ4›ñ

,,,, : - i -

( ) [1] [4] ( ) 2. [5] [6] Piano Tutor[7] [1], [2], [8], [9] Radiobaton[10] Two Finger Piano[11] Coloring-in Piano[12] ism[13] MIDI MIDI 1 Fig. 1 Syst

Table 1 Table 2

SuperH RISC engine C/C++ コンパイラ Ver.7 不具合内容 - 過去のお知らせ SuperH RISC engine C/C++ コンパイラ Ver.7 台における不具合内容を以下に示します のチェックツールをルネサスエレクトロニクス株式会社のホームページ

とても使いやすい Boost の serialization

IPSJ SIG Technical Report Vol.2014-CE-126 No /10/11 1,a) Kinect Support System for Romaji Learning through Exercise Abstract: Educatio

IPSJ SIG Technical Report Vol.2014-EIP-63 No /2/21 1,a) Wi-Fi Probe Request MAC MAC Probe Request MAC A dynamic ads control based on tra

Web Web Web Web Web, i

2011 Future University Hakodate 2011 System Information Science Practice Group Report Project Name Visualization of Code-Breaking Group Name Implemati

VB.NETコーディング標準

slide5.pptx

1,a) 1,b) TUBSTAP TUBSTAP Offering New Benchmark Maps for Turn Based Strategy Game Tomihiro Kimura 1,a) Kokolo Ikeda 1,b) Abstract: Tsume-shogi and Ts

cpp1.dvi

TestDesign for Web

Condition DAQ condition condition 2 3 XML key value

HIS-CCBASEver2

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

(STL) STL 1 (deta structure) (algorithm) (deta structure) 2 STL STL (Standard Template Library) 2.1 STL STL ( ) vector<int> x; for(int i = 0; i < 10;

<95DB8C9288E397C389C88A E696E6462>

学校では教えてくれないアセットバンドル

2

IPSJ SIG Technical Report Vol.2013-GN-86 No.35 Vol.2013-CDS-6 No /1/17 1,a) 2,b) (1) (2) (3) Development of Mobile Multilingual Medical



double float

CX-Checker CX-Checker (1)XPath (2)DOM (3) 3 XPath CX-Checker. MISRA-C 62%(79/127) SQMlint 76%(13/17) XPath CX-Checker 3. CX-Checker 4., MISRA-C CX- Ch

1.3 ( ) ( ) C

Smalltalk_

1 Fig. 1 Extraction of motion,.,,, 4,,, 3., 1, 2. 2.,. CHLAC,. 2.1,. (256 ).,., CHLAC. CHLAC, HLAC. 2.3 (HLAC ) r,.,. HLAC. N. 2 HLAC Fig. 2

[2] OCR [3], [4] [5] [6] [4], [7] [8], [9] 1 [10] Fig. 1 Current arrangement and size of ruby. 2 Fig. 2 Typography combined with printing

8 if switch for while do while 2

Java プログラミング Ⅰ 3 回目変 数 今日の講義講義で学ぶ内容 変数とは 変数の使い方 キーボード入力の仕方 変 数 変 数 一時的に値を記憶させておく機能 変数は 型 ( データ型 ) と識別子をもちます 2 型 ( データ型 ) 変数に記憶する値の種類変数の型は 記憶できる値の種類と範囲

新版明解C言語 実践編

2016 VOCALOID Group, Yamaha Corporation 2

Vol.53 No (Mar. 2012) 1, 1,a) 1, 2 1 1, , Musical Interaction System Based on Stage Metaphor Seiko Myojin 1, 1,a

オブジェクト脳のつくり方

2) TA Hercules CAA 5 [6], [7] CAA BOSS [8] 2. C II C. ( 1 ) C. ( 2 ). ( 3 ) 100. ( 4 ) () HTML NFS Hercules ( )

17 Proposal of an Algorithm of Image Extraction and Research on Improvement of a Man-machine Interface of Food Intake Measuring System

しずおかアプリ部 Unity はじめるよ すごいよサウンド機能 実践編 統合開発環境を内蔵したゲームエンジン いろんな職業の が る資料なので説明を簡単にしてある部分があります 正確には本来の意味と違いますが上記理由のためです ご了承ください この

, : GUI Web Java 2.1 GUI GUI GUI 2 y = x y = x y = x

CashDrawer ライブラリ API 仕様書 2014/07/09 CashDrawer ライブラリ API 仕様書 Rev / 10

WinHPC ppt

untitled


r07.dvi

PC Windows 95, Windows 98, Windows NT, Windows 2000, MS-DOS, UNIX CPU

Vol.54 No (July 2013) [9] [10] [11] [12], [13] 1 Fig. 1 Flowchart of the proposed system. c 2013 Information

ohp07.dvi

IPSJ SIG Technical Report Vol.2015-MUS-107 No /5/23 HARK-Binaural Raspberry Pi 2 1,a) ( ) HARK 2 HARK-Binaural A/D Raspberry Pi 2 1.

解きながら学ぶJava入門編

計量国語学 アーカイブ ID KK 種別 特集 招待論文 A タイトル Webコーパスの概念と種類, 利用価値 語史研究の情報源としてのWebコーパス Title The Concept, Types and Utility of Web Corpora: Web Corpora as


2

7,, i

C のコード例 (Z80 と同機能 ) int main(void) { int i,sum=0; for (i=1; i<=10; i++) sum=sum + i; printf ("sum=%d n",sum); 2

デジタル表現論・第6回

GPGPU

JavaプログラミングⅠ

Prog1_6th

AcVBA

K227 Java 2

基礎計算機演習 実習課題No6

100 SDAM SDAM Windows2000/XP 4) SDAM TIN ESDA K G G GWR SDAM GUI

日本感性工学会論文誌

SNS GIS Abstract The Tourism-based Country Promotion Basic Act was enacted in Japan over a decade ago. Tourism is expected to be the primary contribut

橡最新卒論

design_pattern.key

r03.dvi

IPSJ SIG Technical Report Vol.2014-CE-127 No /12/7 1,a) 2,3 2,3 3 Development of the ethological recording application for the understanding of

AP_12_15_yonezawa.indd

C による数値計算法入門 ( 第 2 版 ) 新装版 サンプルページ この本の定価 判型などは, 以下の URL からご覧いただけます. このサンプルページの内容は, 新装版 1 刷発行時のものです.

JEB Plugin 開発チュートリアル 第4回

Android Layout SDK プログラミング マニュアル

Exam : 1z1-809-JPN Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z1-809-JPN Exam's Question and Answers 1 from Ac

Transcription:

NtKinect: C++ Class Library for Kinect V2 1,a) Kinect for Windows V2 C++ NtKinect NtKinect DLL Kinect V2 Kinect V2, C++, DLL, Unity NtKinect: C++ Class Library for Kinect V2 Nitta Yoshihisa 1,a) Abstract: Kinect for Windows V2 is a device with many functions such as skeleton recognition, face recognition and voice direction acquisition. In order to make its programming easier, we developed NtKinect class library for C++ and made it open source. Programs using NtKinect are multi-threaded, DLLable, and Kinect V2 functions can be used from other programming languages and environments. We will discuss its design policy. Keywords: Kinect V2, C++, DLL, Unity 1. Microsoft Kinect for Windows V2 *1 [1] Kinect V2 C++ API 2. Kinect for Windows V2 Microsoft Kinect V2 Kinect for Windows version 2.0 SDK C++ [2] native code API 1 Tsuda College, 2 1 1, Tsuda, Koadira, Tokyo 187 8577, Japan a) nitta@tsuda.ac.jp *1 Kinect V2 1 Kinect SDK Inteface IAudio 10 50 IBody 11 61 IColor 6 31 ICoordinateMapper 2 17 IDepth 5 26 IInfrared 5 22 IKinectSensor 2 19 IMultiSource 4 16 9 35 54 277 Interface *2 1 Interface 9 Interface 54, 277 SDK [3] *2 C++ c 2017 Information Processing Society of Japan 1

2 ColorSpace DepthSpace CameraSpace Kinect V2 Kinect V2 BOdyIndex 3. NtKinect Kinect V2 C++ NtKinect [4] NtKinect = Kinect SDK + + STL(C++) + OpenCV + mutex Collection STL OpenCV DLL 1 cv::mat mutex 3.1 Kinect 3.2 C++ STL Kinect V2 Collection STL DLL 3.3 OpenCV OpenCV version 2 C++ Kinect V2 OpenCV OpenCV ( ) BodyIndex OpenCV cv::mat ( 1) 3.4 3.5 DLL NtKinect Kinect DLL DLL 4. NtKinect API 3 C++ API 3 4 Kinect V2 (HDFace) 5. NtKinect C++ 2 3 [5] kinect.setskeleton() c 2017 Information Processing Society of Japan 2

3 NtKinect Table 3 Methods of NtKinect. ( ) RGB void setrgb (rgbimage) void setdepth (depthimage) BodyIndex void setbodyindex (bodyindeximage) void setinfrared (infraredimage) void setskeleton (skeleton, skeletonid, skeletontrackingid) pair<int,int> handstate () void setface (facepoint, facerect, facedirection, faceproperty) void sethdface (hdfacevertices, hdfacetrackingid, hdfacestatus) void setaudio (beamangle, beamangleconfidence, audiotrackingid) void drawaudiodirection () bool isopendaudio () void opendaudio () void closeaudio () void setspeechlang () void startspeech () void stopspeech () bool setspeech (recognizedspeech, speechtag, speechitem, speechconfidence) void setgesturefile void setgesture (discretegesture, discretegesturetrackingid, continuousgesture, continuousgesturetrackingid) 4 NtKinect Table 4 Member variables of NtKinect. RGB cv::mat rgbimage cv::mat depthimage BodyIndex cv::mat bodyindeximage BodyIndex cv::mat infraredimage vector<vector<joint>> skeleton vector<int> skeletonid BodyIndex vector<int64> skeletontrackingid TrackingID vector<vector<pointf>> facepoint vector<cv::rect> facerect vector<cv::vec3f> facedirection vector<vector<detectionresult>> faceproperty vector<uint64> facetrackingid skeletontrackingid vector<vector<cameraspacepoitn>> hdfacevertices vector<uint64> hdfacetrackingid skeletontrackingid vector<pair<int,int>> hdfacestatus float beamangle float beamangleconfidence beamangle UINT64 audiotrackingid skeletontrackingid bool recognizedspeech wstring speechtag wstring speechitem float speechconfidence float confidencethreshold vector<pair<...,float>> discretegesture vector<uint64> discretegesturetrackingid skeletontrackingid vector<pair<...,float>> continuousgesture vector<uint64> continuousgesturetrackingid skeletontrackingid c 2017 Information Processing Society of Japan 3

情報処理学会研究報告 #define USE FACE #include NtKinect. h using namespace s t d ; void dojob ( ) { NtKinect k i n e c t ; while ( 1 ) { k i n e c t. setrgb ( ) ; kinect. setskeleton () ; kinect. setface () ; f o r ( auto& r : k i n e c t. f a c e R e c t ) cv : : r e c t a n g l e ( k i n e c t. rgbimage, r, cv : : S c a l a r ( 0, 0, 0 ), 1) ; f o r ( auto& p e r s o n : k i n e c t. s k e l e t o n ) f o r ( auto& j o i n t : p e r s o n ) { i f ( j o i n t. T r a c k i n g S t a t e == T r a c k i n g S t a t e N o t T r a c k e d ) continue ; C o l o r S p a c e P o i n t cp ; k i n e c t. c oordin atemap per >MapCameraPointToColorSpace ( j o i n t. P o s i t i o n,& cp ) ; cv : : r e c t a n g l e ( k i n e c t. rgbimage, cv : : Rect ( ( i n t ) cp. X 5,( i n t ) cp. Y 5, 1 0, 1 0 ), cv : : S c a l a r ( 0, 0, 2 5 5 ),2) ; cv : : imshow ( rgb, k i n e c t. rgbimage ) ; auto key = cv : : waitkey ( 1 ) ; i f ( key == q ) break ; cv : : destroyallwindows ( ) ; i n t main ( i n t ar gc, char a r g v ) { try { dojob ( ) ; catch ( e x c e p t i o n &ex ) { c o u t << ex. what ( ) << e n d l ; return 0 ; 図 2 骨格認識と顔認識の C++コード ので ColorSpace 座標系の座標に変換してから RGB 画像上に四角形を描画する Joint 型のデータは その TrackingState メンバ変数の 値が TrackingState NotTracked である場合は意味を 持たないのでその場合は関節の表示処理を省略する 6. NtKinect を用いた DLL ファイルの開発 顔認識を行い 最大 6 人までの顔の方向 (Euler 角, すな わち pitch, yaw, roll の角度) を返す DLL のヘッダファイ ルを図 4 に C++のコードを図 5 に示す DLL プログラムを開発する場合は NtKinect 型のデー 図 3 骨格認識と顔認識の例 タをヒープ上に確保し void *型のデータとして返す ま た センサーから取得した Collections データは DLL 関 数を呼び出す側が確保したメモリ領域にコピーすることで kinect.setface() メソッドを呼び出して顔認識する 値を返す [6] 顔の矩形領域を黒で塗り潰す 関節の位置は CameraSpace 座標系で表現されている c 2017 Information Processing Society of Japan 4

#i f d e f NTKINECTDLL EXPORTS #define NTKINECTDLL API d e c l s p e c ( d l l e x p o r t ) #else #define NTKINECTDLL API d e c l s p e c ( d l l i m p o r t ) #endif extern C { NTKINECTDLL API void getkinect ( void ) ; NTKINECTDLL API int f a c e D i r e c t i o n ( void ptr, f l o a t d i r ) ; 4 DLL C++ #include s t d a f x. h #include NtKinectDll. h #define USE FACE #include NtKinect. h using namespace std ; NTKINECTDLL API void getkinect ( void ) { NtKinect k i n e c t = new NtKinect ; return static cast <void >( k i n e c t ) ; NTKINECTDLL API int f a c e D i r e c t i o n ( void ptr, f l o a t d i r ) { NtKinect k i n e c t = static cast <NtKinect >( ptr ) ; ( k i n e c t ). s e t S k e l e t o n ( ) ; ( k i n e c t ). setface ( ) ; int idx =0; for ( auto d : ( k i n e c t ). f a c e D i r e c t i o n ) { d i r [ idx++] = d [ 0 ] ; d i r [ idx++] = d [ 1 ] ; d i r [ idx++] = d [ 2 ] ; return ( k i n e c t ). f a c e D i r e c t i o n. s i z e ( ) ; 5 DLL C++ 7. DLL 6 DLL Unity 6 Unity Assets/x86 64/ DLL [6] ( 7) 8. Kinect V2 C++ NtKinect Kinect V2 DLL Unity Kinect V2 Microsoft NtKinect [7] Kinect V2 DLL Unity NtKinect NtKinect 2016 7 [8], [9], [10] NtKinect 2017 2 6 Google NtKinect 5 Unity Web Unreal Engine c 2017 Information Processing Society of Japan 5

using UnityEngine ; using System. C o l l e c t i o n s ; using System. Runtime. I n t e r o p S e r v i c e s ; public c la ss NtKinectBehaviour : MonoBehaviour { [ DllImport ( NtKinectDll ) ] private s t a t i c extern System. I n t P t r g e t K i n e c t ( ) ; [ DllImport ( NtKinectDll ) ] private s t a t i c extern int f a c e D i r e c t i o n ( System. I n t P t r k i n e c t, System. I n t P t r data ) ; private System. I n t P t r k i n e c t ; void S t a r t ( ) { k i n e c t = g etkinect ( ) ;... void Update ( ) { f l o a t [ ] data = new f l o a t [ bodycount 3 ] ; GCHandle gch = GCHandle. A l l o c ( data, GCHandleType. Pinned ) ; int n = f a c e D i r e c t i o n ( k i n e c t, gch. AddrOfPinnedObject ( ) ) ; gch. Free ( ) ; for ( int i =0; i <n / 3 ; i ++) { // data [ i 3 ], data [ i 3+1], data [ i 3+2] = p i t c h, yaw, r o l l 6 DLL Unity C# ( ) 7 Unity DLL 5 Google NtKinect 1 kinect 1 kinect 4 kinect 3 (2017/02/03 access). [6] Yoshihisa Nitta: NtKinect- Kinect V2 DLL Unity, http://nw.tsuda.ac.jp/lec/kinect2/kinectv2 dll2/ (2017/02/03 access). [7] Yoshihisa Nitta: NtKinect- Kinect V2 DLL Unity, http://nw.tsuda.ac.jp/lec/kinect2/kinectv2 dll3/ (2017/02/08 access). [8], :, 2016, P-131 (2016). [9],, :, NICOGRAPH 2016, P-4 (2016). [10],, :, WISS 2016, P-213 (2016). [1] Microsoft: Kinect for Windows, https://developer.microsoft.com/ja-jp/windows/kinect/, (2017/02/03 access). [2] Microsoft: Kinect for Windows SDK C++ Reference, https://msdn.microsoft.com/jajp/library/dn791993.aspx, (2017/02/03). [3],,, KINECT for Windows SDK v2 (2015). [4] Yoshihisa Nitta: NtKinect - Kinect V2 C++ Programming with OpenCV on Windows10, http://nw.tsuda.ac.jp/lec/kinect2/ (2017/02/03 access). [5] Yoshihisa Nitta: NtKinect- Kinect V2 (ColorSpace ), http://nw.tsuda.ac.jp/lec/kinect2/kinectv2 face/ c 2017 Information Processing Society of Japan 6