# Kinect v2 resize depth image and color data to same aspect ratio and size

**URL:** <https://discourse.processing.org/t/kinect-v2-resize-depth-image-and-color-data-to-same-aspect-ratio-and-size/26596>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [December 29, 2020, 8:07pm UTC](https://discourse.processing.org/t/kinect-v2-resize-depth-image-and-color-data-to-same-aspect-ratio-and-size/26596 "2020-12-29T20:07:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ackados](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ackados/32/8282_2.png) [@Ackados](https://discourse.processing.org/u/Ackados)\
**Post date:** [December 29, 2020, 8:07pm UTC](https://discourse.processing.org/t/kinect-v2-resize-depth-image-and-color-data-to-same-aspect-ratio-and-size/26596/1 "2020-12-29T20:07:53Z")

</div>

So the Kinect v2 has a color stream of 1920 x 1080. The depth stream is 512 x 424. The FOV is also different from what I can tell. I tried to resize both streams to 500 x 500 (the size of my canvas).  
[Data from here.](https://www.mcvuk.com/business-news/consoles/next-xbox-leak-reveals-kinect-2-specs/)

```auto
if (img.width >= img.height)
{
	float w = img.width*height/img.height - width;
	image(img, 0 - w/2, 0, img.width*height/img.height, height);
}
else
{
	float h = img.height*width/img.width - height;
	image(img, 0, 0 - h/2, width, img.height*width/img.width);
}

```

However, even when centering the images, they still do not match correctly. One seems a little wider which could be from the FOV. Any suggestions on how to match the color and depth images as close as I can?
