vidformer 0.6.0__py3-none-any.whl → 0.6.1__py3-none-any.whl

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.
vidformer/__init__.py CHANGED
@@ -1,5 +1,5 @@
1
1
  """A Python library for creating and viewing videos with vidformer."""
2
2
 
3
- __version__ = "0.6.0"
3
+ __version__ = "0.6.1"
4
4
 
5
5
  from .vf import *
vidformer/cv2/vf_cv2.py CHANGED
@@ -1,5 +1,10 @@
1
1
  from .. import vf
2
2
 
3
+ try:
4
+ import cv2 as _opencv2
5
+ except:
6
+ _opencv2 = None
7
+
3
8
  import uuid
4
9
  from fractions import Fraction
5
10
  from bisect import bisect_right
@@ -28,6 +33,10 @@ LINE_AA = 16
28
33
  _filter_scale = vf.Filter("Scale")
29
34
  _filter_rectangle = vf.Filter("cv2.rectangle")
30
35
  _filter_putText = vf.Filter("cv2.putText")
36
+ _filter_arrowedLine = vf.Filter("cv2.arrowedLine")
37
+ _filter_line = vf.Filter("cv2.line")
38
+ _filter_circle = vf.Filter("cv2.circle")
39
+ _filter_addWeighted = vf.Filter("cv2.addWeighted")
31
40
 
32
41
 
33
42
  def _ts_to_fps(timestamps):
