0

I am using EmguCV and OpenNi in C# to retrieve the pointcloud from the Kinect. The code I am using is below:


IntPtr img = CvInvoke.cvRetrieveFrame(kCapture.Ptr, 1);
                if (img != IntPtr.Zero)
                {
                    MIplImage iplImage = (MIplImage)Marshal.PtrToStructure(img, typeof(MIplImage));

                    MCvPoint3D32f[] points = new MCvPoint3D32f[iplImage.width * iplImage.height];

                    GCHandle handle = GCHandle.Alloc(points, GCHandleType.Pinned);
                    using (Matrix m = new Matrix(iplImage.height, iplImage.width, handle.AddrOfPinnedObject()))
                    {
                        CvInvoke.cvCopy(img, m, IntPtr.Zero);
                    }
                    handle.Free();

                }

I get an exception with the message "OpenCV: src.channels() == dst.channels()" when I am trying to perform the copy operation.

4

1 回答 1

-1

我整个周末都在修补 opencv 和 Emgu CV,我已经设法解决了。原来你可以使用 RetrieveBgrFrame 来检索点云。


Image pcl = kCapture.RetrieveBgrFrame((int)Emgu.CV.KinectCapture.OpenNIDataType.PointCloudMap);
                Image pclf = new Image(pcl.MIplImage.width, pcl.MIplImage.height, pcl.MIplImage.widthStep, pcl.MIplImage.imageData);

于 2012-10-08T08:44:27.033 回答