2D Point Downscaling To Smaller Resolution

148 Views Asked by At

So I have two datasets of points. One dataset is taken in 1920x1080 resolution, and the other is taken at a measly 224x172 resolution.

Here's my challenge. On the 1920x1080 resolution, I take 4 points that form a square (I box in something on an image, and the 4 corners of the box are given to me in pixel coordinates). I then try to downscale each corner to the 224x172 resolution (because that's the native resolution of the depth camera with the depth data I'm trying to capture within my selected region).

So my current calculations for each corner are as follows:

minimumPixelX = (minimumPixelX / (1920/224))

minimumPixelY = (minimumPixelY / (1080/172))

maximumPixelX = (maximumPixelX / (1920/224))

maximumPixelY = (maximumPixelY / (1080/172))

Of course the square ends up being (minX, maxY), (minX, minY), (maxX, minY), (maxX, maxY) in counterclockwise order starting at the top left corner.

The issue I'm having is that my 1920x1080 downscaling calculation does not ACCURATELY (the word accurately is key here, as I need to be as accurate as possible) capture the correlating data in the 224x172 region. I assume that it's because of such a large resolution discrepancy and that both resolutions have different aspect ratios, but my feeble math mind could very well be wrong.

TL:DR... Is there any way to accurately downscale a 2D point from 1920x1080 to 224x172? Please let me know if I missed any information that you may need.

1

There are 1 best solutions below

0
On

The key to doing image (or grid) rescaling correctly is to create a continuous model using the original discrete data and then sample the continuous model at the target resolution.

A simple continuous model is given by bilinear interpolation but there are more sophisticated ones such as bicubic interpolation. See Wikpedia.