示例#1
0
        /// <summary>
        /// Initialize a Kinect Fusion 3D Reconstruction Volume.
        /// Voxel volume axis sizes must be greater than 0 and a multiple of 32.
        /// Users can select which device the processing is performed on with
        /// the <paramref name="reconstructionProcessorType"/> parameter. For those with multiple GPUs
        /// the <paramref name="deviceIndex"/> parameter also enables users to explicitly configure
        /// on which device the reconstruction volume is created.
        /// </summary>
        /// <param name="reconstructionParameters">
        /// The Reconstruction parameters to define the size and shape of the reconstruction volume.
        /// </param>
        /// <param name="reconstructionProcessorType">
        /// the processor type to be used for all calls to the reconstruction volume object returned
        /// from this function.
        /// </param>
        /// <param name="deviceIndex">Set this variable to an explicit zero-based device index to use
        /// a specific GPU as enumerated by NuiFusionGetDeviceInfo, or set to -1 to automatically
        /// select the default device for a given processor type.
        /// </param>
        /// <param name="initialWorldToCameraTransform">
        /// The initial camera pose of the reconstruction volume with respect to the world origin.
        /// Pass identity as the default camera pose.
        /// </param>
        /// <returns>The Reconstruction instance.</returns>
        /// <exception cref="ArgumentNullException">
        /// Thrown when the <paramref name="reconstructionParameters"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown when the <paramref name="reconstructionParameters"/> parameter's <c>VoxelX</c>,
        /// <c>VoxelY</c>, or <c>VoxelZ</c> member is not a greater than 0 and multiple of 32 or the
        /// <paramref name="deviceIndex"/> parameter is less than -1 or greater than the number of
        /// available devices for the respective processor type.
        /// </exception>
        /// <exception cref="OutOfMemoryException">
        /// Thrown when the memory required for the Reconstruction volume processing could not be
        /// allocated.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// Thrown when the Kinect Runtime could not be accessed, the Kinect device is not
        /// connected or the Reconstruction volume is too big so a GPU memory
        /// allocation failed, or the call failed for an unknown reason.
        /// </exception>
        public static Reconstruction FusionCreateReconstruction(
            ReconstructionParameters reconstructionParameters,
            ReconstructionProcessor reconstructionProcessorType,
            int deviceIndex,
            Matrix4 initialWorldToCameraTransform)
        {
            if (null == reconstructionParameters)
            {
                throw new ArgumentNullException("reconstructionParameters");
            }

            INuiFusionReconstruction reconstruction = null;

            ExceptionHelper.ThrowIfFailed(NativeMethods.NuiFusionCreateReconstruction(
                                              reconstructionParameters,
                                              reconstructionProcessorType,
                                              deviceIndex,
                                              ref initialWorldToCameraTransform,
                                              out reconstruction));

            return(new Reconstruction(reconstruction));
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the Reconstruction class.
 /// Default constructor used to initialize with the native Reconstruction volume object.
 /// </summary>
 /// <param name="volume">
 /// The native Reconstruction volume object to be encapsulated.
 /// </param>
 internal Reconstruction(INuiFusionReconstruction volume)
 {
     this.volume = volume;
     defaultWorldToVolumeTransform = this.GetCurrentWorldToVolumeTransform();
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the Reconstruction class.
 /// Default constructor used to initialize with the native Reconstruction volume object.
 /// </summary>
 /// <param name="volume">
 /// The native Reconstruction volume object to be encapsulated.
 /// </param>
 internal Reconstruction(INuiFusionReconstruction volume)
 {
     this.volume = volume;
     defaultWorldToVolumeTransform = this.GetCurrentWorldToVolumeTransform();
 }