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