Пример #1
0
    void UpdateTexture(ZigLabelMap labelmap, ZigImage image)
    {
        Color32[] rawImageMap = image.data;
        Debug.Log(rawImageMap.Length);
        short[] rawLabelMap = labelmap.data;
        int labelMapIndex = 0;
        int imageMapIndex = 0;
        int factorX = labelmap.xres / textureSize.Width;
        int factorY = ((labelmap.yres / textureSize.Height) - 1) * labelmap.xres;

        int factorXImage = image.xres / textureSize.Width;
        int factorYImage = ((image.yres / textureSize.Height) - 1) * image.xres;
        // invert Y axis while doing the update
        for (int y = textureSize.Height - 1; y >= 0; --y, imageMapIndex += factorYImage)
        {
            int outputIndex = (y + offsetY) % (textureSize.Height - 1) * textureSize.Width;
            for (int x = 0; x < textureSize.Width; ++x, imageMapIndex += factorXImage, ++outputIndex)
            {
                outputPixels[outputIndex] = rawImageMap[Mathf.Max(0, imageMapIndex + (offsetX % (textureSize.Width * factorXImage)))];//((((textureSize.Height - 1) * factorYImage  - (offsetY % (textureSize.Height * factorYImage))))))];
            }
        }
        for (int y = textureSize.Height - 1; y >= 0; --y, labelMapIndex += factorY)
        {
            int outputIndex = y * textureSize.Width;
            for (int x = 0; x < textureSize.Width; ++x, labelMapIndex += factorX, outputIndex++)
            {
                short label = rawLabelMap[labelMapIndex];
                outputPixels[outputIndex].a = (label>0) ? defaultColor.a : bgColor.a;
            }

        }
        texture.SetPixels32(outputPixels);
        texture.Apply();
    }
Пример #2
0
 public ZigInputKinectOne()
 {
     _sensor   = KinectSensor.GetDefault();
     _mapper   = _sensor.CoordinateMapper;
     _depth    = new KinectOneDepth(_sensor);
     _image    = new KinectOneImage(_sensor);
     _labelMap = new KinectOneLabelMap(_sensor);
 }
 public ZigInputKinectOne()
 {
     _sensor = KinectSensor.GetDefault();
     _mapper = _sensor.CoordinateMapper;
     _depth = new KinectOneDepth(_sensor);
     _image = new KinectOneImage(_sensor);
     _labelMap = new KinectOneLabelMap(_sensor);
 }
Пример #4
0
 void UpdateTexture(ZigLabelMap labelmap)
 {
     short[] rawLabelMap = labelmap.data;
     int labelMapIndex = 0;
     int factorX = labelmap.xres / textureSize.Width;
     int factorY = ((labelmap.yres / textureSize.Height) - 1) * labelmap.xres;
     // invert Y axis while doing the update
     for (int y = textureSize.Height - 1; y >= 0; --y, labelMapIndex += factorY)
     {
         int outputIndex = y * textureSize.Width;
         for (int x = 0; x < textureSize.Width; ++x, labelMapIndex += factorX, ++outputIndex)
         {
             short label = rawLabelMap[labelMapIndex];
             outputPixels[outputIndex] = (label>0) ? ((label <= labelToColor.Length) ? labelToColor[label-1] : defaultColor) : bgColor;                
         }
     }
     texture.SetPixels32(outputPixels);
     texture.Apply();
 }
Пример #5
0
    void UpdateTexture(ZigLabelMap labelmap)
    {
        short[] rawLabelMap   = labelmap.data;
        int     labelMapIndex = 0;
        int     factorX       = labelmap.xres / textureSize.Width;
        int     factorY       = ((labelmap.yres / textureSize.Height) - 1) * labelmap.xres;

        // invert Y axis while doing the update
        for (int y = textureSize.Height - 1; y >= 0; --y, labelMapIndex += factorY)
        {
            int outputIndex = y * textureSize.Width;
            for (int x = 0; x < textureSize.Width; ++x, labelMapIndex += factorX, ++outputIndex)
            {
                short label = rawLabelMap[labelMapIndex];
                outputPixels[outputIndex] = (label > 0) ? ((label <= labelToColor.Length) ? labelToColor[label - 1] : defaultColor) : bgColor;
            }
        }
        texture.SetPixels32(outputPixels);
        texture.Apply();
    }