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 File Reference

Go to the source code of this file.

Functions

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)

Function Documentation

◆ face_follow_detect()

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 )

The caller supplies a 0x9000-byte result buffer and packed BGR input.

Definition at line 4 of file face_detect.cpp.

5 {
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}
unsigned int height
Definition fft.c:23
unsigned int width
Definition fft.c:23

References height, and width.

Referenced by face_follow_image_process().