MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / DrawBox

Function DrawBox

tensorflow/examples/multibox_detector/main.cc:240–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240void DrawBox(const int image_width, const int image_height, int left, int top,
241 int right, int bottom, tensorflow::TTypes<uint8>::Flat* image) {
242 tensorflow::TTypes<uint8>::Flat image_ref = *image;
243
244 top = std::max(0, std::min(image_height - 1, top));
245 bottom = std::max(0, std::min(image_height - 1, bottom));
246
247 left = std::max(0, std::min(image_width - 1, left));
248 right = std::max(0, std::min(image_width - 1, right));
249
250 for (int i = 0; i < 3; ++i) {
251 uint8 val = i == 2 ? 255 : 0;
252 for (int x = left; x <= right; ++x) {
253 image_ref((top * image_width + x) * 3 + i) = val;
254 image_ref((bottom * image_width + x) * 3 + i) = val;
255 }
256 for (int y = top; y <= bottom; ++y) {
257 image_ref((y * image_width + left) * 3 + i) = val;
258 image_ref((y * image_width + right) * 3 + i) = val;
259 }
260 }
261}
262
263// Given the output of a model run, and the name of a file containing the labels
264// this prints out the top five highest-scoring values.

Callers 1

PrintTopDetectionsFunction · 0.70

Calls 2

maxFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected