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]; } } } }
void ReleaseDesignerOutlets() { if (GpsImage != null) { GpsImage.Dispose(); GpsImage = null; } if (LastUpdateText != null) { LastUpdateText.Dispose(); LastUpdateText = null; } if (SensorImage != null) { SensorImage.Dispose(); SensorImage = null; } if (StartTimeText != null) { StartTimeText.Dispose(); StartTimeText = null; } if (SubView != null) { SubView.Dispose(); SubView = null; } if (TelemetryImage != null) { TelemetryImage.Dispose(); TelemetryImage = null; } }