Skip to content

Commit 78f0ced

Browse files
author
arch
committed
add settings menu
1 parent d76780a commit 78f0ced

File tree

16 files changed

+335
-56
lines changed

16 files changed

+335
-56
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A small Python program that use use Computer Vision to partially automate the ge
44

55
## Getting Started
66

7-
The application has an build in UI. Due to the limitations (mainly on Windows) it is not intended for productive use. Therefore i create a lua script to integrate the tool in [Open Funscripter (OFS)](https://github.com/OpenFunscripter/OFS). For the Installation see my detailed step by step [OFS Integration instruction](https://github.com/michael-mueller-git/Python-Funscript-Editor/blob/main/docs/app/docs/user-guide/ofs-integration.md). By default the application is configured for 3D Side-By-Side VR Videos. If you want to track 2D Videos you have to manually change the config! Therefore read the [configuration page](https://github.com/michael-mueller-git/Python-Funscript-Editor/blob/main/docs/app/docs/user-guide/config.md) in the application documentation.
7+
The application has an build in UI. Due to the limitations (mainly on Windows) it is not intended for productive use. Therefore i create a lua script to integrate the tool in [Open Funscripter (OFS)](https://github.com/OpenFunscripter/OFS). For the Installation see my detailed step by step [OFS Integration instruction](https://github.com/michael-mueller-git/Python-Funscript-Editor/blob/main/docs/app/docs/user-guide/ofs-integration.md). Advanced user should read the [configuration page](https://github.com/michael-mueller-git/Python-Funscript-Editor/blob/main/docs/app/docs/user-guide/config.md) in the application documentation.
88

99
## Documentation
1010

docs/app/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ if [ -z "$(pip3 list | grep "mkdocs")" ] ; then
55
pip3 install mkdocs
66
fi
77

8+
rm -rf ./site
9+
810
if command -v mkdocs ; then
911
mkdocs build
1012
else

docs/app/docs/user-guide/algorithms.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
Idea: By using [OpenCV Tracker](https://learnopencv.com/object-tracking-using-opencv-cpp-python/), we can determine the relative movements in a static camera setup and map them into Funscript actions using simple signal processing.
66

7-
The Algorithm is implemented for 3D Side-By-Side VR Videos. Some parameter are currently hard coded. It should be possible to expand the functionality to 2D Videos by changing the code, with the following limitations.
8-
97
### Limitations
108

119
- Static camera setup

docs/app/docs/user-guide/config.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ Config Files:
2222
- `use_kalman_filter`: (bool) Enable Kalman Filter
2323
- `use_zoom` (bool): Enable or disable an additional step to zoom in the Video before selecting a tracking feature for the Woman or Men.
2424
- `zoom_factor:` (float): Set the desired zoom value which will be used when the zoom function is activated.
25-
- `tracking_direction` (str): Specify the tracking direction. Allowed values are `'x'` and `'y'`.
2625
- `max_playback_fps` (int): Limit the max player speed in the tracking preview window (0 = disable limit)
2726
- `preview_scaling` (float): Set the preview image scaling factor. With a value of `1.0`, the window should fill the height or width of the screen depending on the aspect ratio of the video.
28-
- `projection`: (str): Set the video type. All available options can be obtained from the `projection.yaml` file. Each root keys represent an option. Available Options: `'flat'` = 2D Videos, `'vr_he_sbs'` = 3D VR Side-By-Side Video
2927
- `tracker`: (str) Specify the tracker algorithm. Available options are `'MIL'`, `'KCF'`, `'CSRT'`.
3028

3129
#### `hyperparameter.yaml`
-77.5 KB
Binary file not shown.

docs/app/docs/user-guide/ofs-integration.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ We use a lua script to communicate between the Python Funscript Generator and th
2323
<br> ![Enable OFS Integration](./images/ofs_integration_07.jpg)
2424
8. Navigate to `Options : Keys : Dynamic` and insert a shortcut for the funscript generator.
2525
<br> ![Assign an Shortcut](./images/ofs_integration_08.jpg)
26-
9. By default the application assume you want to track VR 3D Side-By-Side Videos. If you want to track 2D Videos, you have to change the settings in a configuration file. The config file is located in `funscript-editor/funscript_editor/config/settings.yaml`. Open the file with an text editor and change the line `projection: 'vr_he_sbs'` to `projection: 'flat'`. Then save the file.
27-
<br> ![Settings to Track 2D Videos](./images/ofs_integration_09.jpg)
28-
10. Now you can use the shortcut at any position in the video to start the funscript generator.
26+
9. Now you can use the shortcut at any position in the video to start the funscript generator.
2927

3028
## Troubleshot
3129

funscript_editor/algorithms/funscriptgenerator.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@
3232
@dataclass
3333
class FunscriptGeneratorParameter:
3434
""" Funscript Generator Parameter Dataclass with default values """
35+
# No default values
3536
video_path: str # no default value
37+
track_men: bool
38+
direction: str
39+
projection: str
40+
41+
# Settings
3642
start_frame: int = 0 # default is video start (input: set current video position)
3743
end_frame: int = -1 # default is video end (-1)
38-
track_men: bool = True # set by userinput at start (message box)
3944
raw_output: bool = False
40-
41-
# Settings
4245
max_playback_fps: int = max((0, int(SETTINGS['max_playback_fps'])))
43-
direction: str = SETTINGS['tracking_direction']
4446
use_zoom: bool = SETTINGS['use_zoom']
4547
zoom_factor: float = max((1.0, float(SETTINGS['zoom_factor'])))
4648
preview_scaling: float = float(SETTINGS['preview_scaling'])
47-
projection: str = str(SETTINGS['projection']).lower()
4849
use_kalman_filter: bool = SETTINGS['use_kalman_filter']
4950

5051
# General

funscript_editor/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ def generate_funscript(
4141
str(video_file), str(start_time), str(end_time), str(output_file))
4242
app = QtWidgets.QApplication(sys.argv)
4343
generator = FunscriptGeneratorWindow(video_file, start_time, end_time, output_file)
44-
generator.run()
4544
sys.exit(app.exec_())

funscript_editor/config/projection.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
# Do not change any parameters here unless you know exactly what you are doing!
33
# For VR video filer options see: https://ffmpeg.org/ffmpeg-filters.html#v360
44

5-
# 3D Side-By-Side 180 Dome VR Videos
65
vr_he_sbs:
6+
name: '3D VR Video'
77
video_filter: 'v360=input=he:in_stereo=sbs:pitch=${phi}:output=flat:d_fov=${fov}:w=${width}:h=${height}'
88
parameter:
99
height: 720
1010
width: 1240
1111
fov: 100
1212
phi: -45
1313

14-
# 2D Videos
1514
flat:
15+
name: '2D Video'
1616
video_filter: 'scale=${width}:${height}'
1717
parameter:
1818
height: 720

funscript_editor/config/settings.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@ use_zoom: False
1010
# Set the desired zoom value which will be used when the zoom function is activated.
1111
zoom_factor: 4.0
1212

13-
# Specify the tracking direction. Allowed values are `'x'` and `'y'`.
14-
tracking_direction: 'y'
15-
1613
# Limit the max player speed in the tracking preview window (0 = disable limit)
1714
max_playback_fps: 0
1815

1916
# Set the preview image scaling factor. With a value of 1.0, the window should fill the height
2017
# or width of the screen depending on the aspect ratio of the video.
2118
preview_scaling: 0.6
2219

23-
# Set the video type. Available Options:
24-
# - 'flat': 2D Videos
25-
# - 'vr_he_sbs': 3D VR Side-By-Side Video
26-
projection: 'flat'
27-
2820
# Specify the tracker algorithm. Available options are 'MIL', 'KCF', 'CSRT'.
2921
tracker: 'CSRT'

0 commit comments

Comments
 (0)