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

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/kernels/host/custom_crop_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/custom_crop_host.hpp Source File
custom_crop_host.hpp
Go to the documentation of this file.
1 
23 #pragma once
24 
25 #include <hip/hip_runtime.h>
26 
27 #include "operator_types.h"
28 
29 namespace Kernels {
30 namespace Host {
31 template <typename SrcWrapper, typename DstWrapper>
32 void custom_crop(SrcWrapper input, DstWrapper output, Box_t cropRect) {
33  for (int b = 0; b < output.batches(); b++) {
34  for (int i = 0; i < cropRect.width; i++) {
35  for (int j = 0; j < cropRect.height; j++) {
36  int sourceX = i + cropRect.x;
37  int sourceY = j + cropRect.y;
38  output.at(b, j, i, 0) = input.at(b, sourceY, sourceX, 0);
39  }
40  }
41  }
42 }
43 } // namespace Host
44 } // namespace Kernels
void custom_crop(SrcWrapper input, DstWrapper output, Box_t cropRect)
Definition: custom_crop_host.hpp:32
Definition: non_max_suppression_helpers.hpp:26
Definition: operator_types.h:90
int32_t height
width of the box.
Definition: operator_types.h:94
int32_t width
y coordinate of the top-left corner.
Definition: operator_types.h:93
int64_t y
x coordinate of the top-left corner.
Definition: operator_types.h:92
int64_t x
Definition: operator_types.h:91