ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
face_detect.cpp
Go to the documentation of this file.
1#include "facedetectcnn.h"
3
4extern "C" void face_follow_detect(unsigned char *results, unsigned char *bgr,
5 int width, int height,
7 size_t capacity, size_t *count) {
8 *count = 0;
9 int *detections = facedetect_cnn(results, bgr, width, height, width * 3);
10 if (!detections)
11 return;
12 for (int i = 0; i < detections[0] && *count < capacity; i++) {
13 // The upstream format is an int count followed by 16-short records.
14 const unsigned char *record =
15 results + sizeof(int) + static_cast<size_t>(i) * 16 * sizeof(short);
16 const short *face = reinterpret_cast<const short *>(record);
17 faces[*count] = {{static_cast<float>(face[1]) / width,
18 static_cast<float>(face[2]) / height,
19 static_cast<float>(face[3]) / width,
20 static_cast<float>(face[4]) / height},
21 static_cast<float>(face[0]) / 100.0f};
22 ++*count;
23 }
24}
void face_follow_detect(unsigned char *results, unsigned char *bgr, int width, int height, face_follow_detection_t *faces, size_t capacity, size_t *count)
unsigned int height
Definition fft.c:24
unsigned int width
Definition fft.c:24