@@ -234,3 +243,186 @@ def putText(
234
243
  args.append(bottomLeftOrigin)
235
244
 
236
245
  img._f = _filter_putText(img._f, text, org, fontFace, fontScale, color, *args)
246
+
247
+
248
+ def arrowedLine(
249
+ img, pt1, pt2, color, thickness=None, line_type=None, shift=None, tipLength=None
250
+ ):
251
+ """
252
+ cv.arrowedLine( img, pt1, pt2, color[, thickness[, line_type[, shift[, tipLength]]]] )
253
+ """
254
+ assert isinstance(img, _Frame)
255
+ img._mut()
256
+
257
+ assert len(pt1) == 2
258
+ assert len(pt2) == 2
259
+ assert all(isinstance(x, int) for x in pt1)
260
+ assert all(isinstance(x, int) for x in pt2)
261
+
262
+ assert len(color) == 3 or len(color) == 4
263
+ color = [float(x) for x in color]
264
+ if len(color) == 3:
265
+ color.append(255.0)
266
+
267
+ args = []
268
+ if thickness is not None:
269
+ assert isinstance(thickness, int)
270
+ args.append(thickness)
271
+ if line_type is not None:
272
+ assert isinstance(line_type, int)
273
+ assert thickness is not None
274
+ args.append(line_type)
275
+ if shift is not None:
276
+ assert isinstance(shift, int)
277
+ assert shift is not None
278
+ args.append(shift)
279
+ if tipLength is not None:
280
+ assert isinstance(tipLength, float)
281
+ assert shift is not None
282
+ args.append(tipLength)
283
+
284
+ img._f = _filter_arrowedLine(img._f, pt1, pt2, color, *args)
285
+
286
+
287
+ def line(img, pt1, pt2, color, thickness=None, lineType=None, shift=None):
288
+ assert isinstance(img, _Frame)
289
+ img._mut()
290
+
291
+ assert len(pt1) == 2
292
+ assert len(pt2) == 2
293
+ assert all(isinstance(x, int) for x in pt1)
294
+ assert all(isinstance(x, int) for x in pt2)
295
+
296
+ assert len(color) == 3 or len(color) == 4
297
+ color = [float(x) for x in color]
298
+ if len(color) == 3:
299
+ color.append(255.0)
300
+
301
+ args = []
302
+ if thickness is not None:
303
+ assert isinstance(thickness, int)
304
+ args.append(thickness)
305
+ if lineType is not None:
306
+ assert isinstance(lineType, int)
307
+ assert thickness is not None
308
+ args.append(lineType)
309
+ if shift is not None:
310
+ assert isinstance(shift, int)
311
+ assert shift is not None
312
+ args.append(shift)
313
+
314
+ img._f = _filter_line(img._f, pt1, pt2, color, *args)
315
+
316
+
317
+ def circle(img, center, radius, color, thickness=None, lineType=None, shift=None):
318
+ assert isinstance(img, _Frame)
319
+ img._mut()
320
+
321
+ assert len(center) == 2
322
+ assert all(isinstance(x, int) for x in center)
323
+
324
+ assert isinstance(radius, int)
325
+
326
+ assert len(color) == 3 or len(color) == 4
327
+ color = [float(x) for x in color]
328
+ if len(color) == 3:
329
+ color.append(255.0)
330
+
331
+ args = []
332
+ if thickness is not None:
333
+ assert isinstance(thickness, int)
334
+ args.append(thickness)
335
+ if lineType is not None:
336
+ assert isinstance(lineType, int)
337
+ assert thickness is not None
338
+ args.append(lineType)
339
+ if shift is not None:
340
+ assert isinstance(shift, int)
341
+ assert shift is not None
342
+ args.append(shift)
343
+
344
+ img._f = _filter_circle(img._f, center, radius, color, *args)
345
+
346
+
347
+ def getFontScaleFromHeight(*args, **kwargs):
348
+ """
349
+ cv.getFontScaleFromHeight( fontFace, pixelHeight[, thickness] )
350
+ """
351
+ if _opencv2 is None:
352
+ raise NotImplementedError("getFontScaleFromHeight requires the cv2 module")
353
+ return _opencv2.getFontScaleFromHeight(*args, **kwargs)
354
+
355
+
356
+ def getTextSize(*args, **kwargs):
357
+ """
358
+ cv.getTextSize( text, fontFace, fontScale, thickness )
359
+ """
360
+ if _opencv2 is None:
361
+ raise NotImplementedError("getTextSize requires the cv2 module")
362
+ return _opencv2.getTextSize(*args, **kwargs)
363
+
364
+
365
+ def addWeighted(src1, alpha, src2, beta, gamma, dst=None, dtype=-1):
366
+ """
367
+ cv.addWeighted( src1, alpha, src2, beta, gamma[, dst[, dtype]] ) -> dst
368
+ """
369
+ assert isinstance(src1, _Frame)
370
+ assert isinstance(src2, _Frame)
371
+ src1._mut()
372
+ src2._mut()
373
+
374
+ if dst is None:
375
+ dst = _Frame(src1._f)
376
+ else:
377
+ assert isinstance(dst, _Frame)
378
+ dst._mut()
379
+
380
+ assert isinstance(alpha, float) or isinstance(alpha, int)
381
+ assert isinstance(beta, float) or isinstance(beta, int)
382
+ assert isinstance(gamma, float) or isinstance(gamma, int)
383
+ alpha = float(alpha)
384
+ beta = float(beta)
385
+ gamma = float(gamma)
386
+
387
+ if dtype != -1:
388
+ raise Exception("addWeighted does not support the dtype argument")
389
+
390
+ dst._f = _filter_addWeighted(src1._f, alpha, src2._f, beta, gamma)
391
+ return dst
392
+
393
+
394
+ # Stubs for unimplemented functions
395
+
396
+
397
+ def clipLine(*args, **kwargs):
398
+ raise NotImplementedError("clipLine is not yet implemented in the cv2 frontend")
399
+
400
+
401
+ def drawContours(*args, **kwargs):
402
+ raise NotImplementedError("drawContours is not yet implemented in the cv2 frontend")
403
+
404
+
405
+ def drawMarker(*args, **kwargs):
406
+ raise NotImplementedError("drawMarker is not yet implemented in the cv2 frontend")
407
+
408
+
409
+ def ellipse(*args, **kwargs):
410
+ raise NotImplementedError("ellipse is not yet implemented in the cv2 frontend")
411
+
412
+
413
+ def ellipse2Poly(*args, **kwargs):
414
+ raise NotImplementedError("ellipse2Poly is not yet implemented in the cv2 frontend")
415
+
416
+
417
+ def fillConvexPoly(*args, **kwargs):
418
+ raise NotImplementedError(
419
+ "fillConvexPoly is not yet implemented in the cv2 frontend"
420
+ )
421
+
422
+
423
+ def fillPoly(*args, **kwargs):
424
+ raise NotImplementedError("fillPoly is not yet implemented in the cv2 frontend")
425
+
426
+
427
+ def polylines(*args, **kwargs):
428
+ raise NotImplementedError("polylines is not yet implemented in the cv2 frontend")
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.1
2
+ Name: vidformer
3
+ Version: 0.6.1
4
+ Summary: A Python library for creating and viewing videos with vidformer.
5
+ Author-email: Dominik Winecki <dominikwinecki@gmail.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Dist: requests
11
+ Requires-Dist: msgpack
12
+ Requires-Dist: numpy
13
+ Project-URL: Documentation, https://ixlab.github.io/vidformer/vidformer-py/
14
+ Project-URL: Homepage, https://ixlab.github.io/vidformer/
15
+ Project-URL: Issues, https://github.com/ixlab/vidformer/issues
16
+
17
+ # vidformer-py
18
+
19
+ [![PyPI version](https://img.shields.io/pypi/v/vidformer.svg)](https://pypi.org/project/vidformer/)
20
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/ixlab/vidformer/blob/main/LICENSE)
21
+
22
+
23
+ vidformer-py is our Python 🐍 interface for [vidformer](https://github.com/ixlab/vidformer).
24
+ Our [getting started guide](https://ixlab.github.io/vidformer/getting-started.html) explains how to use it.
25
+
26
+ **Quick links:**
27
+ * [📦 PyPI](https://pypi.org/project/vidformer/)
28
+ * [📘 Documentation](https://ixlab.github.io/vidformer/vidformer-py/)
29
+ * [🧑‍💻 Source Code](https://github.com/ixlab/vidformer/tree/main/vidformer-py/)
30
+
31
+ **Publish:**
32
+ ```bash
33
+ export FLIT_USERNAME='__token__' FLIT_PASSWORD='<token>'
34
+ flit publish
35
+ ```
36
+
@@ -0,0 +1,7 @@
1
+ vidformer/__init__.py,sha256=C-kb3m7hPUh0Sw09vty3JKJHMbJTQcdqSmt8m2V9HIM,113
2
+ vidformer/vf.py,sha256=gexrp0PQ8cbkixCPLY9BCquHeHWfD6iUcA_wbSxGmFQ,29511
3
+ vidformer/cv2/__init__.py,sha256=wOjDsYyUKlP_Hye8-tyz-msu9xwaPMpN2sGMu3Lh3-w,22
4
+ vidformer/cv2/vf_cv2.py,sha256=m05MNPklhaaAfFQfTWetJ_FqWq0u_s77INfABUnHVoA,11664
5
+ vidformer-0.6.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
6
+ vidformer-0.6.1.dist-info/METADATA,sha256=gbvJy_0NGLbnq-EvDsDSoUm7EmHhlfUQL5au6pKCsXk,1383
7
+ vidformer-0.6.1.dist-info/RECORD,,
@@ -1,24 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vidformer
3
- Version: 0.6.0
4
- Summary: A Python library for creating and viewing videos with vidformer.
5
- Author-email: Dominik Winecki <dominikwinecki@gmail.com>
6
- Requires-Python: >=3.8
7
- Description-Content-Type: text/markdown
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Dist: requests
11
- Requires-Dist: msgpack
12
- Requires-Dist: numpy
13
- Project-URL: Homepage, https://ixlab.github.io/vidformer/
14
- Project-URL: Issues, https://ixlab.github.io/vidformer/issues
15
-
16
- # vidformer-py
17
-
18
- ## Publish
19
-
20
- ```bash
21
- export FLIT_USERNAME='__token__' FLIT_PASSWORD='<token>'
22
- flit publish
23
- ```
24
-
@@ -1,7 +0,0 @@
1
- vidformer/__init__.py,sha256=MgZOCVL7wOxSseM5LArXHtW3FzPKLcmGzUaosUhSn6A,113
2
- vidformer/vf.py,sha256=gexrp0PQ8cbkixCPLY9BCquHeHWfD6iUcA_wbSxGmFQ,29511
3
- vidformer/cv2/__init__.py,sha256=wOjDsYyUKlP_Hye8-tyz-msu9xwaPMpN2sGMu3Lh3-w,22
4
- vidformer/cv2/vf_cv2.py,sha256=C3b8OEGSHh7AFbtddybP_DwR7rvy34lCewt9JWcLTaM,6196
5
- vidformer-0.6.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
6
- vidformer-0.6.0.dist-info/METADATA,sha256=hK3hz1DM6NQfkmMz2L5Uc098wgCvPJzaHbpkZy-DDt8,643
7
- vidformer-0.6.0.dist-info/RECORD,,