title: Kinect v2 for windows: resize color frame in c#
body: <p>anyone know, if it's possible, how to decrease the kinect frame resolution for color flow? because the full-hd size is too high for my scope.Thanks
  I have found this code for full hd frame:</p>
  
  <pre><code>private BitmapSource ToBitmap(ColorFrame frame)
      {
          int width = frame.FrameDescription.Width;
          int height = frame.FrameDescription.Height;
          PixelFormat format = PixelFormats.Bgr32;
  
          byte[] pixels = new byte[width * height * ((PixelFormats.Bgr32.BitsPerPixel + 7) / 8)];
  
          if (frame.RawColorImageFormat == ColorImageFormat.Bgra)
          {
              frame.CopyRawFrameDataToArray(pixels);
          }
          else
          {
              frame.CopyConvertedFrameDataToArray(pixels, ColorImageFormat.Bgra);
          }
  
          int stride = width * format.BitsPerPixel / 8;
  
  
  
          return BitmapSource.Create(width, height, 96, 96, format, null, pixels, stride);
  
  
      }
  </code></pre>