Spaces:
Runtime error
Runtime error
osanseviero
commited on
Commit
·
90db91d
1
Parent(s):
25c224d
Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,22 @@ from detectron2.utils.visualizer import ColorMode, Visualizer
|
|
31 |
from detectron2.config import get_cfg
|
32 |
from detectron2.utils.logger import setup_logger
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def setup_cfg(cfg):
|
35 |
# load config from file and command-line arguments
|
36 |
cfg = get_cfg()
|
|
|
31 |
from detectron2.config import get_cfg
|
32 |
from detectron2.utils.logger import setup_logger
|
33 |
|
34 |
+
def test_opencv_video_format(codec, file_ext):
|
35 |
+
with tempfile.TemporaryDirectory(prefix="video_format_test") as dir:
|
36 |
+
filename = os.path.join(dir, "test_file" + file_ext)
|
37 |
+
writer = cv2.VideoWriter(
|
38 |
+
filename=filename,
|
39 |
+
fourcc=cv2.VideoWriter_fourcc(*codec),
|
40 |
+
fps=float(30),
|
41 |
+
frameSize=(10, 10),
|
42 |
+
isColor=True,
|
43 |
+
)
|
44 |
+
[writer.write(np.zeros((10, 10, 3), np.uint8)) for _ in range(30)]
|
45 |
+
writer.release()
|
46 |
+
if os.path.isfile(filename):
|
47 |
+
return True
|
48 |
+
return False
|
49 |
+
|
50 |
def setup_cfg(cfg):
|
51 |
# load config from file and command-line arguments
|
52 |
cfg = get_cfg()
|