CV-CUDA
CV-CUDA copied to clipboard
[QUESTION] Difference between CV-CUDA resize and OpenCV resize
We found that the way of calculating coordinate mapping in CV-CUDA's resize is different from that of OpenCV (as shown in the pseudo-code in the figure below):
- OpenCV uses float64, and CV-CUDA uses float32
- OpenCV uses
inv_scale = target_size / size, and CV-CUDA usesscale = size / target_size
Due to floating-point calculation errors, the coordinates calculated by OpenCV and CV-CUDA will have a deviation, leading to differences in the final results. For example:
- Python 3:
125 / np.float32(500 / 480) = 120.00000457763689 -> math.floor(120.00000457763689) = 120 - Python 3:
125 / np.float64(500 / 480) = 119.99999999999999 -> math.floor(119.99999999999999) = 119 - CUDA:
float32(500 / 480) * 120 = 124.999992 -> __float2int_rd(124.999992) = 124
Does CV-CUDA do this for efficiency?
