none
MapDepthFrameToCameraSpace Error HRESULT: 0x80070057 RRS feed

  • Question

  • // depth frame data is a 16 bit value
                ushort* frameData = (ushort*)depthFrameData;

                // new width
                Width = (faceBoundingBox.Right - faceBoundingBox.Left);

                // new height
                Height = (faceBoundingBox.Bottom - faceBoundingBox.Top);

                // data cropped
                ushort[] croppedUshort = new ushort[Width * Height];

                // Iterate the selected area of the original image, and the full area of the new image
                for (int i = 0; i < Height; i++)
                {
                    for (int j = 0; j < Width; j++)
                    {
                        int origIndex = (i * depthFrameDescription.Width) + (faceBoundingBox.Top * depthFrameDescription.Width) + (faceBoundingBox.Left) + (j);
                        int croppedIndex = (i * Width) + (j);

                        // new depth data cropped face
                        croppedUshort[croppedIndex] = frameData[origIndex];
                    }
                }

                // array Camera Space Points
                cameraSpacePoints = new CameraSpacePoint[Width * Height];

                // convert depth to a camera space point
                coordinateMapper.MapDepthFrameToCameraSpace(croppedUshort, cameraSpacePoints);

    Error in the last line:

    Excepción no controlada del tipo 'System.ArgumentException' en Microsoft.Kinect.dll
    Información adicional: This API has returned an exception from an HRESULT: 0x80070057

    Why?

    Tuesday, July 21, 2015 12:09 AM

All replies

  • I don't think you should crop here. Pass all the depth data to the MapDepthFramexxx method or call the method to get it point by point (slower), and then crop the CameraSpacePoints. I think the issue here is that the coordinate mapper expects the depth to be the full DepthWidthxDepthHeight.

    See if that helps.


    Sr. Enterprise Architect | Trainer | Consultant | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer |blog: http://dgoins.wordpress.com

    Tuesday, July 21, 2015 3:39 PM
  • Thank you, I chaged that: 

                

                // array Camera Space Points
                CameraSpacePoint[] cameraSpacePointsDepth = new CameraSpacePoint[depthFrameDescription.Width * depthFrameDescription.Height];

                // convert depth to a camera space point
                coordinateMapper.MapDepthFrameToCameraSpaceUsingIntPtr(depthFrameData, depthDataSize, cameraSpacePointsDepth);

                // depth frame data is a 16 bit value
                ushort* frameData = (ushort*)depthFrameData;

                // new width
                Width = (faceBoundingBox.Right - faceBoundingBox.Left);

                // new height
                Height = (faceBoundingBox.Bottom - faceBoundingBox.Top);

                // data cropped
                cameraSpacePoints = new CameraSpacePoint[Width * Height];

                // Iterate the selected area of the original points, and the full area of the new points
                for (int i = 0; i < Height; i++)
                {
                    for (int j = 0; j < Width; j++)
                    {
                        int origIndex = (i * depthFrameDescription.Width) + (faceBoundingBox.Top * depthFrameDescription.Width) + (faceBoundingBox.Left) + (j);
                        int croppedIndex = (i * Width) + (j);

                        // new depth data cropped face
                        cameraSpacePoints[croppedIndex] = cameraSpacePointsDepth[origIndex];
                    }
                }

    Now works fine, but i think the other issue is better because it works with less data.

    Tuesday, July 21, 2015 5:35 PM