Skip to content

Commit 7f67734

Browse files
committed
Add pose attribute to DLCLive class
Introduces a new 'pose' attribute to the DLCLive class, initialized as None or a numpy ndarray. This prepares the class for storing pose data.
1 parent fd05cef commit 7f67734

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

dlclive/dlclive.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
Licensed under GNU Lesser General Public License v3.0
66
"""
7+
78
from __future__ import annotations
89

910
from pathlib import Path
@@ -197,12 +198,12 @@ def __init__(
197198
self.processor = processor
198199
self.convert2rgb = convert2rgb
199200

201+
self.pose: np.ndarray | None = None
202+
200203
if isinstance(display, Display):
201204
self.display = display
202205
elif display:
203-
self.display = Display(
204-
pcutoff=pcutoff, radius=display_radius, cmap=display_cmap
205-
)
206+
self.display = Display(pcutoff=pcutoff, radius=display_radius, cmap=display_cmap)
206207
else:
207208
self.display = None
208209

@@ -250,9 +251,7 @@ def process_frame(self, frame: np.ndarray) -> np.ndarray:
250251
processed frame: convert type, crop, convert color
251252
"""
252253
if self.cropping:
253-
frame = frame[
254-
self.cropping[2] : self.cropping[3], self.cropping[0] : self.cropping[1]
255-
]
254+
frame = frame[self.cropping[2] : self.cropping[3], self.cropping[0] : self.cropping[1]]
256255

257256
if self.dynamic[0]:
258257
if self.pose is not None:
@@ -263,9 +262,7 @@ def process_frame(self, frame: np.ndarray) -> np.ndarray:
263262
elif len(self.pose) == 1:
264263
pose = self.pose[0]
265264
else:
266-
raise ValueError(
267-
"Cannot use Dynamic Cropping - more than 1 individual found"
268-
)
265+
raise ValueError("Cannot use Dynamic Cropping - more than 1 individual found")
269266

270267
else:
271268
pose = self.pose

0 commit comments

Comments
 (0)