Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Best Coding Practices & Tips - Intel® RealSense™ based applications

$
0
0

Whether writing a new app in 2016 or updating an earlier app that includes Intel® RealSense™ technology, here are some tips to check before finalizing your app.

  • Detect the camera at installation 
  • Detect the DCM version (driver) at app start (runtime) - (to be deprecated in 2017 for SR300)
  • Detect Camera Model and mode (SR300 native or HW compatibility) at runtime 
  • The runtime installer will auto detect whether/which runtime is already installed.
  • Code you app as camera neutral .
  • Fail gracefully 
  • Include the runtime installer linking to modules used by your app
  • Display the Runtime EULA (installs with runtime) and the privacy notice required per the SDK license.
  • Sign your code (for Windows)
  • Test on Windows* 10 TH2 and DCM 1.4HF3 and DCM3.1.x
  • Perform a security scan

Writing Neutral Code

  • Don't use the friendly names (F200,SR300) nor device IDs. Instead refer to their orientation "front" or "front facing"
  • Use Device Neutral Device Properties. Use the Intel RealSense SDK algorithm modules to have the SDK automatically use the best settings for the given algorithm
  • Don't specify the stream resolution nor the pixel format
  • Use DEPTH instead of DEPTH_RAW, Set IVCamAccuracy to FINEST
  • Use the Image functions to force pixel format conversion (8bit vs 10 bit)
  • Use pixel format Y16 instead of IR_RELATIVE or use AcquireAccess to force pixel format conversion to Y16 when accessing the IR stream data since while the F200 IR is 8 bit (Y8), the SR300 IR is 10 bit (Y16)
  • See this article for more information 

​Fail Gracefully - Include valuable Error Messages

There are multiple situations which could cause your app to fail. It can be another app having control of the camera that uses incompatible settings, or that doesn't properly release the camera  or Windows Hello may have taken control of the camera during a system wake up. In such cases, it is important to fail gracefully and provide messages to the User to both avoid and remedy the situation. Some tips:

  •  In any pre-download write-ups about your app, state that users should close other apps using the Intel® RealSense™ camera before running your app.
  • During app launch, code in a camera init with a short timeout. If init fails, display a message to the user requesting they close any other apps using the camera before running your app.Provide a message that the user must acknowledge with the choice to either 'Close this app" or "I've closed other RealSense apps". For the first option exit your app and for the second, try the init again.
  • Put a 3 second limit on trying to recover from the loss-of-camera. After 3 seconds, put the application into a low power idle state (to limit the impact to battery life and thermal considerations) and Notify the user to close and restart the application

Additional Resources

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html

software.intel.com/en-us/articles/developer-guide-to-intel-realsense-camera-detection-methods


Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>