Example #1
0
        public PoseFinder(Engine e)
        {
            this.volume = e.FusionVolume;
            this.engine = e;
            // Create a camera pose finder with default parameters
            CameraPoseFinderParameters cameraPoseFinderParams = CameraPoseFinderParameters.Defaults;

            finder = CameraPoseFinder.FusionCreateCameraPoseFinder(cameraPoseFinderParams);
            resampledColorImagePixels = new int[KinectSettings.DEPTH_PIXEL_COUNT];
        }
Example #2
0
        /// <summary>
        /// Initialize a Kinect Fusion cameraPoseFinder.
        /// A Kinect camera is required to be connected.
        /// </summary>
        /// <param name="cameraPoseFinderParameters">
        /// The parameters to define the number of poses and feature sample locations the camera pose finder uses.
        /// </param>
        /// <returns>The CameraPoseFinder instance.</returns>
        /// <exception cref="ArgumentNullException">
        /// Thrown when the <paramref name="cameraPoseFinderParameters"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown when the <paramref name="cameraPoseFinderParameters"/> parameter's 
        /// <c>featureSampleLocationsPerFrameCount</c>, <c>maxPoseHistoryCount</c> member is not a greater than 0, 
        /// or the <c>featureSampleLocationsPerFrameCount</c> member is greater than 1000.
        /// </exception>
        /// <exception cref="OutOfMemoryException">
        /// Thrown when the memory required for the camera pose finder 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 call failed for an unknown reason.
        /// </exception>
        public static CameraPoseFinder FusionCreateCameraPoseFinder(
            CameraPoseFinderParameters cameraPoseFinderParameters)
        {
            if (null == cameraPoseFinderParameters)
            {
                throw new ArgumentNullException("cameraPoseFinderParameters");
            }

            INuiFusionCameraPoseFinder poseFinder = null;

            ExceptionHelper.ThrowIfFailed(NativeMethods.NuiFusionCreateCameraPoseFinder2(
                cameraPoseFinderParameters,
                IntPtr.Zero,
                out poseFinder));

            return new CameraPoseFinder(poseFinder);
        }
Example #3
0
        /// <summary>
        /// Get the parameters used in the camera pose finder.
        /// </summary>
        /// <returns>Returns the parameters used in the camera pose finder.</returns>
        /// <exception cref="InvalidOperationException">
        /// Thrown when the Kinect Runtime could not be accessed, or
        /// the call failed for an unknown reason.
        /// </exception>
        public CameraPoseFinderParameters GetCameraPoseFinderParameters()
        {
            CameraPoseFinderParameters parameters = new CameraPoseFinderParameters(
                CameraPoseFinderParameters.Defaults.FeatureSampleLocationsPerFrame,
                CameraPoseFinderParameters.Defaults.MaxPoseHistory,
                CameraPoseFinderParameters.Defaults.MaxDepthThreshold);

            HRESULT hr = cameraPoseFinder.GetCameraPoseFinderParameters(parameters);

            ExceptionHelper.ThrowIfFailed(hr);

            return parameters;
        }
Example #4
0
        /// <summary>
        /// Initialize a Kinect Fusion cameraPoseFinder, with random number generator seed for feature
        /// locations and feature thresholds.
        /// </summary>
        /// <param name="cameraPoseFinderParameters">
        /// The parameters to define the number of poses and feature sample locations the camera pose finder uses.
        /// </param>
        /// <param name="randomFeatureLocationAndThresholdSeed">
        /// A seed to initialize the random number generator for feature locations and feature thresholds.
        /// </param>
        /// <returns>The CameraPoseFinder instance.</returns>
        /// <exception cref="ArgumentNullException">
        /// Thrown when the <paramref name="cameraPoseFinderParameters"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Thrown when the <paramref name="cameraPoseFinderParameters"/> parameter's 
        /// <c>featureSampleLocationsPerFrameCount</c>, <c>maxPoseHistoryCount</c> member is not a greater than 0, 
        /// or a maximum of 10,000,000, the <c>featureSampleLocationsPerFrameCount</c> member is greater than 1000,
        /// or the <paramref name="randomFeatureLocationAndThresholdSeed"/> parameter is negative.
        /// </exception>
        /// <exception cref="OutOfMemoryException">
        /// Thrown when the memory required for the camera pose finder 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 call failed for an unknown reason.
        /// </exception>
        public static CameraPoseFinder FusionCreateCameraPoseFinder(
            CameraPoseFinderParameters cameraPoseFinderParameters,
            int randomFeatureLocationAndThresholdSeed)
        {
            if (null == cameraPoseFinderParameters)
            {
                throw new ArgumentNullException("cameraPoseFinderParameters");
            }

            uint seed = ExceptionHelper.CastAndThrowIfOutOfUintRange(randomFeatureLocationAndThresholdSeed);

            INuiFusionCameraPoseFinder poseFinder = null;

            ExceptionHelper.ThrowIfFailed(NativeMethods.NuiFusionCreateCameraPoseFinder(
                cameraPoseFinderParameters,
                ref seed,
                out poseFinder));

            return new CameraPoseFinder(poseFinder);
        }