MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / draw_detection_rectangle

Function draw_detection_rectangle

utils/Utils.cpp:127–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125#endif /* BENCHMARK_EXAMPLES */
126
127void draw_detection_rectangle(ITensor *tensor, const DetectionWindow &rect, uint8_t r, uint8_t g, uint8_t b)
128{
129 ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(tensor, Format::RGB888);
130
131 uint8_t *top = tensor->info()->offset_element_in_bytes(Coordinates(rect.x, rect.y)) + tensor->buffer();
132 uint8_t *bottom =
133 tensor->info()->offset_element_in_bytes(Coordinates(rect.x, rect.y + rect.height)) + tensor->buffer();
134 uint8_t *left = top;
135 uint8_t *right =
136 tensor->info()->offset_element_in_bytes(Coordinates(rect.x + rect.width, rect.y)) + tensor->buffer();
137 size_t stride = tensor->info()->strides_in_bytes()[Window::DimY];
138
139 for (size_t x = 0; x < rect.width; ++x)
140 {
141 top[0] = r;
142 top[1] = g;
143 top[2] = b;
144 bottom[0] = r;
145 bottom[1] = g;
146 bottom[2] = b;
147
148 top += 3;
149 bottom += 3;
150 }
151
152 for (size_t y = 0; y < rect.height; ++y)
153 {
154 left[0] = r;
155 left[1] = g;
156 left[2] = b;
157 right[0] = r;
158 right[1] = g;
159 right[2] = b;
160
161 left += stride;
162 right += stride;
163 }
164}
165
166ImageType get_image_type_from_file(const std::string &filename)
167{

Callers

nothing calls this directly

Calls 4

CoordinatesClass · 0.50
infoMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected