/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/kernels/host/warp_perspective_host.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/kernels/host/warp_perspective_host.hpp Source File#

2 min read time

Applies to Linux

rocCV: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/kernels/host/warp_perspective_host.hpp Source File
warp_perspective_host.hpp
Go to the documentation of this file.
1 
23 #pragma once
24 
25 #include <hip/hip_runtime.h>
26 
27 namespace Kernels {
28 namespace Host {
29 template <typename SrcWrapper, typename DstWrapper, typename Mat>
30 void warp_perspective(SrcWrapper input, DstWrapper output, Mat mat) {
31  for (int b = 0; b < output.batches(); b++) {
32  for (int y = 0; y < output.height(); y++) {
33  for (int x = 0; x < output.width(); x++) {
34  const float coeff = 1.0f / (mat[6] * x + mat[7] * y + mat[8]);
35  const float ox = (mat[0] * x + mat[1] * y + mat[2]) * coeff;
36  const float oy = (mat[3] * x + mat[4] * y + mat[5]) * coeff;
37 
38  output.at(b, y, x, 0) = input.at(b, oy, ox, 0);
39  }
40  }
41  }
42 }
43 } // namespace Host
44 } // namespace Kernels
void warp_perspective(SrcWrapper input, DstWrapper output, Mat mat)
Definition: warp_perspective_host.hpp:30
Definition: non_max_suppression_helpers.hpp:26