Skip to content

Commit 089c716

Browse files
author
arch
committed
guess video type
1 parent a96afd8 commit 089c716

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,9 @@ def run(self) -> None:
929929
if self.params.metric not in ['x', 'y']:
930930
self.params.track_men = True # we need 2 tracking points
931931

932-
if self.video_info.fps < 31.0 and self.params.skip_frames > 0:
932+
if self.video_info.fps < 31.0 and self.params.skip_frames > 1:
933933
self.logger.warning("The Video has less than 30 frames per seconds and you have set skip_frames to %d "\
934-
+ "this can lead to inaccuracies when predicting the changepoint positions! (consider to set skip_frames to 0)" \
934+
+ "this can lead to inaccuracies when predicting the changepoint positions! (consider to set skip_frames to 0 or 1)" \
935935
, self.params.skip_frames)
936936

937937
if self.params.raw_output:

funscript_editor/ui/funscript_generator_window.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,13 @@ def __init__(self,
5252

5353
cap = cv2.VideoCapture(video_file)
5454
fps = cap.get(cv2.CAP_PROP_FPS)
55+
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
56+
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
57+
video_aspect_ratio = float(width) / max((1, float(height)))
5558
cap.release()
5659

5760
self.video_file = video_file
61+
self.is_sbs_vr_video = True if 1.9 < video_aspect_ratio < 2.1 else False
5862
self.funscript = Funscript(fps)
5963
self.output_file = output_file
6064

@@ -64,7 +68,7 @@ def __init__(self,
6468
self.__logger.info("Set End Time to Frame Number %d", self.end_frame)
6569

6670
self.settings = {}
67-
self.settings_dialog = SettingsDialog(self.settings)
71+
self.settings_dialog = SettingsDialog(self.settings, include_vr = self.is_sbs_vr_video)
6872
self.settings_dialog.applySettings.connect(self.run)
6973
self.settings_dialog.show()
7074

funscript_editor/ui/settings_dialog.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ class SettingsDialog(QtWidgets.QDialog):
1313
settings (dict): dict where to store the settings
1414
"""
1515

16-
def __init__(self, settings):
16+
def __init__(self, settings: dict, include_vr: bool = True):
1717
super(SettingsDialog, self).__init__()
18+
self.include_vr = include_vr
1819
self.ui = settings_view.Ui_Form()
1920
self.form = QtWidgets.QDialog()
2021
self.ui.setupUi(self.form)
@@ -42,7 +43,7 @@ def __setup_ui_bindings(self):
4243
self.ui.trackingMethodComboBox.currentTextChanged.connect(lambda value: self.__set_setting('trackingMethod', value))
4344

4445
def __setup_combo_boxes(self):
45-
self.ui.videoTypeComboBox.addItems([PROJECTION[key]['name'] for key in PROJECTION.keys()])
46+
self.ui.videoTypeComboBox.addItems([PROJECTION[key]['name'] for key in PROJECTION.keys() if 'vr' not in key or self.include_vr])
4647
self.ui.trackingMetricComboBox.addItems(['y', 'x', 'euclideanDistance', 'pitch'])
4748
self.ui.trackingMethodComboBox.addItems(['Woman', 'Woman + Men'])
4849

funscript_editor/ui/video_player.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def get_screenshot(self) -> np.ndarray:
413413
np.ndarray: opencv image
414414
"""
415415
try: return cv2.cvtColor(np.array(self.player.screenshot_raw()), cv2.COLOR_RGB2BGR)
416-
except: return None
416+
except: return np.ndarray(0)
417417

418418

419419
def set_funscript(self, funscript :Funscript) -> None:

0 commit comments

Comments
 (0)