/Source/XnDeviceSensorV2/XnSensorDepthGenerator.h

http://github.com/PrimeSense/Sensor · C Header · 109 lines · 64 code · 18 blank · 27 comment · 0 complexity · 92a4a4a680295649105c7637e8aa6ec7 MD5 · raw file

  1. /*****************************************************************************
  2. * *
  3. * PrimeSense Sensor 5.x Alpha *
  4. * Copyright (C) 2012 PrimeSense Ltd. *
  5. * *
  6. * This file is part of PrimeSense Sensor *
  7. * *
  8. * Licensed under the Apache License, Version 2.0 (the "License"); *
  9. * you may not use this file except in compliance with the License. *
  10. * You may obtain a copy of the License at *
  11. * *
  12. * http://www.apache.org/licenses/LICENSE-2.0 *
  13. * *
  14. * Unless required by applicable law or agreed to in writing, software *
  15. * distributed under the License is distributed on an "AS IS" BASIS, *
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
  17. * See the License for the specific language governing permissions and *
  18. * limitations under the License. *
  19. * *
  20. *****************************************************************************/
  21. #ifndef __XN_SENSOR_DEPTH_GENERATOR_H__
  22. #define __XN_SENSOR_DEPTH_GENERATOR_H__
  23. //---------------------------------------------------------------------------
  24. // Includes
  25. //---------------------------------------------------------------------------
  26. #include "XnSensorMapGenerator.h"
  27. #include "XnExportedSensorGenerator.h"
  28. #include <XnEventT.h>
  29. //---------------------------------------------------------------------------
  30. // Types
  31. //---------------------------------------------------------------------------
  32. // disable the "inherits via dominance" warning. This is exactly what we want.
  33. #pragma warning (push)
  34. #pragma warning (disable: 4250)
  35. class XnSensorDepthGenerator :
  36. public XnSensorMapGenerator,
  37. virtual public xn::ModuleDepthGenerator,
  38. virtual public xn::ModuleUserPositionInterface,
  39. virtual public xn::ModuleAlternativeViewPointInterface,
  40. virtual public xn::ModuleFrameSyncInterface
  41. {
  42. public:
  43. XnSensorDepthGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
  44. ~XnSensorDepthGenerator();
  45. XnStatus Init();
  46. XnBool IsCapabilitySupported(const XnChar* strCapabilityName);
  47. const void* GetData() { return XnSensorMapGenerator::GetData(); }
  48. XnDepthPixel* GetDepthMap();
  49. XnDepthPixel GetDeviceMaxDepth();
  50. void GetFieldOfView(XnFieldOfView& FOV);
  51. XnStatus RegisterToFieldOfViewChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
  52. void UnregisterFromFieldOfViewChange(XnCallbackHandle hCallback);
  53. xn::ModuleUserPositionInterface* GetUserPositionInterface() { return this; }
  54. XnUInt32 GetSupportedUserPositionsCount();
  55. XnStatus SetUserPosition(XnUInt32 nIndex, const XnBoundingBox3D& Position);
  56. XnStatus GetUserPosition(XnUInt32 nIndex, XnBoundingBox3D& Position);
  57. XnStatus RegisterToUserPositionChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
  58. void UnregisterFromUserPositionChange(XnCallbackHandle hCallback);
  59. xn::ModuleAlternativeViewPointInterface* GetAlternativeViewPointInterface() { return this; }
  60. XnBool IsViewPointSupported(xn::ProductionNode& OtherNode);
  61. XnStatus SetViewPoint(xn::ProductionNode& OtherNode);
  62. XnStatus ResetViewPoint();
  63. XnBool IsViewPointAs(xn::ProductionNode& OtherNode);
  64. XnStatus RegisterToViewPointChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
  65. void UnregisterFromViewPointChange(XnCallbackHandle hCallback);
  66. XnStatus GetPixelCoordinatesInViewPoint(xn::ProductionNode& other, XnUInt32 x, XnUInt32 y, XnUInt32& altX, XnUInt32& altY);
  67. xn::ModuleFrameSyncInterface* GetFrameSyncInterface() { return this; }
  68. XnBool CanFrameSyncWith(xn::ProductionNode& OtherNode);
  69. XnStatus FrameSyncWith(xn::ProductionNode& OtherNode);
  70. XnStatus StopFrameSyncWith(xn::ProductionNode& OtherNode);
  71. XnBool IsFrameSyncedWith(xn::ProductionNode& OtherNode);
  72. XnStatus RegisterToFrameSyncChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
  73. void UnregisterFromFrameSyncChange(XnCallbackHandle hCallback);
  74. protected:
  75. virtual void FilterProperties(XnActualPropertiesHash* pHash);
  76. private:
  77. XnStatus UpdateRealWorldTranslationData();
  78. XnBool IsSensorImageNode(xn::ProductionNode& Other);
  79. static void XN_CALLBACK_TYPE RealWorldTranslationPropChanged(void* pCookie);
  80. XnEventNoArgs m_fovChangedEvent;
  81. XnCallbackHandle m_hRWPropCallback;
  82. XnFieldOfView m_FOV;
  83. };
  84. class XnExportedSensorDepthGenerator : public XnExportedSensorGenerator
  85. {
  86. public:
  87. XnExportedSensorDepthGenerator();
  88. virtual XnSensorGenerator* CreateGenerator(xn::Context& context, xn::Device& sensor, XnDeviceBase* pSensor, const XnChar* strStreamName);
  89. };
  90. #pragma warning (pop)
  91. #endif // __XN_SENSOR_DEPTH_GENERATOR_H__