public PointCloud(SensorImage depthImage, SensorImage rgbImage, float focal) { int width = depthImage.width; int height = depthImage.height; float invFocal = 1.0f / focal; Points = new Point[width * height]; for (int v = 0; v < height; v++) { for (int u = 0; u < width; u++) { float depth = 0;// depthImage[u, v]; if (depth == 0) { Points[u + v * width].x = float.NaN; Points[u + v * width].y = float.NaN; Points[u + v * width].z = float.NaN; Points[u + v * width].rgb = new int[] { 0, 0, 0 }; } else { Points[u + v * width].z = depth * invFocal; Points[u + v * width].x = u * depth * invFocal; Points[u + v * width].y = v * depth * invFocal; Points[u + v * width].rgb = new int[] { 0, 0, 0 };// rgbImage[u,v]; } } } }
private void ReceiveMessage(object sender, MessageEventArgs e) { imageData = ((SensorImage)e.Message); // Debug.Log(imageData.encoding); isMessageReceived = true; }