Intel Perceptual Computing SDK My First C++ Application



Similar documents
Intel Media SDK Library Distribution and Dispatching Process

Intel Media Server Studio Professional Edition for Windows* Server

* * * Intel RealSense SDK Architecture

Intel Media Server Studio - Metrics Monitor (v1.1.0) Reference Manual

Intel SSD 520 Series Specification Update

Intel HTML5 Development Environment. Tutorial Test & Submit a Microsoft Windows Phone 8* App (BETA)

Intel Core i5 processor 520E CPU Embedded Application Power Guideline Addendum January 2011

Intel Media SDK Features in Microsoft Windows 7* Multi- Monitor Configurations on 2 nd Generation Intel Core Processor-Based Platforms

Intel Integrated Native Developer Experience (INDE): IDE Integration for Android*

Intel HTML5 Development Environment. Tutorial Building an Apple ios* Application Binary

Intel Solid-State Drive Pro 2500 Series Opal* Compatibility Guide

Intel HTML5 Development Environment Article Using the App Dev Center

Specification Update. January 2014

Head-Coupled Perspective

Eliminate Memory Errors and Improve Program Stability

IDE Integration for Android* Part of the Intel Integrated Native Developer Experience (Intel INDE) 1.5.7

Displaying Stereoscopic 3D (S3D) with Intel HD Graphics Processors for Software Developers August 2011

Software Evaluation Guide for Autodesk 3ds Max 2009* and Enemy Territory: Quake Wars* Render a 3D character while playing a game

with PKI Use Case Guide

Version Rev. 1.0

The ROI from Optimizing Software Performance with Intel Parallel Studio XE

Intel Compiler Code Coverage Tool

This guide explains how to install an Intel Solid-State Drive (Intel SSD) in a SATA-based desktop or notebook computer.

Intel 810 and 815 Chipset Family Dynamic Video Memory Technology

Resetting USB drive using Windows Diskpart command

Intel Desktop Board D945GCPE Specification Update

Intel Retail Client Manager

Intel Small Business Advantage (Intel SBA) Release Notes for OEMs

Software Solutions for Multi-Display Setups

Intel Desktop Board D945GCPE

Intel vpro Technology. How To Purchase and Install Symantec* Certificates for Intel AMT Remote Setup and Configuration

System Event Log (SEL) Viewer User Guide

Intel Core TM i3 Processor Series Embedded Application Power Guideline Addendum

System Image Recovery* Training Foils

Intel Desktop Board DQ35JO

Intel Desktop Board DG43RK

Intel Internet of Things (IoT) Developer Kit

Intel System Event Log (SEL) Viewer Utility

iscsi Quick-Connect Guide for Red Hat Linux

Intel System Event Log (SEL) Viewer Utility

Cloud based Holdfast Electronic Sports Game Platform

Intel Retail Client Manager

Intel Desktop Board DP55WB

Intel Desktop Board DG41TY

Intel Data Migration Software

Intel vpro Technology. How To Purchase and Install Go Daddy* Certificates for Intel AMT Remote Setup and Configuration

Intel Matrix Storage Console

Intel Desktop Board DG41BI

Intel Desktop Board D945GCL

Intel Extreme Memory Profile (Intel XMP) DDR3 Technology

Intel Desktop Board DQ965GF

Intel Platform Controller Hub EG20T

Intel System Event Log (SEL) Viewer Utility

Intel Retail Client Manager Audience Analytics

Intel Desktop Board DG33TL

Intel HTML5 Development Environment. Article - Native Application Facebook* Integration

Intel Desktop Board DQ43AP

Intel 845G/GL Chipset Dynamic Video Memory Technology

Power Benefits Using Intel Quick Sync Video H.264 Codec With Sorenson Squeeze

Douglas Fisher Vice President General Manager, Software and Services Group Intel Corporation

Intel Desktop Board DG31PR

Intel Identity Protection Technology (IPT)

Intel RAID Volume Recovery Procedures

Intel System Event Log (SEL) Viewer Utility. User Guide SELViewer Version 10.0 /11.0 December 2012 Document number: G

Intel Technical Advisory

Intel 865G Chipset Dynamic Video Memory Technology

Partition Alignment of Intel SSDs for Achieving Maximum Performance and Endurance Technical Brief February 2014

Intel Desktop Board DG965RY

