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 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.

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

References height, and width.

Referenced by FaceFollowBinding::detect(), and face_follow_image_process().