This C#/XAML code sample demonstrates the basics of using the Enhanced Photography (EP) module in the Intel® RealSense™ SDK for Windows* to change the focus point of a picture after capturing it. The code sample performs the following functions:
- Displays the live color stream of the R200 RGB camera in an Image control (left)
- Captures a snapshot and displays it in a second Image control (right)
- Changes the focus point and aperture through Slider control adjustments
- Saves the modified image as a standard .jpg file (“Snapshot.jpg”)
Figure 1. Depth Refocus Example – Focus Marker Centered on Flower
Figure 2. Saved Image File
As described in the SDK manual (located in RSSDK_DIR\doc\PDF\sdkmanuals.pdf), the Enhanced Photography (EP) module enhances traditional photo and video processing by leveraging 3D depth information recorded with photos or videos. The depth-of-field feature changes the focus point and the given depth of field of a picture after capturing. (Note that this algorithm works for the R200 camera model only.)
Software Development Environment
The code sample is 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 v126.96.36.19998
- Intel® RealSense™ Depth Camera Manager R200 v188.8.131.52488
For this development work we used the Intel® RealSense™ Developer Kit (R200) with the camera attached to a laptop computer using the magnetic adhesive mount provided in the kit (Figure 3).
Figure 3. Camera Attached To Magnetic Adhesive Mount
The basic 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 in the client system (do not use a hub).
1. The project uses the System.Drawing.Imaging namespace, which is referenced manually in a new project by right-clicking References in Solution Explorer and then selecting Add Reference… to open the Reference Manager window. Next, select Assemblies, Framework and then search the list for System.Drawing. Highlight the checkbox and then click the OK button.
2. The project uses an explicit path to libpxcclr.cs.dll (the managed DLL) located here: C:\Program Files (x86)\Intel\RSSDK\bin\x64. You will need to change this reference if your SDK installation path is different.
3. Since this project is referencing the 64-bit version of the DLL, you must ensure that “x64” is specified under the Project → Properties → Platform target setting.
4. The project includes a post-build event command to ensure the unmanaged DLL (libpxccpp2c.dll) gets copied to the output target directory:
if "$(Platform)" == "x86" (copy /y "$(RSSDK_DIR)\bin\win32\libpxccpp2c.dll" "$(TargetDir)" ) else ( copy /y "$(RSSDK_DIR)\bin\x64\libpxccpp2c.dll" "$(TargetDir)" )
For more such intel resources and tools from Intel, please visit the Intel® 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