WHITE PAPER. LVDS Flat Panel Display Interface on Intel Desktop Boards. July 2009 Order Number: E

Intel Network Builders: Lanner and Intel Building the Best Network Security Platforms

Intel Desktop Board D101GGC Specification Update

INTEL PARALLEL STUDIO XE EVALUATION GUIDE

INTEL PARALLEL STUDIO EVALUATION GUIDE. Intel Cilk Plus: A Simple Path to Parallelism

Intel Q35/Q33, G35/G33/G31, P35/P31 Express Chipset Memory Technology and Configuration Guide

Intel 965 Express Chipset Family Memory Technology and Configuration Guide

Creating Overlay Networks Using Intel Ethernet Converged Network Adapters

Intel Desktop Board DG41WV

Contents Overview and Product Contents

The Case for Rack Scale Architecture

Creating Full Screen Applications Across Multiple Displays in Extended Mode

Intel Unite. User Guide

Intel Modular Server System MFSYS25

Intel Solid-State Drive Data Center Tool User Guide Version 1.1

Intel Desktop Board DP43BF

Intel Identity Protection Technology Enabling improved user-friendly strong authentication in VASCO's latest generation solutions

Intel Remote Configuration Certificate Utility Frequently Asked Questions

Revision History. Revision Revision History Date

UM0985 User manual. Developing your STM32VLDISCOVERY application using the IAR Embedded Workbench software. Introduction

User Guide Software Version 2.1.0

Improve Fortran Code Quality with Static Analysis

Intel Server System S7000FC4UR

Towards OpenMP Support in LLVM

Trusted Platform Module (TPM) Quick Reference Guide

Intel Simple Network Management Protocol (SNMP) Subagent v6.0

Intel Server Raid Controller. RAID Configuration Utility (RCU)

Transcription:

Intel Perceptual Computing SDK My First C++ Application

LEGAL DISCLAIMER THIS DOCUMENT CONTAINS INFORMATION ON PRODUCTS IN THE DESIGN PHASE OF DEVELOPMENT. INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR. INTEL MAY MAKE CHANGES TO SPECIFICATIONS AND PRODUCT DESCRIPTIONS AT ANY TIME, WITHOUT NOTICE. DESIGNERS MUST NOT RELY ON THE ABSENCE OR CHARACTERISTICS OF ANY FEATURES OR INSTRUCTIONS MARKED "RESERVED" OR "UNDEFINED." INTEL RESERVES THESE FOR FUTURE DEFINITION AND SHALL HAVE NO RESPONSIBILITY WHATSOEVER FOR CONFLICTS OR INCOMPATIBILITIES ARISING FROM FUTURE CHANGES TO THEM. THE INFORMATION HERE IS SUBJECT TO CHANGE WITHOUT NOTICE. DO NOT FINALIZE A DESIGN WITH THIS INFORMATION. THE PRODUCTS DESCRIBED IN THIS DOCUMENT MAY CONTAIN DESIGN DEFECTS OR ERRORS KNOWN AS ERRATA WHICH MAY CAUSE THE PRODUCT TO DEVIATE FROM PUBLISHED SPECIFICATIONS. CURRENT CHARACTERIZED ERRATA ARE AVAILABLE ON REQUEST. CONTACT YOUR LOCAL INTEL SALES OFFICE OR YOUR DISTRIBUTOR TO OBTAIN THE LATEST SPECIFICATIONS AND BEFORE PLACING YOUR PRODUCT ORDER. COPIES OF DOCUMENTS WHICH HAVE AN ORDER NUMBER AND ARE REFERENCED IN THIS DOCUMENT, OR OTHER INTEL LITERATURE, MAY BE OBTAINED BY CALLING 1-800-548-4725, OR BY VISITING INTEL'S WEB SITE HTTP://WWW.INTEL.COM. ANY SOFTWARE SOURCE CODE REPRINTED IN THIS DOCUMENT IS FURNISHED UNDER A SOFTWARE LICENSE AND MAY ONLY BE USED OR COPIED IN ACCORDANCE WITH THE TERMS OF THAT LICENSE ANY SOFTWARE SOURCE CODE REPRINTED IN THIS DOCUMENT IS FURNISHED UNDER A SOFTWARE LICENSE AND MAY ONLY BE USED OR COPIED IN ACCORDANCE WITH THE TERMS OF THAT LICENSE INTEL, THE INTEL LOGO, INTEL CORE, INTEL MEDIA SOFTWARE DEVELOPMENT KIT (INTEL MEDIA SDK) ARE TRADEMARKS OR REGISTERED TRADEMARKS OF INTEL CORPORATION OR ITS SUBSIDIARIES IN THE UNITED STATES AND OTHER COUNTRIES. MPEG IS AN INTERNATIONAL STANDARD FOR VIDEO COMPRESSION/DECOMPRESSION PROMOTED BY ISO. IMPLEMENTATIONS OF MPEG CODECS, OR MPEG ENABLED PLATFORMS MAY REQUIRE LICENSES FROM VARIOUS ENTITIES, INCLUDING INTEL CORPORATION. *OTHER NAMES AND BRANDS MAY BE CLAIMED AS THE PROPERTY OF OTHERS. COPYRIGHT 2010-2012, INTEL CORPORATION. ALL RIGHTS RESERVED. ii Intel Perceptual Computing SDK Training Version 1.0

