select_faces: Select faces to analyse

View source: R/detect_faces.R

select_facesR Documentation

Select faces to analyse

Description

Keeps the faces of a detect_faces result that a rule, face numbers, tracks or people pick. The result can be passed to face_scores, or as face_selection to image_scores or video_scores. Ordinary subsetting (for example faces[faces$person_id == "p1", ]) works as well.

Usage

select_faces(
  faces,
  rule = c("all", "largest", "left", "right"),
  ids = NULL,
  tracks = NULL,
  persons = NULL
)

Arguments

faces

A data frame returned by detect_faces.

rule

"all" (default), or "largest", "left" or "right" to keep one face per image or frame, with the rules of face_selection in image_scores.

ids

Face numbers to keep (the face column).

tracks

Video track ids to keep (the track_id column).

persons

Person ids to keep (the person_id column), for example "p1".

Value

The selected rows of faces, with its attributes.

Examples

faces <- data.frame(
  source = "group.jpg", frame = NA, face = 1:3, person_id = c("p1", "p2", "p3"),
  x = c(10, 200, 400), y = 50, width = c(80, 120, 60), height = c(80, 120, 60)
)
select_faces(faces, rule = "largest")
select_faces(faces, persons = c("p1", "p3"))


transforEmotion documentation built on Oct. 26, 2026, 5:07 p.m.