public ColorPoint[] GetColorPoints(Image<Gray, Byte> mask)
{
using (MemStorage stor = new MemStorage())
{
Seq<ColorPoint> seq = new Seq<ColorPoint>(stor);
CvInvoke.OpenniGetColorPoints(Ptr, seq, mask);
return seq.ToArray();
}
/*
MCvPoint3D32f[] positions = RetrievePointCloudMap();
if (positions == null)
yield break;
using (Image<Bgr, Byte> image = RetrieveBgrFrame())
using (Image<Gray, Byte> validDepthMap = RetrieveValidDepthMap())
{
int imageWidth = image.Width;
int imageHeight = image.Height;
Byte[] mask = validDepthMap.Bytes;
int i = 0;
for (int h = 0; h < imageHeight; h++)
for (int w = 0; w < imageWidth; w++, i++)
if (mask[i] != 0)
{
ColorPoint cp = new ColorPoint();
cp.Color = new Bgr(image.Data[h, w, 0], image.Data[h, w, 1], image.Data[h, w, 2]);
cp.Position = positions[i];
yield return cp;
}
}*/
}