numpyimage 2.6.4__tar.gz → 2.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {numpyimage-2.6.4/numpyimage.egg-info → numpyimage-2.8.0}/PKG-INFO +1 -1
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/vidio.py +23 -2
- {numpyimage-2.6.4 → numpyimage-2.8.0/numpyimage.egg-info}/PKG-INFO +1 -1
- {numpyimage-2.6.4 → numpyimage-2.8.0}/pyproject.toml +1 -1
- {numpyimage-2.6.4 → numpyimage-2.8.0}/LICENSE +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/README.md +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/__init__.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/align.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/graphics.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/imageio.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/nrrd_utils.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/operations.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/npimage/utils.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/numpyimage.egg-info/SOURCES.txt +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/numpyimage.egg-info/dependency_links.txt +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/numpyimage.egg-info/requires.txt +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/numpyimage.egg-info/top_level.txt +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/setup.cfg +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/tests/test_heic.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/tests/test_pbm.py +0 -0
- {numpyimage-2.6.4 → numpyimage-2.8.0}/tests/test_video.py +0 -0
|
@@ -309,6 +309,20 @@ class VideoStreamer:
|
|
|
309
309
|
else:
|
|
310
310
|
return self.timestep
|
|
311
311
|
|
|
312
|
+
@property
|
|
313
|
+
def framerate(self):
|
|
314
|
+
"""
|
|
315
|
+
Returns the frame rate of the video in frames per second.
|
|
316
|
+
"""
|
|
317
|
+
if self.timestep == 'variable':
|
|
318
|
+
return 1 / self.average_timestep
|
|
319
|
+
else:
|
|
320
|
+
return 1 / self.timestep
|
|
321
|
+
|
|
322
|
+
@property
|
|
323
|
+
def fps(self):
|
|
324
|
+
return self.framerate
|
|
325
|
+
|
|
312
326
|
@property
|
|
313
327
|
def first_frame(self):
|
|
314
328
|
if self._first_frame is None:
|
|
@@ -426,7 +440,13 @@ class VideoWriter:
|
|
|
426
440
|
|
|
427
441
|
def write(self, frame):
|
|
428
442
|
if not isinstance(frame, self.av.VideoFrame):
|
|
429
|
-
if frame
|
|
443
|
+
if not isinstance(frame, np.ndarray):
|
|
444
|
+
frame = np.array(frame)
|
|
445
|
+
if frame.ndim == 4:
|
|
446
|
+
for i in range(frame.shape[0]):
|
|
447
|
+
self.write(frame[i])
|
|
448
|
+
return
|
|
449
|
+
elif frame.ndim == 3 and frame.shape[-1] == 3:
|
|
430
450
|
frame = self.av.VideoFrame.from_ndarray(frame, format='rgb24')
|
|
431
451
|
elif frame.ndim == 3 and frame.shape[-1] == 4:
|
|
432
452
|
# While some video codecs support an alpha channel, most don't,
|
|
@@ -435,7 +455,8 @@ class VideoWriter:
|
|
|
435
455
|
elif frame.ndim == 2:
|
|
436
456
|
frame = self.av.VideoFrame.from_ndarray(frame, format='gray')
|
|
437
457
|
else:
|
|
438
|
-
raise ValueError(
|
|
458
|
+
raise ValueError('Frame must have shape (H, W) (H, W, 3) (H, W, 4)'
|
|
459
|
+
f' (t, H, W, 3) or (t, H, W, 4) but was {frame.shape}')
|
|
439
460
|
if self.stream.width == 0:
|
|
440
461
|
self.stream.width = frame.width
|
|
441
462
|
if self.stream.height == 0:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|