1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace bbiwarg.DataSource
- {
- /**
- * Gives access to all important data in depth image coordinates.
- */
- class ImageData
- {
- private DepthImage depthImage;
- private ConfidenceImage confidenceImage;
- private ColorImage colorImage;
- private UVImage uvImage;
- public ImageData(DepthImage depthImage, ConfidenceImage confidenceImage, ColorImage colorImage, UVImage uvImage)
- {
- this.depthImage = depthImage;
- this.confidenceImage = confidenceImage;
- this.colorImage = colorImage;
- this.uvImage = uvImage;
- }
- public int getWidth()
- {
- return depthImage.getWidth();
- }
- public int getHeight()
- {
- return depthImage.getHeight();
- }
- public short getDepth(int x, int y)
- {
- return depthImage.getDepth(x, y);
- }
- public float getConfidence(int x, int y)
- {
- return confidenceImage.getConfidence(x, y);
- }
- public Color4 getColor(int x, int y)
- {
- float u = uvImage.getU(x, y);
- float v = uvImage.getV(x, y);
- int xInColorImage = (int) u * colorImage.getWidth();
- int yInColorImage = (int) v * colorImage.getHeight();
- return colorImage.getColor(xInColorImage, yInColorImage);
- }
- }
- }
|