scope 0.5.3__tar.gz → 0.5.4__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.
- {scope-0.5.3 → scope-0.5.4}/PKG-INFO +1 -1
- {scope-0.5.3 → scope-0.5.4}/requirements.txt +1 -0
- {scope-0.5.3 → scope-0.5.4}/scope/__init__.py +1 -1
- {scope-0.5.3 → scope-0.5.4}/scope/formats.py +41 -0
- {scope-0.5.3 → scope-0.5.4}/scope/writer.py +1 -2
- {scope-0.5.3 → scope-0.5.4}/README.md +0 -0
- {scope-0.5.3 → scope-0.5.4}/scope/reader.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/setup.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/tests/test_float.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/tests/test_image.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/tests/test_video.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/__init__.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/__main__.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/config.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/assets/index-B4vKLOLB.js +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/assets/index-DlmV1_Hx.css +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/assets/material-symbols-DplPX30d.woff2 +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/favicon.png +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/index.html +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/dist/logo.png +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/filesystems.py +0 -0
- {scope-0.5.3 → scope-0.5.4}/viewer/server.py +0 -0
|
@@ -176,6 +176,47 @@ class Video:
|
|
|
176
176
|
return files_length(path)
|
|
177
177
|
|
|
178
178
|
|
|
179
|
+
class MediapyVideo:
|
|
180
|
+
|
|
181
|
+
def __init__(self, ext='mp4', fps=10):
|
|
182
|
+
self.ext = ext
|
|
183
|
+
self.fps = fps
|
|
184
|
+
|
|
185
|
+
@property
|
|
186
|
+
def extension(self):
|
|
187
|
+
return self.ext
|
|
188
|
+
|
|
189
|
+
def valid(self, x):
|
|
190
|
+
return (
|
|
191
|
+
isinstance(x, np.ndarray) and
|
|
192
|
+
x.dtype == np.uint8 and
|
|
193
|
+
x.ndim == 4 and
|
|
194
|
+
x.shape[-1] in (1, 3))
|
|
195
|
+
|
|
196
|
+
def convert(self, x):
|
|
197
|
+
return x
|
|
198
|
+
|
|
199
|
+
def create(self, path):
|
|
200
|
+
path.mkdir(exist_ok=True)
|
|
201
|
+
|
|
202
|
+
def write(self, path, steps, values):
|
|
203
|
+
files_write(path, steps, values, self.encode)
|
|
204
|
+
|
|
205
|
+
def read(self, path):
|
|
206
|
+
return files_read(path)
|
|
207
|
+
|
|
208
|
+
def encode(self, value):
|
|
209
|
+
import mediapy
|
|
210
|
+
return mediapy.compress_video(value, fps=self.fps)
|
|
211
|
+
|
|
212
|
+
def decode(self, buffer):
|
|
213
|
+
import mediapy
|
|
214
|
+
return mediapy.decompress_video(buffer)
|
|
215
|
+
|
|
216
|
+
def length(self, path):
|
|
217
|
+
return files_length(path)
|
|
218
|
+
|
|
219
|
+
|
|
179
220
|
def table_append(filename, fmt, *cols):
|
|
180
221
|
rows = tuple(zip(*cols))
|
|
181
222
|
size = struct.calcsize(fmt)
|
|
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
|