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

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