MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / Array2Poly

Function Array2Poly

paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55template <class T>
56void Array2Poly(const T* box, const size_t box_size, funcs::gpc_polygon* poly) {
57 size_t pts_num = box_size / 2;
58 (*poly).num_contours = 1;
59 (*poly).hole = reinterpret_cast<int*>(malloc(sizeof(int))); // NOLINT
60 (*poly).hole[0] = 0;
61 (*poly).contour = (funcs::gpc_vertex_list*)malloc( // NOLINT
62 sizeof(funcs::gpc_vertex_list));
63 (*poly).contour->num_vertices = static_cast<int>(pts_num);
64 (*poly).contour->vertex = (funcs::gpc_vertex*)malloc( // NOLINT
65 sizeof(funcs::gpc_vertex) * pts_num);
66 for (size_t i = 0; i < pts_num; ++i) {
67 (*poly).contour->vertex[i].x = box[2 * i];
68 (*poly).contour->vertex[i].y = box[2 * i + 1];
69 }
70}
71
72template <class T>
73void PointVec2Poly(const std::vector<Point_<T>>& vec,

Callers

nothing calls this directly

Calls 1

mallocFunction · 0.85

Tested by

no test coverage detected