-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract_frames.py
More file actions
39 lines (28 loc) · 1.05 KB
/
extract_frames.py
File metadata and controls
39 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
from pathlib import Path
from PySide6 import QtWidgets
from PySide6.QtWidgets import QApplication
from frame_extractor.widgets.frame_extractor import FrameExtractor
bundle_dir = getattr(sys, '_MEIPASS', os.getcwd())
res_folder = Path(os.path.abspath(os.path.join(bundle_dir, 'res')))
app_icon_file = res_folder / "logo.png"
app = QApplication(sys.argv)
app.setApplicationName("Labell3R Frame Extractor")
dialog = QtWidgets.QFileDialog()
dialog.setFileMode(QtWidgets.QFileDialog.FileMode.ExistingFile)
dialog.setNameFilter("Config File (*.yaml)")
dialog.setWindowTitle("Select Config File")
dialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptOpen)
if dialog.exec():
file_path = dialog.selectedFiles()[0]
config_file = Path(file_path)
else:
exit(1)
image_folder = config_file.parent / "images"
context_folder = config_file.parent / "context"
image_folder.mkdir(parents=True, exist_ok=True)
context_folder.mkdir(parents=True, exist_ok=True)
window = FrameExtractor(image_folder, context_folder)
window.show()
sys.exit(app.exec())