Optimization Notice Intel compilers, associated libraries and associated development tools may include or utilize options that optimize for instruction sets that are available in both Intel and non-intel microprocessors (for example SIMD instruction sets), but do not optimize equally for non-intel microprocessors. In addition, certain compiler options for Intel compilers, including some that are not specific to Intel micro-architecture, are reserved for Intel microprocessors. For a detailed description of Intel compiler options, including the instruction sets and specific microprocessors they implicate, please refer to the Intel Compiler User and Reference Guides under Compiler Options." Many library routines that are part of Intel compiler products are more highly optimized for Intel microprocessors than for other microprocessors. While the compilers and libraries in Intel compiler products offer optimizations for both Intel and Intelcompatible microprocessors, depending on the options you select, your code and other factors, you likely will get extra performance on Intel microprocessors. Intel compilers, associated libraries and associated development tools may or may not optimize to the same degree for non-intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel Streaming SIMD Extensions 2 (Intel SSE2), Intel Streaming SIMD Extensions 3 (Intel SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel SSSE3) instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. While Intel believes our compilers and libraries are excellent choices to assist in obtaining the best performance on Intel and non-intel microprocessors, Intel recommends that you evaluate other compilers and libraries to determine which best meet your requirements. We hope to win your business by striving to offer the best performance of any compiler or library; please let us know if you find we do not. Notice revision #20101101 iii Intel Perceptual Computing SDK Training Version 1.0

Table of Contents Introduction... 1 My First C++ Application... 2 iv Intel Perceptual Computing SDK Training Version 1.0

Introduction The Intel Perceptual Computing SDK is a library of pattern detection and recognition algorithm implementations exposed through standardized interfaces. The library s purpose is to lower barriers to using these algorithms and shift the application developers focus from coding the algorithm details to innovating on the usage of these algorithms for next generation human computer experience. Assuming that you have followed the Getting Started guide to install the SDK, we will go through the steps to create and run a simple C++ application using the SDK. First, it s always a good habit to check if the camera and the SDK are installed correctly. Here are the steps: Launch the capture_viewer application from the startup menu: Startup Intel Perceptual Computing SDK Tools Capture Viewer. Select a color stream, a depth stream and an audio stream from the DepthSense 325 Audio/Video Capture module. Select Control Display to render the streams. Figure 1: Camera Testing for Color, Depth and Audio If your screen looks similar to the one shown in Figure 1, the camera is working as expected. It s time to create a simple application. To do something similar to the capture_viewer application, we will develop an application that shows color and depth pictures. 1 Intel Perceptual Computing SDK Training Version 1.0

My First C++ Application Launch Microsoft* Visual Studio* 2010. Create a new console application called ShowImages (see Figure 2). Figure 2: New Console Application Add the SDK include files and library paths, as illustrated in Figure 3, Figure 4, and Figure 5, to the project so that the compiler and linker can find the SDK files as follows: Select Project Properties, and then the VC++Directories tab. Add $(PCSDK_DIR)/include to the include directories, as illustrated in Figure 3. We will need to use some sample utilities. Add $(PCSDK_DIR)/sample/common/include to the include directories as well. Figure 3: SDK Application Project Include Settings 2 Intel Perceptual Computing SDK Training Version 1.0

