Grid
- class tools.manual.face_viewer.frame.Grid(canvas: FacesViewer, detected_faces: DetectedFaces)
Bases:
objectHolds information on the current filtered grid layout.
The grid keeps information on frame indices, face indices, x and y positions and detected face objects laid out in a numpy array to reflect the current full layout of faces within the face viewer based on the currently selected filter and face thumbnail size.
- Parameters:
canvas (
FacesViewer) – TheFacesViewercanvasdetected_faces (
DetectedFaces) – TheDetectedFaceobjects for this video
Attributes Summary
the (columns, rows) required to hold all display images.
The (width, height) required to hold all display images.
The pixel size of each thumbnail within the face viewer.
Trueif the current filter means that the grid holds faces.Tuple containing 2 arrays.
Methods Summary
frame_has_faces(frame_index)Check whether the given frame index contains any faces.
transport_index_from_frame(frame_index)Return the main frame's transport index for the given frame index based on the current filter criteria.
update()Update the underlying grid.
y_coord_from_frame(frame_index)Return the y coordinate for the first face that appears in the given frame.
Attributes Documentation
- columns_rows
the (columns, rows) required to hold all display images.
- Type:
tuple
- dimensions
The (width, height) required to hold all display images.
- Type:
tuple
- face_size
The pixel size of each thumbnail within the face viewer.
- Type:
int
- is_valid
Trueif the current filter means that the grid holds faces.Falseif there are no faces displayed in the grid.- Type:
bool
- visible_area
Tuple containing 2 arrays.
1st array contains an array of shape (4, rows, columns) corresponding to the viewable area of the display grid. 1st dimension contains frame indices, 2nd dimension face indices. The 3rd and 4th dimension contain the x and y position of the top left corner of the face respectively.
2nd array contains
DetectedFaceobjects laid out in (rows, columns)Any locations that are not populated by a face will have a frame and face index of -1
- Type:
tuple[
numpy.ndarray,numpy.ndarray]
Methods Documentation
- frame_has_faces(frame_index: int) bool | bool
Check whether the given frame index contains any faces.
- Parameters:
frame_index (int) – The frame index to locate in the grid
- Returns:
Trueif there are faces in the given frame otherwiseFalse- Return type:
bool
- transport_index_from_frame(frame_index: int) int | None
Return the main frame’s transport index for the given frame index based on the current filter criteria.
- Parameters:
frame_index (int) – The absolute index for the frame within the full frames list
- Returns:
The index of the requested frame within the filtered frames view. None if no valid frames
- Return type:
int | None
- update() None
Update the underlying grid.
Called on initialization, on a filter change or on add/remove faces. Recalculates the underlying grid for the current filter view and updates the attributes
_grid,_display_faces,_raw_indices,_frames_listandis_valid- Return type:
None
- y_coord_from_frame(frame_index: int) int
Return the y coordinate for the first face that appears in the given frame.
- Parameters:
frame_index (int) – The frame index to locate in the grid
- Returns:
The y coordinate of the first face for the given frame
- Return type:
int
- property columns_rows: tuple[int, int]
the (columns, rows) required to hold all display images.
- Type:
tuple
- property dimensions: tuple[int, int]
The (width, height) required to hold all display images.
- Type:
tuple
- property face_size: int
The pixel size of each thumbnail within the face viewer.
- Type:
int
- frame_has_faces(frame_index: int) bool | bool
Check whether the given frame index contains any faces.
- Parameters:
frame_index (int) – The frame index to locate in the grid
- Returns:
Trueif there are faces in the given frame otherwiseFalse- Return type:
bool
- property is_valid: bool
Trueif the current filter means that the grid holds faces.Falseif there are no faces displayed in the grid.- Type:
bool
- transport_index_from_frame(frame_index: int) int | None
Return the main frame’s transport index for the given frame index based on the current filter criteria.
- Parameters:
frame_index (int) – The absolute index for the frame within the full frames list
- Returns:
The index of the requested frame within the filtered frames view. None if no valid frames
- Return type:
int | None
- update() None
Update the underlying grid.
Called on initialization, on a filter change or on add/remove faces. Recalculates the underlying grid for the current filter view and updates the attributes
_grid,_display_faces,_raw_indices,_frames_listandis_valid- Return type:
None
- property visible_area: tuple[ndarray, ndarray]
Tuple containing 2 arrays.
1st array contains an array of shape (4, rows, columns) corresponding to the viewable area of the display grid. 1st dimension contains frame indices, 2nd dimension face indices. The 3rd and 4th dimension contain the x and y position of the top left corner of the face respectively.
2nd array contains
DetectedFaceobjects laid out in (rows, columns)Any locations that are not populated by a face will have a frame and face index of -1
- Type:
tuple[
numpy.ndarray,numpy.ndarray]
- y_coord_from_frame(frame_index: int) int
Return the y coordinate for the first face that appears in the given frame.
- Parameters:
frame_index (int) – The frame index to locate in the grid
- Returns:
The y coordinate of the first face for the given frame
- Return type:
int