CameraBase

class CameraBase[source]

Bases: object

Base class for Camera interface.

area1

Coordinates for area 1.

Type:

list[int]

area2

Coordinates for area 2.

Type:

list[int]

area3

Coordinates for area 3.

Type:

list[int]

area4

Coordinates for area 4.

Type:

list[int]

areas

List of all area coordinates.

Type:

list[list[int]]

area1_is_triggered

Trigger status for area 1.

Type:

bool

area2_is_triggered

Trigger status for area 2.

Type:

bool

area3_is_triggered

Trigger status for area 3.

Type:

bool

area4_is_triggered

Trigger status for area 4.

Type:

bool

change

Flag for property changes.

Type:

bool

annotation

Current annotation text.

Type:

str

path_picture

Path to save pictures.

Type:

str

error

Error message.

Type:

str

trial

Current trial number.

Type:

int

is_recording

Recording status.

Type:

bool

show_time_info

Time info display flag.

Type:

bool

x_position

X coordinate of tracked object.

Type:

int

y_position

Y coordinate of tracked object.

Type:

int

chrono

Timer utility.

Type:

time_utils.Chrono

__init__()

Methods

__init__()

area_1_empty()

Checks if area 1 is empty.

area_2_empty()

Checks if area 2 is empty.

area_3_empty()

Checks if area 3 is empty.

area_4_empty()

Checks if area 4 is empty.

areas_corridor_ok()

Checks corridor areas status.

pre_process(request)

Preprocessing callback for frames.

print_info_about_config()

Prints camera configuration info.

start_camera()

Starts the camera.

start_preview_window()

Starts the preview window.

start_recording([path_video, path_csv])

Starts recording.

stop_camera()

Stops the camera.

stop_preview_window()

Stops the preview window.

stop_recording()

Stops recording.

take_picture()

Takes a picture.

write_text(text)

Writes text annotation to the frame.

Attributes

area1: list[int] = []
area2: list[int] = []
area3: list[int] = []
area4: list[int] = []
areas: list[list[int]] = []
area1_is_triggered: bool = False
area2_is_triggered: bool = False
area3_is_triggered: bool = False
area4_is_triggered: bool = False
change: bool = False
annotation: str = ''
path_picture: str = ''
error: str = 'Error connecting to the camera '
trial: int = -1
is_recording: bool = False
show_time_info: bool = False
x_position: int = -1
y_position: int = -1
chrono = <village.scripts.time_utils.TimeUtils.Chrono object>
start_camera() None[source]

Starts the camera.

stop_camera() None[source]

Stops the camera.

start_preview_window() <MagicMock name='mock.QWidget' id='140286155962896'>[source]

Starts the preview window.

Returns:

A QWidget for the preview.

Return type:

QWidget

stop_preview_window() None[source]

Stops the preview window.

start_recording(path_video: str = '', path_csv: str = '') None[source]

Starts recording.

Parameters:
  • path_video (str) – Path for video file.

  • path_csv (str) – Path for CSV data.

stop_recording() None[source]

Stops recording.

print_info_about_config() None[source]

Prints camera configuration info.

pre_process(request) None[source]

Preprocessing callback for frames.

Parameters:

request – The request object.

write_text(text: str) None[source]

Writes text annotation to the frame.

Parameters:

text (str) – The text to write.

areas_corridor_ok() bool[source]

Checks corridor areas status.

Returns:

True if OK.

Return type:

bool

area_1_empty() bool[source]

Checks if area 1 is empty.

Returns:

True if empty.

Return type:

bool

area_2_empty() bool[source]

Checks if area 2 is empty.

Returns:

True if empty.

Return type:

bool

area_3_empty() bool[source]

Checks if area 3 is empty.

Returns:

True if empty.

Return type:

bool

area_4_empty() bool[source]

Checks if area 4 is empty.

Returns:

True if empty.

Return type:

bool

take_picture() None[source]

Takes a picture.