Add $(PCSDK_DIR)/lib/$(PlatformName) and $(PCSDK_DIR)/sample/common/lib/ $(PlatformName)/$(PlatformToolset) to the library directories, as in Figure 4. Figure 4: SDK Application Project Library Path Settings Go to the Linker Input tab and add libpxc_d.lib and libpxcutils_d.lib (for the Debug build), or libpxc.lib and libpxcutils.lib (for the Release build) to the Additional Dependencies tab, as illustrated in Figure 5. Here libpxc is the SDK library code, and the libpxcutils is the sample utility library. Figure 5: SDK Application Project Library Settings Go to the C/C++ Code Optimization tab and change the Runtime Library setting to be Multi-Threaded Debug (/MTd), or Multi-threaded (/MT), according to your project Debug or Release mode, as illustrated in Figure 6. 3 Intel Perceptual Computing SDK Training Version 1.0

Figure 6: SDK Application Code Optimization Settings For our first C++ SDK application (shown in Example 1), we are reading color pictures from the camera and rendering them. #include "stdafx.h" #include "util_render.h" #include "util_pipeline.h" int _tmain(int argc, _TCHAR* argv[]) { UtilPipeline pipeline; pipeline.enableimage(pxcimage::color_format_rgb32); pipeline.init(); UtilRender color_render(l"color Stream"); for (;;) { if (!pipeline.acquireframe(true)) break; PXCImage *color_image=pipeline.queryimage(pxcimage::image_type_color); if (!color_render.renderframe(color_image)) break; pipeline.releaseframe(); pipeline.close(); return 0; Example 1: Simple Image Capture Application The code uses the UtilPipeline utility classes. We first enable color image capturing by the pipeline.enableimage(pxcimage::color_format_rgb32) function, and then initialize the pipeline. In the for loop, the AcquireFrame function waits for a color sample to be available, then we render it using the UtilRender::RenderFrame function. We use the ReleaseFrame function to indicate that there are no more operations for the current frame. It s time to go read the next frame. Run the code; you should see the color rendering window similar the one in in Figure 7. Click the close button on the top to close the application. 4 Intel Perceptual Computing SDK Training Version 1.0

Figure 7: The Sample Capture Application Render Window You may notice that the color window is of the default resolution. This is usually 640x480. To change to a different resolution, simply enter the resolution as part of the EnableImage function as illustrated in Figure 8. Compile and run it. The application will show a 720p resolution color window. #include "stdafx.h" #include "util_render.h" #include "util_pipeline.h" int _tmain(int argc, _TCHAR* argv[]) { UtilPipeline pipeline; pipeline.enableimage(pxcimage::color_format_rgb32, 1280, 720); pipeline.init(); UtilRender color_render(l"color Stream"); for (;;) { if (!pipeline.acquireframe(true)) break; PXCImage *color_image=pipeline.queryimage(pxcimage::image_type_color); if (!color_render.renderframe(color_image)) break; pipeline.releaseframe(); pipeline.close(); return 0; Figure 8: Simple Capture with An Explicit Resolution. Now, let s go one more step and add a depth stream in a different rendering window. It s easy to do. The code is shown in Figure 9. 5 Intel Perceptual Computing SDK Training Version 1.0

#include "stdafx.h" #include "util_render.h" #include "util_pipeline.h" int _tmain(int argc, _TCHAR* argv[]) { UtilPipeline pipeline; pipeline.enableimage(pxcimage::color_format_rgb32); pipeline.enableimage(pxcimage::color_format_depth); pipeline.init(); UtilRender color_render(l"color Stream"); UtilRender depth_render(l"depth Stream"); for (;;) { if (!pipeline.acquireframe(true)) break; PXCImage *color_image=pipeline.queryimage(pxcimage::image_type_color); PXCImage *depth_image=pipeline.queryimage(pxcimage::image_type_depth); if (!color_render.renderframe(color_image)) break; if (!depth_render.renderframe(depth_image)) break; pipeline.releaseframe(); pipeline.close(); return 0; Figure 9: Color and Depth Image Capture Compile and run it. You should see two windows as shown in Figure 10: one for the color stream and the other for the depth stream. Closing any of the color and depth windows will close the application. 6 Intel Perceptual Computing SDK Training Version 1.0

Figure 10: Color and Depth Image Capture Render Windows 7 Intel Perceptual Computing SDK Training Version 1.0