This downloadable code sample demonstrates the basics of capturing and viewing raw R200 camera streams in C#/XAML using the Intel® RealSense™ SDK for Windows*. The Visual Studio* solution is actually comprised of four simple projects (each under 200 lines of code):
- ColorStream – Displays the color stream from the RGB camera
- DepthStream – Displays the depth stream
- IRStreams – Displays the left and right IR camera streams
- AllStreams – Shows all of the above in a single window (Figure 1)
Figure 1. All Streams Code Sample
Software Development Environment
The code sample was created on Windows® 10 RTM using Microsoft Visual Studio Community 2015. The project template used for this sample is Visual C# – Windows – Classic Desktop.
The SDK and DCM versions used in this project are:
- Intel® RealSense™ SDK v220.127.116.1198
- Intel® RealSense™ Depth Camera Manager R200 v18.104.22.168488
For this development work we used the Intel® RealSense™ Developer Kit (R200), which includes the camera, USB3 cable, and a magnetic adhesive mount for attaching the camera to a laptop computer (Figure 2).
Figure 2. Intel® RealSense™ Developer Kit (R200)
The hardware requirements for running the R200 code sample are as follows:
- 4th generation (or later) Intel® Core™ processor
- 150 MB free hard disk space
- 4GB RAM
- Intel® RealSense™ camera (R200)
- Available USB3 port for the R200 camera (or dedicated connection for integrated camera)
Important Note: A USB3 interface is required to support the bandwidth needed by the camera. This interface must be connected to a dedicated USB3 port within the client system (do not use a hub).
About the Code
The Visual Studio solution consists of four WPF projects developed in C#. These projects use an explicit path to libpxcclr.cs.dll (the managed DLL):
C:\Program Files (x86)\Intel\RSSDK\bin\x64
Note that this reference will need to be changed if your SDK installation path is different.
Since we are referencing the 64-bit version of the DLL, you must also ensure that “x64” is specified under the Project → Properties → Platform target setting.
To build and run a particular project, right-click on the project name (e.g., AllStreams) in Solution Explorer, then select Set as StartUp Project from the menu options.
All of the projects contained in the CameraStreams solution have a similar structure:
- Configure the Session and SenseManager interface.
- Start a worker thread named Update, in which the AcquireFrame-ReleaseFrame loop is processed.
- The following actions take place inside the AcquireFrame-ReleaseFrame loop:
- Get image data.
- Call the Render method to update the UI.
- Release resources.
- Release the frame.
- The following actions take place inside the Render method:
- Call the ConvertBitmap method to convert each bitmap frame to a BitmapImage type, which is required for displaying each frame in the WPF Image control.
- Update the UI by delegating work to the Dispatcher associated with the UI thread.
- A ShutDown method is called whenever the Window_Closing or btnExit_Click events fire. The following actions take place inside the ShutDown method:
- Stop the Update thread.
- Dispose objects.
Check It Out
Follow the Download link to get the code and experiment with this sample.
About Intel® RealSense™ Technology
To get started and learn more about the Intel® RealSense™ SDK for Windows, go tohttps://software.intel.com/en-us/intel-realsense-sdk.
For more such Android resources and tools from Intel, please visit the Intel® RealSense™ Developer Zone
Other Popular Deals
- Top 10 Android launchers (December 2016)The 10 best job hunting apps on Android
- The 10 scariest horror games on AndroidAndroid app stores: 5 best alternatives to Google Play Store
- Best Android apps for rooted devices18 apps for a memorable Valentine's Day
- Top 15 Android games that you should playThe 20 best looking games for mobile phones
- 8 Android apps to tickle your funny bone17 must have apps for any Android device (plus alternatives)
- 5 apps to get the Android Lollipop look on your smartphoneTake control of your Android device with these apps
- 7 weird and strange apps for your Smartphone10 neat Google apps you may not know of
- 10 essential Indian apps for Android devicesPerfect Viewer