simba-uw-tf-dev 4.5.8__py3-none-any.whl → 4.7.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.
- simba/SimBA.py +2 -2
- simba/assets/.recent_projects.txt +1 -0
- simba/assets/icons/frames_2.png +0 -0
- simba/assets/lookups/tooptips.json +15 -1
- simba/data_processors/agg_clf_counter_mp.py +52 -53
- simba/data_processors/blob_location_computer.py +1 -1
- simba/data_processors/circling_detector.py +30 -13
- simba/data_processors/cuda/geometry.py +45 -27
- simba/data_processors/cuda/image.py +1648 -1598
- simba/data_processors/cuda/statistics.py +72 -26
- simba/data_processors/cuda/timeseries.py +1 -1
- simba/data_processors/cue_light_analyzer.py +5 -9
- simba/data_processors/egocentric_aligner.py +25 -7
- simba/data_processors/freezing_detector.py +55 -47
- simba/data_processors/kleinberg_calculator.py +61 -29
- simba/feature_extractors/feature_subsets.py +14 -7
- simba/feature_extractors/mitra_feature_extractor.py +2 -2
- simba/feature_extractors/straub_tail_analyzer.py +4 -6
- simba/labelling/standard_labeller.py +1 -1
- simba/mixins/config_reader.py +5 -2
- simba/mixins/geometry_mixin.py +22 -36
- simba/mixins/image_mixin.py +24 -28
- simba/mixins/plotting_mixin.py +28 -10
- simba/mixins/statistics_mixin.py +48 -11
- simba/mixins/timeseries_features_mixin.py +1 -1
- simba/mixins/train_model_mixin.py +67 -29
- simba/model/inference_batch.py +1 -1
- simba/model/yolo_seg_inference.py +3 -3
- simba/outlier_tools/skip_outlier_correction.py +1 -1
- simba/plotting/ROI_feature_visualizer_mp.py +3 -5
- simba/plotting/clf_validator_mp.py +4 -5
- simba/plotting/cue_light_visualizer.py +6 -7
- simba/plotting/directing_animals_visualizer_mp.py +2 -3
- simba/plotting/distance_plotter_mp.py +378 -378
- simba/plotting/frame_mergerer_ffmpeg.py +137 -196
- simba/plotting/gantt_creator.py +29 -10
- simba/plotting/gantt_creator_mp.py +96 -33
- simba/plotting/geometry_plotter.py +270 -272
- simba/plotting/heat_mapper_clf_mp.py +4 -6
- simba/plotting/heat_mapper_location_mp.py +2 -2
- simba/plotting/light_dark_box_plotter.py +2 -2
- simba/plotting/path_plotter_mp.py +26 -29
- simba/plotting/plot_clf_results_mp.py +455 -454
- simba/plotting/pose_plotter_mp.py +28 -29
- simba/plotting/probability_plot_creator_mp.py +288 -288
- simba/plotting/roi_plotter_mp.py +31 -31
- simba/plotting/single_run_model_validation_video_mp.py +427 -427
- simba/plotting/spontaneous_alternation_plotter.py +2 -3
- simba/plotting/yolo_pose_track_visualizer.py +32 -27
- simba/plotting/yolo_pose_visualizer.py +35 -36
- simba/plotting/yolo_seg_visualizer.py +2 -3
- simba/pose_importers/simba_blob_importer.py +3 -3
- simba/roi_tools/roi_aggregate_stats_mp.py +5 -4
- simba/roi_tools/roi_clf_calculator_mp.py +4 -4
- simba/sandbox/analyze_runtimes.py +30 -0
- simba/sandbox/cuda/egocentric_rotator.py +374 -0
- simba/sandbox/get_cpu_pool.py +5 -0
- simba/sandbox/proboscis_to_tip.py +28 -0
- simba/sandbox/test_directionality.py +47 -0
- simba/sandbox/test_nonstatic_directionality.py +27 -0
- simba/sandbox/test_pycharm_cuda.py +51 -0
- simba/sandbox/test_simba_install.py +41 -0
- simba/sandbox/test_static_directionality.py +26 -0
- simba/sandbox/test_static_directionality_2d.py +26 -0
- simba/sandbox/verify_env.py +42 -0
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo.py +3 -3
- simba/third_party_label_appenders/transform/coco_keypoints_to_yolo_bbox.py +2 -2
- simba/ui/pop_ups/clf_add_remove_print_pop_up.py +37 -30
- simba/ui/pop_ups/clf_plot_pop_up.py +2 -2
- simba/ui/pop_ups/egocentric_alignment_pop_up.py +20 -21
- simba/ui/pop_ups/fsttc_pop_up.py +27 -25
- simba/ui/pop_ups/gantt_pop_up.py +31 -6
- simba/ui/pop_ups/interpolate_pop_up.py +2 -4
- simba/ui/pop_ups/kleinberg_pop_up.py +39 -40
- simba/ui/pop_ups/multiple_videos_to_frames_popup.py +10 -11
- simba/ui/pop_ups/single_video_to_frames_popup.py +10 -10
- simba/ui/pop_ups/video_processing_pop_up.py +186 -174
- simba/ui/tkinter_functions.py +10 -1
- simba/utils/custom_feature_extractor.py +1 -1
- simba/utils/data.py +90 -14
- simba/utils/enums.py +1 -0
- simba/utils/errors.py +441 -440
- simba/utils/lookups.py +1203 -1203
- simba/utils/printing.py +124 -124
- simba/utils/read_write.py +3769 -3721
- simba/utils/yolo.py +10 -1
- simba/video_processors/blob_tracking_executor.py +2 -2
- simba/video_processors/clahe_ui.py +66 -23
- simba/video_processors/egocentric_video_rotator.py +46 -44
- simba/video_processors/multi_cropper.py +1 -1
- simba/video_processors/video_processing.py +5264 -5300
- simba/video_processors/videos_to_frames.py +43 -32
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/METADATA +4 -3
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/RECORD +98 -86
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/LICENSE +0 -0
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/WHEEL +0 -0
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/entry_points.txt +0 -0
- {simba_uw_tf_dev-4.5.8.dist-info → simba_uw_tf_dev-4.7.1.dist-info}/top_level.txt +0 -0
|
@@ -24,7 +24,7 @@ from simba.ui.tkinter_functions import (CreateLabelFrameWithIcon,
|
|
|
24
24
|
FileSelect, FolderSelect, SimbaButton,
|
|
25
25
|
SimbaCheckbox, SimBADropDown,
|
|
26
26
|
SimBALabel, SimBARadioButton,
|
|
27
|
-
SimBAScaleBar)
|
|
27
|
+
SimBAScaleBar, SimBASeperator)
|
|
28
28
|
from simba.utils.checks import (check_ffmpeg_available,
|
|
29
29
|
check_file_exist_and_readable,
|
|
30
30
|
check_if_dir_exists,
|
|
@@ -79,13 +79,12 @@ sys.setrecursionlimit(10**7)
|
|
|
79
79
|
|
|
80
80
|
class CLAHEPopUp(PopUpMixin):
|
|
81
81
|
def __init__(self):
|
|
82
|
-
super().__init__(title="CLAHE VIDEO CONVERSION")
|
|
82
|
+
super().__init__(title="CLAHE VIDEO CONVERSION", icon='clahe')
|
|
83
83
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name='settings', icon_link=Links.VIDEO_TOOLS.value)
|
|
84
84
|
lbl = SimBALabel(parent=settings_frm, txt='For more control over CLAHE conversion, try "Interactively CLAHE enhance videos" \n in SimBA Tools->Remove color from videos.', font=Formats.FONT_REGULAR_ITALICS.value)
|
|
85
|
-
self.core_cnt_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(1, find_core_cnt()[0]+1)), label='CORE COUNT:', label_width=25, dropdown_width=20, value=1)
|
|
86
|
-
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label='USE GPU:', label_width=25, dropdown_width=20, value='FALSE')
|
|
87
|
-
if not check_nvidea_gpu_available():
|
|
88
|
-
self.gpu_dropdown.disable()
|
|
85
|
+
self.core_cnt_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(1, find_core_cnt()[0]+1)), label='CORE COUNT:', label_width=25, dropdown_width=20, value=1, img='cpu_small')
|
|
86
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label='USE GPU:', label_width=25, dropdown_width=20, value='FALSE', img='gpu_3')
|
|
87
|
+
if not check_nvidea_gpu_available(): self.gpu_dropdown.disable()
|
|
89
88
|
|
|
90
89
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
91
90
|
lbl.grid(row=0, column=0, sticky=NW)
|
|
@@ -93,10 +92,10 @@ class CLAHEPopUp(PopUpMixin):
|
|
|
93
92
|
self.gpu_dropdown.grid(row=2, column=0, sticky=NW)
|
|
94
93
|
|
|
95
94
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SINGLE VIDEO - Contrast Limited Adaptive Histogram Equalization", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
96
|
-
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25)
|
|
95
|
+
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25, lbl_icon='video_2')
|
|
97
96
|
run_single_video_btn = SimbaButton(parent=single_video_frm, txt="Apply CLAHE on VIDEO", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_single_video, width=160)
|
|
98
97
|
multiple_videos_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="MULTIPLE VIDEOs - Contrast Limited Adaptive Histogram Equalization", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
99
|
-
self.selected_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", lblwidth=25)
|
|
98
|
+
self.selected_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", lblwidth=25, lbl_icon='folder')
|
|
100
99
|
|
|
101
100
|
run_multiple_btn = SimbaButton(parent=multiple_videos_frm, txt="Apply CLAHE on DIRECTORY", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_directory, width=160)
|
|
102
101
|
single_video_frm.grid(row=1, column=0, sticky=NW)
|
|
@@ -609,15 +608,18 @@ class ConvertVideoPopUp(PopUpMixin):
|
|
|
609
608
|
|
|
610
609
|
class ExtractSpecificFramesPopUp(PopUpMixin):
|
|
611
610
|
def __init__(self):
|
|
612
|
-
PopUpMixin.__init__(self, title="EXTRACT DEFINED FRAME RANGE FROM VIDEO", icon='frames')
|
|
611
|
+
PopUpMixin.__init__(self, title="EXTRACT DEFINED FRAME RANGE FROM SINGLE VIDEO", icon='frames')
|
|
613
612
|
self.settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm,header="SETTINGS", icon_name=Keys.DOCUMENTATION.value,icon_link=Links.VIDEO_TOOLS.value)
|
|
614
|
-
self.video_file_selected = FileSelect(self.settings_frm , "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=40)
|
|
615
|
-
self.save_dir = FolderSelect(self.settings_frm, "SAVE DIRECTORY: ", lblwidth=40, tooltip_txt='Optional directory where to save the images. \n If None, images are saved in a folder with the suffix `_frames` \n within the same directory as the video file')
|
|
613
|
+
self.video_file_selected = FileSelect(self.settings_frm , "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=40, lbl_icon='video_2')
|
|
614
|
+
self.save_dir = FolderSelect(self.settings_frm, "SAVE DIRECTORY: ", lblwidth=40, tooltip_txt='Optional directory where to save the images. \n If None, images are saved in a folder with the suffix `_frames` \n within the same directory as the video file', lbl_icon='folder')
|
|
615
|
+
|
|
616
|
+
self.format_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['jpeg', 'png', 'webp'], label="SAVE FORMAT: ", label_width=40, dropdown_width=25, value='png', img='file_type')
|
|
617
|
+
self.grey_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="GREYSCALE: ", label_width=40, dropdown_width=25, value='FALSE', img='grey')
|
|
618
|
+
self.clahe_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="CLAHE: ", label_width=40, dropdown_width=25, value='FALSE', img='clahe')
|
|
619
|
+
self.include_fn_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="INCLUDE VIDEO NAME IN IMAGE NAME: ", label_width=40, dropdown_width=25, value='FALSE', img='id_card_2')
|
|
620
|
+
self.start_frm = Entry_Box(parent=self.settings_frm, fileDescription="START FRAME NUMBER:", labelwidth=40, validation='numeric', width=25, img='play')
|
|
621
|
+
self.end_frm = Entry_Box(parent=self.settings_frm, fileDescription="END FRAME NUMBER:", labelwidth=40, validation='numeric', width=25, img='stop')
|
|
616
622
|
|
|
617
|
-
self.format_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['jpeg', 'png', 'webp'], label="FORMAT: ", label_width=40, dropdown_width=25, value='png')
|
|
618
|
-
self.grey_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="GREYSCALE: ", label_width=40, dropdown_width=25, value='FALSE')
|
|
619
|
-
self.clahe_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="CLAHE: ", label_width=40, dropdown_width=25, value='FALSE')
|
|
620
|
-
self.include_fn_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="INCLUDE VIDEO NAME IN IMAGE NAME: ", label_width=40, dropdown_width=25, value='FALSE')
|
|
621
623
|
|
|
622
624
|
self.settings_frm.grid(row=0, column=0, sticky=NW)
|
|
623
625
|
self.video_file_selected.grid(row=0, column=0, sticky=NW)
|
|
@@ -626,16 +628,11 @@ class ExtractSpecificFramesPopUp(PopUpMixin):
|
|
|
626
628
|
self.grey_dropdown.grid(row=3, column=0, sticky=NW)
|
|
627
629
|
self.clahe_dropdown.grid(row=4, column=0, sticky=NW)
|
|
628
630
|
self.include_fn_dropdown.grid(row=5, column=0, sticky=NW)
|
|
631
|
+
self.start_frm.grid(row=6, column=0, sticky=NW)
|
|
632
|
+
self.end_frm.grid(row=7, column=0, sticky=NW)
|
|
629
633
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
self.end_frm = Entry_Box(select_frames_frm, "END FRAME NUMBER:", "40", validation='numeric')
|
|
633
|
-
run_btn = SimbaButton(parent=select_frames_frm, txt="RUN", img='rocket', font=Formats.FONT_REGULAR.value, cmd=self.start_frm_extraction)
|
|
634
|
-
|
|
635
|
-
select_frames_frm.grid(row=1, column=0, sticky=NW)
|
|
636
|
-
self.start_frm.grid(row=2, column=0, sticky=NW)
|
|
637
|
-
self.end_frm.grid(row=3, column=0, sticky=NW)
|
|
638
|
-
run_btn.grid(row=4, pady=5, sticky=NW)
|
|
634
|
+
run_btn = SimbaButton(parent=self.main_frm, txt="RUN", img='rocket', font=Formats.FONT_REGULAR.value, cmd=self.start_frm_extraction)
|
|
635
|
+
run_btn.grid(row=1, column=0, pady=5, sticky=NW)
|
|
639
636
|
self.main_frm.mainloop()
|
|
640
637
|
|
|
641
638
|
def start_frm_extraction(self):
|
|
@@ -848,30 +845,34 @@ class MergeFrames2VideoPopUp(PopUpMixin):
|
|
|
848
845
|
|
|
849
846
|
class CreateGIFPopUP(PopUpMixin):
|
|
850
847
|
def __init__(self):
|
|
851
|
-
PopUpMixin.__init__(self, title="CREATE GIF FROM VIDEO", size=(600, 400), icon='gif')
|
|
852
|
-
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
853
|
-
self.selected_video = FileSelect(settings_frm, "VIDEO PATH: ", title="Select a video file", file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=40)
|
|
854
|
-
self.start_time_entry_box = Entry_Box(settings_frm, "START TIME (s):", "40", validation="numeric")
|
|
855
|
-
self.duration_entry_box = Entry_Box(settings_frm, "DURATION (s): ", "40", validation="numeric")
|
|
856
848
|
resolution_widths = Options.RESOLUTION_OPTIONS_2.value
|
|
857
|
-
self.resolution_dropdown = DropDownMenu(settings_frm, "GIF WIDTH (ASPECT RATIO RETAINED):", resolution_widths, "40")
|
|
858
|
-
self.quality_dropdown = DropDownMenu(settings_frm, "GIF QUALITY (%):", list(range(1, 101, 1)), "40")
|
|
859
849
|
fps_lst = list(range(1, 101, 1))
|
|
860
850
|
fps_lst.insert(0, 'AUTO')
|
|
861
|
-
|
|
862
|
-
|
|
851
|
+
gpu_state = NORMAL if check_nvidea_gpu_available(raise_error=False) else DISABLED
|
|
852
|
+
PopUpMixin.__init__(self, title="CREATE GIF FROM VIDEO", size=(600, 400), icon='gif')
|
|
853
|
+
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
863
854
|
|
|
864
|
-
self.
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
855
|
+
info_lbl = SimBALabel(parent=self.main_frm, txt='Consider creating WEBM videos instead of creating GIFs.\n WEBM is optimized for web publish at \nconsiderbly smaller sizes than GIFs.', txt_clr='blue', font=Formats.FONT_REGULAR_ITALICS.value, justify='center')
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
self.selected_video = FileSelect(settings_frm, "VIDEO PATH: ", title="Select a video file", file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=40, lbl_icon='video_2')
|
|
859
|
+
self.start_time_entry_box = Entry_Box(parent=settings_frm, fileDescription="START TIME (s):", labelwidth=40, validation="numeric", img='play', width=25)
|
|
860
|
+
self.duration_entry_box = Entry_Box(parent=settings_frm, fileDescription="DURATION (s):", labelwidth=40, validation="numeric", img='stop', width=25)
|
|
861
|
+
|
|
862
|
+
self.resolution_dropdown = SimBADropDown(parent=settings_frm, label="GIF WIDTH (ASPECT RATIO RETAINED):", dropdown_options=resolution_widths, label_width=40, dropdown_width=25, value='AUTO', img='monitor')
|
|
863
|
+
self.quality_dropdown = SimBADropDown(parent=settings_frm, label="GIF QUALITY (%):", dropdown_options=list(range(1, 101, 1)), label_width=40, dropdown_width=25, value=100, img='pct_2')
|
|
864
|
+
self.fps_dropdown = SimBADropDown(parent=settings_frm, label="GIF FPS:", dropdown_options=fps_lst, label_width=40, dropdown_width=25, value='AUTO', img='fps')
|
|
865
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, label="USE GPU:", dropdown_options=['TRUE', 'FALSE'], label_width=40, dropdown_width=25, value='FALSE', img='gpu_3', state=gpu_state)
|
|
866
|
+
|
|
867
|
+
info_lbl.grid(row=0, sticky=NW)
|
|
868
|
+
settings_frm.grid(row=1, sticky=NW)
|
|
868
869
|
self.selected_video.grid(row=0, sticky=NW, pady=5)
|
|
869
870
|
self.start_time_entry_box.grid(row=1, sticky=NW)
|
|
870
871
|
self.duration_entry_box.grid(row=2, sticky=NW)
|
|
871
872
|
self.resolution_dropdown.grid(row=3, sticky=NW)
|
|
872
873
|
self.quality_dropdown.grid(row=4, sticky=NW)
|
|
873
874
|
self.fps_dropdown.grid(row=5, sticky=NW)
|
|
874
|
-
|
|
875
|
+
self.gpu_dropdown.grid(row=6, column=0, sticky=NW)
|
|
875
876
|
self.create_run_frm(run_function=self.run)
|
|
876
877
|
self.main_frm.mainloop()
|
|
877
878
|
|
|
@@ -882,7 +883,7 @@ class CreateGIFPopUP(PopUpMixin):
|
|
|
882
883
|
duration = self.duration_entry_box.entry_get
|
|
883
884
|
fps = self.fps_dropdown.getChoices()
|
|
884
885
|
quality = int(self.quality_dropdown.getChoices())
|
|
885
|
-
gpu = self.
|
|
886
|
+
gpu = self.gpu_dropdown.get_value()
|
|
886
887
|
check_ffmpeg_available()
|
|
887
888
|
if gpu: check_nvidea_gpu_available()
|
|
888
889
|
check_file_exist_and_readable(file_path=video_path)
|
|
@@ -892,7 +893,7 @@ class CreateGIFPopUP(PopUpMixin):
|
|
|
892
893
|
if fps == 'AUTO': fps = int(video_meta_data['fps'])
|
|
893
894
|
else: fps = int(fps)
|
|
894
895
|
if fps > int(video_meta_data['fps']):
|
|
895
|
-
FrameRangeWarning(msg=f'The chosen FPS ({fps}) is higher than the video FPS ({video_meta_data["fps"]}). The video FPS will be used', source=self.__class__.__name__)
|
|
896
|
+
FrameRangeWarning(msg=f'The chosen FPS ({fps}) is higher than the video FPS ({video_meta_data["fps"]}). The video FPS will be used ({video_meta_data["fps"]})', source=self.__class__.__name__)
|
|
896
897
|
fps = int(video_meta_data['fps'])
|
|
897
898
|
max_duration = video_meta_data['video_length_s'] - int(start_time)
|
|
898
899
|
check_int(name='start_time', value=start_time, max_value=video_meta_data['video_length_s'], min_value=0)
|
|
@@ -1000,26 +1001,31 @@ class ConcatenatingVideosPopUp(PopUpMixin):
|
|
|
1000
1001
|
|
|
1001
1002
|
class ConcatenatorPopUp(PopUpMixin, ConfigReader):
|
|
1002
1003
|
def __init__(self, config_path: Optional[Union[str, os.PathLike]] = None):
|
|
1004
|
+
|
|
1005
|
+
self.RESOLUTIONS = ["480", "640", "1280", "1920", "2560"]
|
|
1006
|
+
self.CONCAT_TYPES_1 = {'HORIZONTAL': 'horizontal', 'MIXED MOSAIC': 'mixed_mosaic', 'MOSAIC': 'mosaic', 'VERTICAL': 'vertical'}
|
|
1007
|
+
self.CONCAT_TYPES_2 = {'horizontal': 'HORIZONTAL', 'mixed_mosaic': 'MIXED MOSAIC', 'mosaic': 'MOSAIC', 'vertical': 'VERTICAL'}
|
|
1003
1008
|
self.gpu_available = NORMAL if check_nvidea_gpu_available() else DISABLED
|
|
1004
1009
|
PopUpMixin.__init__(self, title="MERGE (CONCATENATE) VIDEOS", icon='concat_videos')
|
|
1005
1010
|
self.config_path = config_path
|
|
1006
1011
|
self.select_video_cnt_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="NUMBER OF VIDEOS TO CONCATENATE", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.CONCAT_VIDEOS.value)
|
|
1007
|
-
self.select_video_cnt_dropdown = SimBADropDown(parent=self.select_video_cnt_frm, dropdown_options=list(range(2, 21)), label="VIDEOS #", label_width=
|
|
1012
|
+
self.select_video_cnt_dropdown = SimBADropDown(parent=self.select_video_cnt_frm, dropdown_options=list(range(2, 21)), label="VIDEOS #", label_width=30, dropdown_width=25, value=2, command=lambda value: self.populate_table(int(value)), img='stack')
|
|
1008
1013
|
self.select_video_cnt_frm.grid(row=0, column=0, sticky=NW)
|
|
1009
1014
|
self.select_video_cnt_dropdown.grid(row=0, column=0, sticky=NW)
|
|
1010
1015
|
self.populate_table(video_cnt=int(self.select_video_cnt_dropdown.get_value()))
|
|
1011
|
-
|
|
1016
|
+
# self.main_frm.mainloop()
|
|
1012
1017
|
|
|
1013
1018
|
def populate_table(self, video_cnt):
|
|
1014
1019
|
if hasattr(self, "video_table_frm"): self.video_table_frm.destroy()
|
|
1015
1020
|
if hasattr(self, "join_type_frm"): self.join_type_frm.destroy()
|
|
1016
|
-
self.video_table_frm =
|
|
1021
|
+
self.video_table_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="VIDEO PATHS", icon_name='video_2', icon_link=Links.CONCAT_VIDEOS.value, pady=5, padx=5)
|
|
1017
1022
|
self.video_table_frm.grid(row=1, sticky=NW)
|
|
1018
1023
|
self.videos_dict = {}
|
|
1019
1024
|
for cnt in range(int(video_cnt)):
|
|
1020
|
-
self.videos_dict[cnt] = FileSelect(self.video_table_frm, f"VIDEO {cnt+1}: ", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)])
|
|
1025
|
+
self.videos_dict[cnt] = FileSelect(self.video_table_frm, f"VIDEO {cnt+1}: ", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=30, lbl_icon='video_2')
|
|
1021
1026
|
self.videos_dict[cnt].grid(row=cnt, column=0, sticky=NW)
|
|
1022
|
-
|
|
1027
|
+
|
|
1028
|
+
self.join_type_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="JOIN TYPE", icon_name='category', icon_link=Links.CONCAT_VIDEOS.value, pady=5, padx=5)
|
|
1023
1029
|
self.join_type_frm.grid(row=2, sticky=NW)
|
|
1024
1030
|
self.join_type_var = StringVar()
|
|
1025
1031
|
self.icons_dict = {}
|
|
@@ -1030,22 +1036,24 @@ class ConcatenatorPopUp(PopUpMixin, ConfigReader):
|
|
|
1030
1036
|
_, file_name, _ = get_fn_ext(file_path)
|
|
1031
1037
|
self.icons_dict[file_name] = {}
|
|
1032
1038
|
self.icons_dict[file_name]["img"] = ImageTk.PhotoImage(Image.open(file_path))
|
|
1033
|
-
|
|
1034
|
-
self.icons_dict[file_name]["btn"] = SimBARadioButton(parent=self.join_type_frm, txt=file_name, variable=self.join_type_var, img=self.icons_dict[file_name]["img"], value=file_name)
|
|
1039
|
+
self.icons_dict[file_name]["btn"] = SimBARadioButton(parent=self.join_type_frm, txt=self.CONCAT_TYPES_2[file_name], variable=self.join_type_var, img=self.icons_dict[file_name]["img"], value=self.CONCAT_TYPES_2[file_name], compound='bottom', font=Formats.FONT_REGULAR_BOLD.value)
|
|
1035
1040
|
self.icons_dict[file_name]["btn"].grid(row=0, column=file_cnt, sticky=NW)
|
|
1036
1041
|
self.join_type_var.set(value="mosaic")
|
|
1037
|
-
self.resolution_frm =
|
|
1038
|
-
self.resolution_width = SimBADropDown(parent=self.resolution_frm, dropdown_options=
|
|
1039
|
-
self.resolution_height = SimBADropDown(parent=self.resolution_frm, dropdown_options=
|
|
1040
|
-
self.
|
|
1041
|
-
self.gpu_dropdown = SimBADropDown(parent=self.
|
|
1042
|
+
self.resolution_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="RESOLUTION", icon_name='monitor', icon_link=Links.CONCAT_VIDEOS.value, pady=5, padx=5, tooltip_key='CONCAT_RES_HEADER')
|
|
1043
|
+
self.resolution_width = SimBADropDown(parent=self.resolution_frm, dropdown_options=self.RESOLUTIONS, label='WIDTH:', label_width=30, dropdown_width=25, value="480", img='width', tooltip_key="CONCAT_WIDTH")
|
|
1044
|
+
self.resolution_height = SimBADropDown(parent=self.resolution_frm, dropdown_options=self.RESOLUTIONS, label='HEIGHT:', label_width=30, dropdown_width=25, value="640", img='height', tooltip_key="CONCAT_HEIGHT")
|
|
1045
|
+
self.settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name='settings', icon_link=Links.CONCAT_VIDEOS.value, pady=5, padx=5)
|
|
1046
|
+
self.gpu_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=['TRUE', 'FALSE'], label="USE GPU:", label_width=30, dropdown_width=25, value='FALSE', img='gpu_3', state=self.gpu_available, tooltip_key='USE_GPU')
|
|
1047
|
+
self.quality_dropdown = SimBADropDown(parent=self.settings_frm, dropdown_options=list(range(10, 110, 10)), label="OUT VIDEO QUALITY:", label_width=30, dropdown_width=25, value=60, img='pct_2', state=self.gpu_available, tooltip_key='OUTPUT_VIDEO_QUALITY')
|
|
1048
|
+
|
|
1042
1049
|
self.gpu_dropdown.grid(row=0, column=0, sticky="NW")
|
|
1050
|
+
self.quality_dropdown.grid(row=1, column=0, sticky="NW")
|
|
1043
1051
|
self.resolution_frm.grid(row=3, column=0, sticky=NW)
|
|
1044
|
-
self.
|
|
1052
|
+
self.settings_frm.grid(row=4, column=0, sticky="NW")
|
|
1045
1053
|
self.resolution_width.grid(row=0, column=0, sticky=NW)
|
|
1046
1054
|
self.resolution_height.grid(row=1, column=0, sticky=NW)
|
|
1047
1055
|
|
|
1048
|
-
run_btn =
|
|
1056
|
+
run_btn = SimbaButton(parent=self.main_frm, txt='RUN', img='rocket', cmd=self.run)
|
|
1049
1057
|
run_btn.grid(row=5, column=0, sticky=NW)
|
|
1050
1058
|
|
|
1051
1059
|
def run(self):
|
|
@@ -1054,17 +1062,23 @@ class ConcatenatorPopUp(PopUpMixin, ConfigReader):
|
|
|
1054
1062
|
_ = get_video_meta_data(video_path=video_data.file_path)
|
|
1055
1063
|
file_paths.append(video_data.file_path)
|
|
1056
1064
|
if (len(file_paths) < 3) & (self.join_type_var.get() == "mixed_mosaic"):
|
|
1057
|
-
raise MixedMosaicError(msg="If using the mixed mosaic join type, please
|
|
1065
|
+
raise MixedMosaicError(msg="If using the mixed mosaic join type, please use at least 3 videos.", source=self.__class__.__name__ )
|
|
1058
1066
|
if (len(file_paths) < 3) & (self.join_type_var.get() == "mosaic"):
|
|
1059
1067
|
self.join_type_var.set(value="vertical")
|
|
1060
1068
|
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
1069
|
+
quality = int(self.quality_dropdown.get_value())
|
|
1070
|
+
quality_crf = quality_pct_to_crf(pct=quality)
|
|
1071
|
+
|
|
1072
|
+
join_type = self.CONCAT_TYPES_1[self.join_type_var.get()]
|
|
1073
|
+
|
|
1061
1074
|
|
|
1062
1075
|
video_merger = FrameMergererFFmpeg(config_path=self.config_path,
|
|
1063
1076
|
video_paths=file_paths,
|
|
1064
1077
|
video_height=int(self.resolution_height.getChoices()),
|
|
1065
1078
|
video_width=int(self.resolution_width.getChoices()),
|
|
1066
|
-
concat_type=
|
|
1067
|
-
gpu=gpu
|
|
1079
|
+
concat_type=join_type,
|
|
1080
|
+
gpu=gpu,
|
|
1081
|
+
quality=quality_crf)
|
|
1068
1082
|
|
|
1069
1083
|
threading.Thread(target=video_merger.run())
|
|
1070
1084
|
|
|
@@ -1342,7 +1356,7 @@ class DownsampleVideoPopUp(PopUpMixin):
|
|
|
1342
1356
|
file_path=self.video_path_selected.file_path,
|
|
1343
1357
|
video_width=int(width),
|
|
1344
1358
|
video_height=int(height),
|
|
1345
|
-
gpu=self.
|
|
1359
|
+
gpu=str_2_bool(self.gpu_dropdown.get_value()),
|
|
1346
1360
|
quality=quality_crf,
|
|
1347
1361
|
)
|
|
1348
1362
|
|
|
@@ -1491,23 +1505,23 @@ class ClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1491
1505
|
max_video_name_len = len(max(list(self.video_paths.keys())))
|
|
1492
1506
|
super().__init__(title="CLIP MULTIPLE VIDEOS BY FRAME NUMBERS", icon='clip')
|
|
1493
1507
|
self.save_dir = save_dir
|
|
1508
|
+
padx = (0, 25)
|
|
1494
1509
|
data_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="VIDEO SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1495
|
-
data_frm.grid(row=
|
|
1510
|
+
SimBALabel(parent=data_frm, font=Formats.FONT_REGULAR.value, txt="VIDEO NAME", justify='center', img='video').grid(row=0, column=0, padx=padx, sticky=NW)
|
|
1511
|
+
SimBALabel(parent=data_frm, font=Formats.FONT_REGULAR.value, txt="START FRAME", justify='center', img='play').grid(row=0, column=2, padx=padx)
|
|
1512
|
+
SimBALabel(parent=data_frm, font=Formats.FONT_REGULAR.value, txt="END FRAME", justify='center', img='stop').grid(row=0, column=3, padx=padx)
|
|
1496
1513
|
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
SimBALabel(parent=data_frm, width=max_video_name_len+20, font=Formats.FONT_REGULAR.value, txt="VIDEO NAME", justify='center').grid(row=0, column=0)
|
|
1500
|
-
SimBALabel(parent=data_frm, width=max_video_name_len+20, font=Formats.FONT_REGULAR.value, txt="START FRAME", justify='center').grid(row=0, column=2)
|
|
1501
|
-
SimBALabel(parent=data_frm, width=max_video_name_len+20, font=Formats.FONT_REGULAR.value, txt="END FRAME", justify='center').grid(row=0, column=3)
|
|
1514
|
+
seperator = SimBASeperator(parent=data_frm, color=None, orient='horizontal', borderwidth=1)
|
|
1515
|
+
seperator.grid(row=1, column=0, columnspan=4, rowspan=1, sticky="ew")
|
|
1502
1516
|
|
|
1503
1517
|
self.entry_boxes = {}
|
|
1504
1518
|
for cnt, video_name in enumerate(self.video_paths.keys()):
|
|
1505
1519
|
self.entry_boxes[video_name] = {}
|
|
1506
|
-
SimBALabel(parent=data_frm,
|
|
1507
|
-
self.entry_boxes[video_name]["start"] = Entry_Box(data_frm, "", 0, validation="numeric")
|
|
1508
|
-
self.entry_boxes[video_name]["end"] = Entry_Box(data_frm, "", 0, validation="numeric")
|
|
1509
|
-
self.entry_boxes[video_name]["start"].grid(row=cnt +
|
|
1510
|
-
self.entry_boxes[video_name]["end"].grid(row=cnt +
|
|
1520
|
+
SimBALabel(parent=data_frm, font=Formats.FONT_REGULAR.value, txt=video_name + f' (frames: { self.video_meta_data[cnt]})', justify='left').grid(row=cnt + 2, column=0, padx=padx, sticky=NW)
|
|
1521
|
+
self.entry_boxes[video_name]["start"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, validation="numeric", justify='center')
|
|
1522
|
+
self.entry_boxes[video_name]["end"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, validation="numeric", justify='center')
|
|
1523
|
+
self.entry_boxes[video_name]["start"].grid(row=cnt + 2, column=2, sticky=NW, padx=padx)
|
|
1524
|
+
self.entry_boxes[video_name]["end"].grid(row=cnt + 2, column=3, sticky=NW, padx=padx)
|
|
1511
1525
|
|
|
1512
1526
|
gpu_state = NORMAL if check_nvidea_gpu_available(raise_error=False) else DISABLED
|
|
1513
1527
|
batch_settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="BATCH SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
@@ -1517,6 +1531,7 @@ class ClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1517
1531
|
batch_end_btn = SimbaButton(parent=batch_settings_frm, txt='SET', img='tick', cmd=self._batch_set_val, cmd_kwargs={'text': lambda: batch_end_entry.entry_get.strip(), 'box_type': lambda: 'end'})
|
|
1518
1532
|
self.gpu_dropdown = SimBADropDown(parent=batch_settings_frm, dropdown_options=['TRUE', 'FALSE'], label='USE GPU:', label_width=25, dropdown_width=12, tooltip_key='USE_GPU', img='gpu_3', state=gpu_state, value='FALSE')
|
|
1519
1533
|
self.quality_dropdown = SimBADropDown(parent=batch_settings_frm, dropdown_options=list(range(10, 110, 10)), label='OUT VIDEO QUALITY:', label_width=25, dropdown_width=12, tooltip_key='OUTPUT_VIDEO_QUALITY', img='pct_2', value=60)
|
|
1534
|
+
data_frm.grid(row=2, column=0, sticky=NW)
|
|
1520
1535
|
batch_settings_frm.grid(row=1, column=0, sticky=NW)
|
|
1521
1536
|
batch_start_entry.grid(row=0, column=0, sticky=NW)
|
|
1522
1537
|
batch_start_btn.grid(row=0, column=1, sticky=NW)
|
|
@@ -1576,6 +1591,9 @@ class ClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1576
1591
|
|
|
1577
1592
|
|
|
1578
1593
|
#ClipMultipleVideosByFrameNumbersPopUp(data_dir=r'E:\netholabs_videos\terry\mp4s\4_02_001_exp_2025_12_02_15_22_00\videos\Camera2', save_dir=r'E:\netholabs_videos\terry\mp4s\4_02_001_exp_2025_12_02_15_22_00\videos\Camera2\test')
|
|
1594
|
+
#ClipMultipleVideosByFrameNumbersPopUp(data_dir=r"E:\maplight_videos\test_0126", save_dir=r"E:\maplight_videos\clip_test")
|
|
1595
|
+
|
|
1596
|
+
|
|
1579
1597
|
|
|
1580
1598
|
class InitiateClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
1581
1599
|
def __init__(self):
|
|
@@ -1622,6 +1640,8 @@ class InitiateClipMultipleVideosByFrameNumbersPopUp(PopUpMixin):
|
|
|
1622
1640
|
)
|
|
1623
1641
|
|
|
1624
1642
|
|
|
1643
|
+
|
|
1644
|
+
|
|
1625
1645
|
class ClipMultipleVideosByTimestamps(PopUpMixin):
|
|
1626
1646
|
"""
|
|
1627
1647
|
:example:
|
|
@@ -1634,13 +1654,12 @@ class ClipMultipleVideosByTimestamps(PopUpMixin):
|
|
|
1634
1654
|
check_if_dir_exists(in_dir=save_dir, source=self.__class__.__name__, create_if_not_exist=True)
|
|
1635
1655
|
self.video_paths = find_all_videos_in_directory(directory=data_dir, as_dict=True, raise_error=True)
|
|
1636
1656
|
self.video_meta_data = [get_video_meta_data(video_path=x) for x in list(self.video_paths.values())]
|
|
1637
|
-
max_video_name_len = len(max(list(self.video_paths.keys()))) + 25
|
|
1638
1657
|
super().__init__(title="CLIP MULTIPLE VIDEOS BY TIME-STAMPS", icon='clip')
|
|
1639
1658
|
self.save_dir = save_dir
|
|
1640
1659
|
batch_settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="BATCH SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1641
|
-
batch_start_entry = Entry_Box(parent=batch_settings_frm, fileDescription='START TIME (HH:MM:SS):', labelwidth=25, entry_box_width=12, img='play')
|
|
1660
|
+
batch_start_entry = Entry_Box(parent=batch_settings_frm, fileDescription='START TIME (HH:MM:SS):', labelwidth=25, entry_box_width=12, img='play', justify='center')
|
|
1642
1661
|
batch_start_btn = SimbaButton(parent=batch_settings_frm, txt='SET', img='tick', cmd=self._batch_set_val, cmd_kwargs={'text': lambda: batch_start_entry.entry_get.strip(), 'box_type': lambda: 'start'})
|
|
1643
|
-
batch_end_entry = Entry_Box(parent=batch_settings_frm, fileDescription='END TIME (HH:MM:SS):', labelwidth=25, entry_box_width=12, img='stop')
|
|
1662
|
+
batch_end_entry = Entry_Box(parent=batch_settings_frm, fileDescription='END TIME (HH:MM:SS):', labelwidth=25, entry_box_width=12, img='stop', justify='center')
|
|
1644
1663
|
batch_end_btn = SimbaButton(parent=batch_settings_frm, txt='SET', img='tick', cmd=self._batch_set_val, cmd_kwargs={'text': lambda: batch_end_entry.entry_get.strip(), 'box_type': lambda: 'end'})
|
|
1645
1664
|
batch_settings_frm.grid(row=0, column=0, sticky=NW)
|
|
1646
1665
|
batch_start_entry.grid(row=0, column=0, sticky=NW)
|
|
@@ -1653,25 +1672,28 @@ class ClipMultipleVideosByTimestamps(PopUpMixin):
|
|
|
1653
1672
|
self.gpu_dropdown.grid(row=2, column=0, sticky=NW)
|
|
1654
1673
|
self.quality_dropdown.grid(row=3, column=0, sticky=NW)
|
|
1655
1674
|
self.save_dir = save_dir
|
|
1675
|
+
padx = (0, 30)
|
|
1656
1676
|
data_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="VIDEO SETTINGS", icon_name='video', icon_link=Links.VIDEO_TOOLS.value)
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1677
|
+
|
|
1678
|
+
SimBALabel(data_frm, txt="VIDEO NAME", justify='center', font=Formats.FONT_REGULAR_BOLD.value, img='video').grid(row=0, column=0, sticky=NW, padx=padx)
|
|
1679
|
+
SimBALabel(data_frm, txt="VIDEO LENGTH", justify='center', font=Formats.FONT_REGULAR_BOLD.value, img='timer_2').grid(row=0, column=1, sticky=NW, padx=padx)
|
|
1680
|
+
SimBALabel(data_frm, txt="START TIME (HH:MM:SS)", justify='center', font=Formats.FONT_REGULAR_BOLD.value, img='play').grid(row=0, column=2, sticky=NW, padx=padx)
|
|
1681
|
+
SimBALabel(data_frm, txt="END TIME (HH:MM:SS)", justify='center', font=Formats.FONT_REGULAR_BOLD.value, img='stop').grid(row=0, column=3, sticky=NW, padx=padx)
|
|
1682
|
+
seperator = SimBASeperator(parent=data_frm, color=None, orient='horizontal', borderwidth=1)
|
|
1683
|
+
seperator.grid(row=1, column=0, columnspan=4, rowspan=1, sticky="ew")
|
|
1662
1684
|
|
|
1663
1685
|
self.entry_boxes = {}
|
|
1664
1686
|
for cnt, video_name in enumerate(self.video_paths.keys()):
|
|
1665
1687
|
self.entry_boxes[video_name] = {}
|
|
1666
|
-
SimBALabel(parent=data_frm, txt=video_name,
|
|
1688
|
+
SimBALabel(parent=data_frm, txt=video_name, justify='center').grid(row=cnt + 2, column=0, sticky=NW, padx=padx)
|
|
1667
1689
|
video_length = self.video_meta_data[cnt]["video_length_s"]
|
|
1668
1690
|
video_length_hhmmss = seconds_to_timestamp(seconds=video_length)
|
|
1669
|
-
|
|
1670
|
-
self.entry_boxes[video_name]["start"] = Entry_Box(data_frm,
|
|
1671
|
-
self.entry_boxes[video_name]["end"] = Entry_Box(data_frm, "",
|
|
1672
|
-
self.entry_boxes[video_name]["start"].grid(row=cnt +
|
|
1673
|
-
self.entry_boxes[video_name]["end"].grid(row=cnt +
|
|
1674
|
-
|
|
1691
|
+
SimBALabel(data_frm, txt=video_length_hhmmss, justify='center').grid(row=cnt + 2, column=1, sticky=NW, padx=padx)
|
|
1692
|
+
self.entry_boxes[video_name]["start"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, justify='center')
|
|
1693
|
+
self.entry_boxes[video_name]["end"] = Entry_Box(data_frm, fileDescription="", labelwidth=0, justify='center')
|
|
1694
|
+
self.entry_boxes[video_name]["start"].grid(row=cnt + 2, column=2, sticky=NW, padx=padx)
|
|
1695
|
+
self.entry_boxes[video_name]["end"].grid(row=cnt + 2, column=3, sticky=NW, padx=padx)
|
|
1696
|
+
data_frm.grid(row=1, column=0, sticky=NW)
|
|
1675
1697
|
self.create_run_frm(run_function=self.run, btn_txt_clr="blue")
|
|
1676
1698
|
self.main_frm.mainloop()
|
|
1677
1699
|
|
|
@@ -1694,11 +1716,11 @@ class ClipMultipleVideosByTimestamps(PopUpMixin):
|
|
|
1694
1716
|
check_that_hhmmss_start_is_before_end(start_time=start, end_time=end, name=video_name)
|
|
1695
1717
|
check_if_hhmmss_timestamp_is_valid_part_of_video(timestamp=start, video_path=self.video_paths[video_name])
|
|
1696
1718
|
check_if_hhmmss_timestamp_is_valid_part_of_video(timestamp=end, video_path=self.video_paths[video_name])
|
|
1697
|
-
clip_video_in_range(file_path=self.video_paths[video_name], start_time=start, end_time=end, out_dir=self.save_dir, overwrite=True, include_clip_time_in_filename=False, gpu=gpu, quality=quality_pct)
|
|
1719
|
+
clip_video_in_range(file_path=self.video_paths[video_name], start_time=start, end_time=end, out_dir=self.save_dir, overwrite=True, include_clip_time_in_filename=False, gpu=gpu, quality=quality_pct, codec='libx264', verbose=True)
|
|
1698
1720
|
timer.stop_timer()
|
|
1699
1721
|
stdout_success(msg=f"{len(self.entry_boxes)} videos clipped by time-stamps and saved in {self.save_dir}", elapsed_time=timer.elapsed_time_str,)
|
|
1700
1722
|
|
|
1701
|
-
#ClipMultipleVideosByTimestamps(data_dir=r"
|
|
1723
|
+
#ClipMultipleVideosByTimestamps(data_dir=r"E:\maplight_videos\test_0126", save_dir=r"E:\maplight_videos\clip_test")
|
|
1702
1724
|
|
|
1703
1725
|
|
|
1704
1726
|
class InitiateClipMultipleVideosByTimestampsPopUp(PopUpMixin):
|
|
@@ -1752,16 +1774,16 @@ class BrightnessContrastPopUp(PopUpMixin):
|
|
|
1752
1774
|
:align: center
|
|
1753
1775
|
"""
|
|
1754
1776
|
def __init__(self):
|
|
1755
|
-
super().__init__(title="CHANGE BRIGHTNESS / CONTRAST")
|
|
1777
|
+
super().__init__(title="CHANGE BRIGHTNESS / CONTRAST", icon='brightness')
|
|
1756
1778
|
self.datetime = datetime.now().strftime("%Y%m%d%H%M%S")
|
|
1757
1779
|
setting_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1758
1780
|
gpu_available = NORMAL if check_nvidea_gpu_available() else DISABLED
|
|
1759
|
-
self.gpu_dropdown = SimBADropDown(parent=setting_frm, label="USE GPU:", dropdown_options=['TRUE', 'FALSE'], dropdown_width=20, value='FALSE', state=gpu_available, img='gpu_3')
|
|
1781
|
+
self.gpu_dropdown = SimBADropDown(parent=setting_frm, label="USE GPU:", dropdown_options=['TRUE', 'FALSE'], dropdown_width=20, value='FALSE', state=gpu_available, img='gpu_3', label_width=25)
|
|
1760
1782
|
setting_frm.grid(row=0, column=0, sticky="NW")
|
|
1761
1783
|
self.gpu_dropdown.grid(row=0, column=0, sticky="NW")
|
|
1762
1784
|
|
|
1763
1785
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CHANGE BRIGHTNESS / CONTRAST SINGLE VIDEO", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1764
|
-
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25)
|
|
1786
|
+
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25, lbl_icon='video_2')
|
|
1765
1787
|
run_video_btn = SimbaButton(parent=single_video_frm, txt="RUN SINGLE VIDEO", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_video)
|
|
1766
1788
|
|
|
1767
1789
|
single_video_frm.grid(row=1, column=0, sticky="NW")
|
|
@@ -1769,7 +1791,7 @@ class BrightnessContrastPopUp(PopUpMixin):
|
|
|
1769
1791
|
run_video_btn.grid(row=1, column=0, sticky="NW")
|
|
1770
1792
|
|
|
1771
1793
|
video_dir_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CHANGE BRIGHTNESS / CONTRAST MULTIPLE VIDEOS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1772
|
-
self.selected_dir = FolderSelect(video_dir_frm, "VIDEO DIRECTORY PATH:", lblwidth=25)
|
|
1794
|
+
self.selected_dir = FolderSelect(video_dir_frm, "VIDEO DIRECTORY PATH:", lblwidth=25, lbl_icon='folder')
|
|
1773
1795
|
|
|
1774
1796
|
run_dir_btn = SimbaButton(parent=video_dir_frm, txt="RUN VIDEO DIRECTORY", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_directory)
|
|
1775
1797
|
|
|
@@ -1796,7 +1818,7 @@ class BrightnessContrastPopUp(PopUpMixin):
|
|
|
1796
1818
|
|
|
1797
1819
|
def apply(self):
|
|
1798
1820
|
timer = SimbaTimer(start=True)
|
|
1799
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
1821
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
1800
1822
|
for file_cnt, file_path in enumerate(self.video_paths):
|
|
1801
1823
|
video_timer = SimbaTimer(start=True)
|
|
1802
1824
|
dir, video_name, ext = get_fn_ext(filepath=file_path)
|
|
@@ -1824,11 +1846,11 @@ class InteractiveClahePopUp(PopUpMixin):
|
|
|
1824
1846
|
"""
|
|
1825
1847
|
|
|
1826
1848
|
def __init__(self):
|
|
1827
|
-
super().__init__(title="INTERACTIVE CLAHE")
|
|
1849
|
+
super().__init__(title="INTERACTIVE CLAHE", icon='clahe')
|
|
1828
1850
|
self.datetime = datetime.now().strftime("%Y%m%d%H%M%S")
|
|
1829
1851
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name='settings', icon_link=Links.VIDEO_TOOLS.value)
|
|
1830
|
-
self.core_cnt_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(1, find_core_cnt()[0]+1)), label='CORE COUNT:', label_width=25, dropdown_width=20, value=1)
|
|
1831
|
-
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label='USE GPU:', label_width=25, dropdown_width=20, value='FALSE')
|
|
1852
|
+
self.core_cnt_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(1, find_core_cnt()[0]+1)), label='CORE COUNT:', label_width=25, dropdown_width=20, value=1, img='cpu_small')
|
|
1853
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label='USE GPU:', label_width=25, dropdown_width=20, value='FALSE', img='gpu_3')
|
|
1832
1854
|
if not check_nvidea_gpu_available():
|
|
1833
1855
|
self.gpu_dropdown.disable()
|
|
1834
1856
|
|
|
@@ -1839,7 +1861,7 @@ class InteractiveClahePopUp(PopUpMixin):
|
|
|
1839
1861
|
|
|
1840
1862
|
|
|
1841
1863
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="INTERACTIVE CLAHE - SINGLE VIDEO", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1842
|
-
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25)
|
|
1864
|
+
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", file_types=[("VIDEO", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lblwidth=25, lbl_icon='video_2')
|
|
1843
1865
|
run_video_btn = SimbaButton(parent=single_video_frm, txt="RUN SINGLE VIDEO", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_video, width=160)
|
|
1844
1866
|
|
|
1845
1867
|
|
|
@@ -1848,7 +1870,7 @@ class InteractiveClahePopUp(PopUpMixin):
|
|
|
1848
1870
|
run_video_btn.grid(row=1, column=0, sticky="NW")
|
|
1849
1871
|
|
|
1850
1872
|
video_dir_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="INTERACTIVE CLAHE - MULTIPLE VIDEOS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
1851
|
-
self.selected_dir = FolderSelect(video_dir_frm, "VIDEO DIRECTORY PATH:", lblwidth=25)
|
|
1873
|
+
self.selected_dir = FolderSelect(video_dir_frm, "VIDEO DIRECTORY PATH:", lblwidth=25, lbl_icon='folder')
|
|
1852
1874
|
run_dir_btn = SimbaButton(parent=video_dir_frm, txt="RUN VIDEO DIRECTORY", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=self.run_directory, width=160)
|
|
1853
1875
|
video_dir_frm.grid(row=2, column=0, sticky="NW")
|
|
1854
1876
|
self.selected_dir.grid(row=0, column=0, sticky="NW")
|
|
@@ -1907,7 +1929,7 @@ class DownsampleSingleVideoPopUp(PopUpMixin):
|
|
|
1907
1929
|
self.gpu_dropdown.grid(row=0, column=0, sticky=NW)
|
|
1908
1930
|
|
|
1909
1931
|
quality_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="OUTPUT QUALITY", icon_name='pct_2', icon_link=Links.DOWNSAMPLE.value)
|
|
1910
|
-
self.quality_dropdown = SimBADropDown(parent=quality_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY:", label_width=
|
|
1932
|
+
self.quality_dropdown = SimBADropDown(parent=quality_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY:", label_width=20, dropdown_width=35, value=60, img='pct_2', tooltip_key='OUPUT_VIDEO_QUALITY')
|
|
1911
1933
|
quality_frm.grid(row=2, column=0, sticky=NW)
|
|
1912
1934
|
self.quality_dropdown.grid(row=0, column=0, sticky=NW)
|
|
1913
1935
|
|
|
@@ -1970,13 +1992,13 @@ class DownsampleMultipleVideosPopUp(PopUpMixin):
|
|
|
1970
1992
|
|
|
1971
1993
|
gpu_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="GPU (REDUCED RUNTIMES)", icon_name='gpu_3', icon_link=Links.DOWNSAMPLE.value)
|
|
1972
1994
|
gpu_available = NORMAL if check_nvidea_gpu_available() else DISABLED
|
|
1973
|
-
self.gpu_dropdown = SimBADropDown(parent=gpu_frm, label="USE GPU:", dropdown_options=['TRUE', 'FALSE'], dropdown_width=20, value='FALSE', state=gpu_available, img='gpu_3')
|
|
1995
|
+
self.gpu_dropdown = SimBADropDown(parent=gpu_frm, label="USE GPU:", dropdown_options=['TRUE', 'FALSE'], dropdown_width=20, value='FALSE', state=gpu_available, img='gpu_3', label_width=20)
|
|
1974
1996
|
|
|
1975
1997
|
gpu_frm.grid(row=1, column=0, sticky=NW)
|
|
1976
1998
|
self.gpu_dropdown.grid(row=0, column=0, sticky=NW)
|
|
1977
1999
|
|
|
1978
2000
|
quality_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="OUTPUT QUALITY", icon_name='pct_2', icon_link=Links.DOWNSAMPLE.value)
|
|
1979
|
-
self.quality_dropdown = SimBADropDown(parent=quality_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY:", label_width=
|
|
2001
|
+
self.quality_dropdown = SimBADropDown(parent=quality_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY:", label_width=20, dropdown_width=35, value=60, img='pct_2', tooltip_key='OUPUT_VIDEO_QUALITY')
|
|
1980
2002
|
quality_frm.grid(row=2, column=0, sticky=NW)
|
|
1981
2003
|
self.quality_dropdown.grid(row=0, column=0, sticky=NW)
|
|
1982
2004
|
|
|
@@ -2035,16 +2057,15 @@ class DownsampleMultipleVideosPopUp(PopUpMixin):
|
|
|
2035
2057
|
|
|
2036
2058
|
class Convert2jpegPopUp(PopUpMixin):
|
|
2037
2059
|
def __init__(self):
|
|
2038
|
-
super().__init__(title="CONVERT
|
|
2060
|
+
super().__init__(title="CONVERT IMAGES TO JPEG", icon='jpeg')
|
|
2039
2061
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2040
|
-
|
|
2041
|
-
self.quality_scale =
|
|
2042
|
-
self.quality_scale.set(95)
|
|
2062
|
+
|
|
2063
|
+
self.quality_scale = SimBAScaleBar(parent=settings_frm, label="JPEG OUTPUT QUALITY: ", orient=HORIZONTAL, length=200, value=95, label_width=25, lbl_img='pct_2')
|
|
2043
2064
|
settings_frm.grid(row=0, column=0, sticky="NW")
|
|
2044
2065
|
self.quality_scale.grid(row=0, column=0, sticky="NW")
|
|
2045
2066
|
|
|
2046
2067
|
img_dir_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE DIRECTORY TO JPEG", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2047
|
-
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25)
|
|
2068
|
+
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25, lbl_icon='folder')
|
|
2048
2069
|
|
|
2049
2070
|
run_btn_dir = SimbaButton(parent=img_dir_frm, txt="RUN DIRECTORY JPEG CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=self.run_dir)
|
|
2050
2071
|
img_dir_frm.grid(row=1, column=0, sticky="NW")
|
|
@@ -2052,7 +2073,7 @@ class Convert2jpegPopUp(PopUpMixin):
|
|
|
2052
2073
|
run_btn_dir.grid(row=1, column=0, sticky="NW")
|
|
2053
2074
|
|
|
2054
2075
|
img_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE TO JPEG", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2055
|
-
self.selected_file = FileSelect(img_frm, "IMAGE PATH:", title="Select an image file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)])
|
|
2076
|
+
self.selected_file = FileSelect(img_frm, "IMAGE PATH:", title="Select an image file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)], lbl_icon='frames')
|
|
2056
2077
|
|
|
2057
2078
|
run_btn_img = SimbaButton(parent=img_frm, txt="RUN IMAGE JPEG CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=self.run_img)
|
|
2058
2079
|
img_frm.grid(row=2, column=0, sticky="NW")
|
|
@@ -2062,19 +2083,19 @@ class Convert2jpegPopUp(PopUpMixin):
|
|
|
2062
2083
|
def run_dir(self):
|
|
2063
2084
|
folder_path = self.selected_frame_dir.folder_path
|
|
2064
2085
|
check_if_dir_exists(in_dir=folder_path)
|
|
2065
|
-
_ = convert_to_jpeg(path=folder_path, quality=int(self.quality_scale.
|
|
2086
|
+
_ = convert_to_jpeg(path=folder_path, quality=int(self.quality_scale.get_value()), verbose=True)
|
|
2066
2087
|
|
|
2067
2088
|
def run_img(self):
|
|
2068
2089
|
file_path = self.selected_file.file_path
|
|
2069
2090
|
check_file_exist_and_readable(file_path)
|
|
2070
|
-
_ = convert_to_jpeg(path=file_path, quality=int(self.quality_scale.
|
|
2091
|
+
_ = convert_to_jpeg(path=file_path, quality=int(self.quality_scale.get_value()), verbose=True)
|
|
2071
2092
|
|
|
2072
2093
|
|
|
2073
2094
|
class Convert2bmpPopUp(PopUpMixin):
|
|
2074
2095
|
def __init__(self):
|
|
2075
|
-
super().__init__(title="CONVERT IMAGES TO BMP")
|
|
2096
|
+
super().__init__(title="CONVERT IMAGES TO BMP", icon='bmp')
|
|
2076
2097
|
img_dir_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE DIRECTORY TO BMP", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2077
|
-
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25)
|
|
2098
|
+
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25, lbl_icon='folder')
|
|
2078
2099
|
|
|
2079
2100
|
run_btn_dir = SimbaButton(parent=img_dir_frm, txt="RUN DIRECTORY BMP CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=self.run_dir)
|
|
2080
2101
|
img_dir_frm.grid(row=0, column=0, sticky="NW")
|
|
@@ -2082,8 +2103,8 @@ class Convert2bmpPopUp(PopUpMixin):
|
|
|
2082
2103
|
run_btn_dir.grid(row=1, column=0, sticky="NW")
|
|
2083
2104
|
|
|
2084
2105
|
img_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE TO BMP", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2085
|
-
self.selected_file = FileSelect(img_frm, "IMAGE PATH:", title="Select an image file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)])
|
|
2086
|
-
run_btn_img =
|
|
2106
|
+
self.selected_file = FileSelect(img_frm, "IMAGE PATH:", title="Select an image file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)], lbl_icon='bmp')
|
|
2107
|
+
run_btn_img = SimbaButton(parent=img_frm, txt="RUN IMAGE BMP CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run_img())
|
|
2087
2108
|
|
|
2088
2109
|
img_frm.grid(row=1, column=0, sticky="NW")
|
|
2089
2110
|
self.selected_file.grid(row=0, column=0, sticky="NW")
|
|
@@ -2144,13 +2165,11 @@ class Convert2WEBPPopUp(PopUpMixin):
|
|
|
2144
2165
|
|
|
2145
2166
|
class Convert2TIFFPopUp(PopUpMixin):
|
|
2146
2167
|
def __init__(self):
|
|
2147
|
-
super().__init__(title="CONVERT IMAGE DIRECTORY TO TIFF")
|
|
2168
|
+
super().__init__(title="CONVERT IMAGE DIRECTORY TO TIFF", icon='tiff')
|
|
2148
2169
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2149
|
-
self.selected_frame_dir = FolderSelect(settings_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25)
|
|
2150
|
-
self.compression_dropdown =
|
|
2151
|
-
self.
|
|
2152
|
-
self.stack_dropdown = DropDownMenu(settings_frm, "STACK:", ['FALSE', 'TRUE'], labelwidth=25)
|
|
2153
|
-
self.stack_dropdown.setChoices('FALSE')
|
|
2170
|
+
self.selected_frame_dir = FolderSelect(settings_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25, lbl_icon='browse')
|
|
2171
|
+
self.compression_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['raw', 'tiff_deflate', 'tiff_lzw'], label="COMPRESSION:", label_width=25, dropdown_width=25, value='raw', img='file_type')
|
|
2172
|
+
self.stack_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['FALSE', 'TRUE'], label="STACK:", label_width=25, dropdown_width=25, value='FALSE', img='stack')
|
|
2154
2173
|
self.create_run_frm(run_function=self.run, title='RUN TIFF CONVERSION')
|
|
2155
2174
|
|
|
2156
2175
|
settings_frm.grid(row=0, column=0, sticky="NW")
|
|
@@ -2162,23 +2181,23 @@ class Convert2TIFFPopUp(PopUpMixin):
|
|
|
2162
2181
|
def run(self):
|
|
2163
2182
|
folder_path = self.selected_frame_dir.folder_path
|
|
2164
2183
|
check_if_dir_exists(in_dir=folder_path)
|
|
2165
|
-
stack = str_2_bool(self.stack_dropdown.
|
|
2166
|
-
convert_to_tiff(directory=folder_path, compression=self.compression_dropdown.
|
|
2184
|
+
stack = str_2_bool(self.stack_dropdown.get_value())
|
|
2185
|
+
convert_to_tiff(directory=folder_path, compression=self.compression_dropdown.get_value(), verbose=True, stack=stack)
|
|
2167
2186
|
|
|
2168
2187
|
class Convert2PNGPopUp(PopUpMixin):
|
|
2169
2188
|
def __init__(self):
|
|
2170
|
-
super().__init__(title="CONVERT IMAGE TO PNG")
|
|
2189
|
+
super().__init__(title="CONVERT IMAGE TO PNG", icon='png')
|
|
2171
2190
|
img_dir_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE DIRECTORY TO PNG", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2172
|
-
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25)
|
|
2173
|
-
run_btn_dir =
|
|
2191
|
+
self.selected_frame_dir = FolderSelect(img_dir_frm, "IMAGE DIRECTORY PATH:", title="Select a image directory", lblwidth=25, lbl_icon='folder')
|
|
2192
|
+
run_btn_dir = SimbaButton(parent=img_dir_frm, txt="RUN DIRECTORY PNG CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run_dir())
|
|
2174
2193
|
|
|
2175
2194
|
img_dir_frm.grid(row=0, column=0, sticky="NW")
|
|
2176
2195
|
self.selected_frame_dir.grid(row=0, column=0, sticky="NW")
|
|
2177
2196
|
run_btn_dir.grid(row=1, column=0, sticky="NW")
|
|
2178
2197
|
|
|
2179
2198
|
img_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="CONVERT IMAGE TO PNG", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2180
|
-
self.selected_file_dir = FileSelect(img_frm, "IMAGE PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)])
|
|
2181
|
-
run_btn_img =
|
|
2199
|
+
self.selected_file_dir = FileSelect(img_frm, "IMAGE PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_IMAGE_FORMAT_OPTIONS.value)], lbl_icon='file_type')
|
|
2200
|
+
run_btn_img = SimbaButton(parent=img_frm, txt="RUN IMAGE PNG CONVERSION", img='rocket', txt_clr='black', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run_img())
|
|
2182
2201
|
|
|
2183
2202
|
img_frm.grid(row=1, column=0, sticky="NW")
|
|
2184
2203
|
self.selected_file_dir.grid(row=0, column=0, sticky="NW")
|
|
@@ -2647,7 +2666,7 @@ class SuperimposeVideoNamesPopUp(PopUpMixin):
|
|
|
2647
2666
|
self.font_border_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(self.color_dict.keys()), label_width=25, value='Black', label="FONT BORDER COLOR:", img='text')
|
|
2648
2667
|
self.font_border_width_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(2, 52, 2)), label_width=25, value=2, label="FONT BORDER WIDTH:", img='width')
|
|
2649
2668
|
self.quality_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY: ", label_width=25, dropdown_width=30, value=60, img='pct_2', tooltip_key='OUTPUT_VIDEO_QUALITY')
|
|
2650
|
-
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label_width=25, value='FALSE', label="USE GPU:", img='gpu_3', state=self.gpu_available)
|
|
2669
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label_width=25, value='FALSE', label="USE GPU:", img='gpu_3', state=self.gpu_available, tooltip_key='USE_GPU')
|
|
2651
2670
|
|
|
2652
2671
|
|
|
2653
2672
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
@@ -2678,14 +2697,14 @@ class SuperimposeVideoNamesPopUp(PopUpMixin):
|
|
|
2678
2697
|
#self.main_frm.mainloop()
|
|
2679
2698
|
|
|
2680
2699
|
def run(self, multiple: bool):
|
|
2681
|
-
loc = self.location_dropdown.
|
|
2700
|
+
loc = self.location_dropdown.get_value()
|
|
2682
2701
|
loc = self.LOCATIONS[loc]
|
|
2683
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
2684
|
-
font_size = int(self.font_size_dropdown.
|
|
2685
|
-
font = self.font_dropdown.
|
|
2686
|
-
font_clr = self.font_color_dropdown.
|
|
2687
|
-
font_border_clr = self.font_border_dropdown.
|
|
2688
|
-
font_border_width = int(self.font_border_width_dropdown.
|
|
2702
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
2703
|
+
font_size = int(self.font_size_dropdown.get_value())
|
|
2704
|
+
font = self.font_dropdown.get_value()
|
|
2705
|
+
font_clr = self.font_color_dropdown.get_value()
|
|
2706
|
+
font_border_clr = self.font_border_dropdown.get_value()
|
|
2707
|
+
font_border_width = int(self.font_border_width_dropdown.get_value())
|
|
2689
2708
|
if not multiple:
|
|
2690
2709
|
data_path = self.selected_video.file_path
|
|
2691
2710
|
check_file_exist_and_readable(file_path=data_path)
|
|
@@ -2693,7 +2712,7 @@ class SuperimposeVideoNamesPopUp(PopUpMixin):
|
|
|
2693
2712
|
data_path = self.selected_video_dir.folder_path
|
|
2694
2713
|
check_if_dir_exists(in_dir=data_path)
|
|
2695
2714
|
|
|
2696
|
-
quality = int(self.quality_dropdown.
|
|
2715
|
+
quality = int(self.quality_dropdown.get_value())
|
|
2697
2716
|
threading.Thread(target=superimpose_video_names(video_path=data_path,
|
|
2698
2717
|
font=font,
|
|
2699
2718
|
font_size=font_size,
|
|
@@ -2724,7 +2743,7 @@ class SuperimposeTextPopUp(PopUpMixin):
|
|
|
2724
2743
|
self.font_border_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(self.color_dict.keys()), label_width=25, value='Black', label="FONT BORDER COLOR:", img='line')
|
|
2725
2744
|
self.font_border_width_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(2, 52, 2)), label_width=25, value=2, label="FONT BORDER WIDTH:", img='width')
|
|
2726
2745
|
self.quality_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY: ", label_width=25, dropdown_width=30, value=60, img='pct_2', tooltip_key='OUTPUT_VIDEO_QUALITY')
|
|
2727
|
-
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label_width=25, value='FALSE', label="USE GPU:", img='gpu_3', state=self.gpu_available)
|
|
2746
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label_width=25, value='FALSE', label="USE GPU:", img='gpu_3', state=self.gpu_available, tooltip_key='USE_GPU')
|
|
2728
2747
|
|
|
2729
2748
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
2730
2749
|
self.location_dropdown.grid(row=0, column=0, sticky=NW)
|
|
@@ -2747,7 +2766,7 @@ class SuperimposeTextPopUp(PopUpMixin):
|
|
|
2747
2766
|
|
|
2748
2767
|
multiple_videos_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="MULTIPLE VIDEOS - SUPERIMPOSE TEXT", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2749
2768
|
self.selected_video_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", title="Select a video directory", lblwidth=25, lbl_icon='folder')
|
|
2750
|
-
multiple_videos_run =
|
|
2769
|
+
multiple_videos_run = SimbaButton(parent=multiple_videos_frm, txt="RUN - MULTIPLE VIDEOS", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run(multiple=True))
|
|
2751
2770
|
|
|
2752
2771
|
multiple_videos_frm.grid(row=2, column=0, sticky="NW")
|
|
2753
2772
|
self.selected_video_dir.grid(row=0, column=0, sticky="NW")
|
|
@@ -2755,16 +2774,16 @@ class SuperimposeTextPopUp(PopUpMixin):
|
|
|
2755
2774
|
#self.main_frm.mainloop()
|
|
2756
2775
|
|
|
2757
2776
|
def run(self, multiple: bool):
|
|
2758
|
-
loc = self.location_dropdown.
|
|
2777
|
+
loc = self.location_dropdown.get_value()
|
|
2759
2778
|
loc = self.LOCATIONS[loc]
|
|
2760
2779
|
text = self.text_eb.entry_get
|
|
2761
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
2780
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
2762
2781
|
check_str(name='text', value=text)
|
|
2763
|
-
font = self.font_dropdown.
|
|
2764
|
-
font_size = int(self.font_size_dropdown.
|
|
2765
|
-
font_clr = self.font_color_dropdown.
|
|
2766
|
-
font_border_clr = self.font_border_dropdown.
|
|
2767
|
-
font_border_width = int(self.font_border_width_dropdown.
|
|
2782
|
+
font = self.font_dropdown.get_value()
|
|
2783
|
+
font_size = int(self.font_size_dropdown.get_value())
|
|
2784
|
+
font_clr = self.font_color_dropdown.get_value()
|
|
2785
|
+
font_border_clr = self.font_border_dropdown.get_value()
|
|
2786
|
+
font_border_width = int(self.font_border_width_dropdown.get_value())
|
|
2768
2787
|
if not multiple:
|
|
2769
2788
|
data_path = self.selected_video.file_path
|
|
2770
2789
|
check_file_exist_and_readable(file_path=data_path)
|
|
@@ -2772,7 +2791,7 @@ class SuperimposeTextPopUp(PopUpMixin):
|
|
|
2772
2791
|
data_path = self.selected_video_dir.folder_path
|
|
2773
2792
|
check_if_dir_exists(in_dir=data_path)
|
|
2774
2793
|
|
|
2775
|
-
quality = int(self.quality_dropdown.
|
|
2794
|
+
quality = int(self.quality_dropdown.get_value())
|
|
2776
2795
|
threading.Thread(target=superimpose_freetext(video_path=data_path,
|
|
2777
2796
|
text=text,
|
|
2778
2797
|
font=font,
|
|
@@ -2803,7 +2822,7 @@ class BoxBlurPopUp(PopUpMixin):
|
|
|
2803
2822
|
|
|
2804
2823
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="APPLY BOX-BLUR", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
2805
2824
|
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lbl_icon='file')
|
|
2806
|
-
single_video_run =
|
|
2825
|
+
single_video_run = SimbaButton(parent=single_video_frm, txt="RUN", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run())
|
|
2807
2826
|
|
|
2808
2827
|
single_video_frm.grid(row=1, column=0, sticky="NW")
|
|
2809
2828
|
self.selected_video.grid(row=0, column=0, sticky="NW")
|
|
@@ -2814,8 +2833,8 @@ class BoxBlurPopUp(PopUpMixin):
|
|
|
2814
2833
|
def run(self):
|
|
2815
2834
|
video_path = self.selected_video.file_path
|
|
2816
2835
|
check_file_exist_and_readable(file_path=video_path)
|
|
2817
|
-
blur_lvl = float(self.blur_lvl_dropdown.
|
|
2818
|
-
invert = str_2_bool(self.invert_dropdown.
|
|
2836
|
+
blur_lvl = float(self.blur_lvl_dropdown.get_value())
|
|
2837
|
+
invert = str_2_bool(self.invert_dropdown.get_value())
|
|
2819
2838
|
threading.Thread(target=roi_blurbox(video_path=video_path, blur_level=blur_lvl, invert=invert)).start()
|
|
2820
2839
|
|
|
2821
2840
|
|
|
@@ -3044,7 +3063,7 @@ class RotateVideoSetDegreesPopUp(PopUpMixin):
|
|
|
3044
3063
|
self.gpu_dropdown.grid(row=2, column=0, sticky="NW")
|
|
3045
3064
|
|
|
3046
3065
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SINGLE VIDEO - ROTATE", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3047
|
-
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)])
|
|
3066
|
+
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lbl_icon='video_2')
|
|
3048
3067
|
single_video_run = SimbaButton(parent=single_video_frm, txt="RUN - SINGLE VIDEO", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run(multiple=False))
|
|
3049
3068
|
|
|
3050
3069
|
single_video_frm.grid(row=1, column=0, sticky="NW")
|
|
@@ -3052,7 +3071,7 @@ class RotateVideoSetDegreesPopUp(PopUpMixin):
|
|
|
3052
3071
|
single_video_run.grid(row=1, column=0, sticky="NW")
|
|
3053
3072
|
|
|
3054
3073
|
multiple_videos_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="MULTIPLE VIDEOS - ROTATE", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3055
|
-
self.selected_video_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", title="Select a video directory", lblwidth=25)
|
|
3074
|
+
self.selected_video_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", title="Select a video directory", lblwidth=25, lbl_icon='folder')
|
|
3056
3075
|
multiple_videos_run = SimbaButton(parent=multiple_videos_frm, txt="RUN - MULTIPLE VIDEOS", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run(multiple=True))
|
|
3057
3076
|
|
|
3058
3077
|
multiple_videos_frm.grid(row=2, column=0, sticky="NW")
|
|
@@ -3094,7 +3113,7 @@ class FlipVideosPopUp(PopUpMixin):
|
|
|
3094
3113
|
self.gpu_dropdown.grid(row=3, column=0, sticky="NW")
|
|
3095
3114
|
|
|
3096
3115
|
single_video_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SINGLE VIDEO - FLIP", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3097
|
-
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)])
|
|
3116
|
+
self.selected_video = FileSelect(single_video_frm, "VIDEO PATH:", title="Select a video file", lblwidth=25, file_types=[("VIDEO FILE", Options.ALL_VIDEO_FORMAT_STR_OPTIONS.value)], lbl_icon='video_2')
|
|
3098
3117
|
single_video_run = SimbaButton(parent=single_video_frm, txt="RUN - SINGLE VIDEO", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run(multiple=False))
|
|
3099
3118
|
|
|
3100
3119
|
single_video_frm.grid(row=1, column=0, sticky="NW")
|
|
@@ -3102,7 +3121,7 @@ class FlipVideosPopUp(PopUpMixin):
|
|
|
3102
3121
|
single_video_run.grid(row=1, column=0, sticky="NW")
|
|
3103
3122
|
|
|
3104
3123
|
multiple_videos_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="MULTIPLE VIDEOS - FLIP", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3105
|
-
self.selected_video_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", title="Select a video directory", lblwidth=25)
|
|
3124
|
+
self.selected_video_dir = FolderSelect(multiple_videos_frm, "VIDEO DIRECTORY PATH:", title="Select a video directory", lblwidth=25, lbl_icon='folder')
|
|
3106
3125
|
multiple_videos_run = SimbaButton(parent=multiple_videos_frm, txt="RUN - MULTIPLE VIDEOS", img='rocket', txt_clr='blue', font=Formats.FONT_REGULAR.value, cmd=lambda: self.run(multiple=True))
|
|
3107
3126
|
|
|
3108
3127
|
multiple_videos_frm.grid(row=2, column=0, sticky="NW")
|
|
@@ -3134,11 +3153,8 @@ class UpsampleVideosPopUp(PopUpMixin):
|
|
|
3134
3153
|
def __init__(self):
|
|
3135
3154
|
PopUpMixin.__init__(self, title="UPSAMPLE VIDEOS USING INTERPOLATION (WARNING: LONG RUN-TIMES)", icon='sample')
|
|
3136
3155
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3137
|
-
self.fps_dropdown =
|
|
3138
|
-
self.quality_dropdown =
|
|
3139
|
-
|
|
3140
|
-
self.fps_dropdown.setChoices(60)
|
|
3141
|
-
self.quality_dropdown.setChoices(60)
|
|
3156
|
+
self.fps_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(1, 500)), label="NEW FRAME-RATE (FPS):", label_width=25, dropdown_width=25, value=60, img='fps')
|
|
3157
|
+
self.quality_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY (%):", label_width=25, dropdown_width=25, value=60, img='pct_2', tooltip_key='OUTPUT_VIDEO_QUALITY')
|
|
3142
3158
|
settings_frm.grid(row=0, column=0, sticky="NW")
|
|
3143
3159
|
self.fps_dropdown.grid(row=0, column=0, sticky="NW")
|
|
3144
3160
|
self.quality_dropdown.grid(row=1, column=0, sticky="NW")
|
|
@@ -3161,8 +3177,8 @@ class UpsampleVideosPopUp(PopUpMixin):
|
|
|
3161
3177
|
self.main_frm.mainloop()
|
|
3162
3178
|
|
|
3163
3179
|
def run(self, multiple: bool):
|
|
3164
|
-
target_fps = int(self.fps_dropdown.
|
|
3165
|
-
target_quality = int(self.quality_dropdown.
|
|
3180
|
+
target_fps = int(self.fps_dropdown.get_value())
|
|
3181
|
+
target_quality = int(self.quality_dropdown.get_value())
|
|
3166
3182
|
if not multiple:
|
|
3167
3183
|
data_path = self.selected_video.file_path
|
|
3168
3184
|
check_file_exist_and_readable(file_path=data_path)
|
|
@@ -3181,12 +3197,10 @@ class ReverseVideoPopUp(PopUpMixin):
|
|
|
3181
3197
|
PopUpMixin.__init__(self, title="REVERSE VIDEOS", icon='reverse_blue')
|
|
3182
3198
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3183
3199
|
self.MP4_CODEC_LK = {'HEVC (H.265)': 'libx265', 'H.264 (AVC)': 'libx264', 'VP9': 'vp9'}
|
|
3184
|
-
|
|
3185
|
-
self.quality_dropdown
|
|
3186
|
-
self.codec_dropdown =
|
|
3187
|
-
self.
|
|
3188
|
-
self.gpu_dropdown = DropDownMenu(settings_frm, "USE GPU:", ['TRUE', 'FALSE'], labelwidth=25)
|
|
3189
|
-
self.gpu_dropdown.setChoices('FALSE')
|
|
3200
|
+
gpu_state = NORMAL if check_nvidea_gpu_available(raise_error=False) else DISABLED
|
|
3201
|
+
self.quality_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(range(10, 110, 10)), label="OUTPUT VIDEO QUALITY:", label_width=25, dropdown_width=25, value=60, img='pct_2', tooltip_key='OUTPUT_VIDEO_QUALITY')
|
|
3202
|
+
self.codec_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=list(self.MP4_CODEC_LK.keys()), label="COMPRESSION CODEC:", label_width=25, dropdown_width=25, value='HEVC (H.265)', img='file_type')
|
|
3203
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label="USE GPU:", label_width=25, dropdown_width=25, value='FALSE', img='gpu_3', state=gpu_state, tooltip_key='USE_GPU')
|
|
3190
3204
|
|
|
3191
3205
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
3192
3206
|
self.quality_dropdown.grid(row=0, column=0, sticky=NW)
|
|
@@ -3211,9 +3225,9 @@ class ReverseVideoPopUp(PopUpMixin):
|
|
|
3211
3225
|
#self.main_frm.mainloop()
|
|
3212
3226
|
|
|
3213
3227
|
def run(self, multiple: bool):
|
|
3214
|
-
target_quality = int(self.quality_dropdown.
|
|
3215
|
-
codec = self.MP4_CODEC_LK[self.codec_dropdown.
|
|
3216
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
3228
|
+
target_quality = int(self.quality_dropdown.get_value())
|
|
3229
|
+
codec = self.MP4_CODEC_LK[self.codec_dropdown.get_value()]
|
|
3230
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
3217
3231
|
if not multiple:
|
|
3218
3232
|
data_path = self.selected_video.file_path
|
|
3219
3233
|
check_file_exist_and_readable(file_path=data_path)
|
|
@@ -3231,11 +3245,9 @@ class Convert2BlackWhitePopUp(PopUpMixin):
|
|
|
3231
3245
|
PopUpMixin.__init__(self, title="CONVERT VIDEOS TO BLACK AND WHITE (NOTE: NOT GRAYSCALE)", icon='black_and_white')
|
|
3232
3246
|
settings_frm = CreateLabelFrameWithIcon(parent=self.main_frm, header="SETTINGS", icon_name=Keys.DOCUMENTATION.value, icon_link=Links.VIDEO_TOOLS.value)
|
|
3233
3247
|
threshold = [round(x, 2) for x in list(np.arange(0.01, 1.01, 0.01))]
|
|
3234
|
-
|
|
3235
|
-
self.
|
|
3236
|
-
|
|
3237
|
-
self.threshold_dropdown.setChoices(0.5)
|
|
3238
|
-
self.gpu_dropdown.setChoices('FALSE')
|
|
3248
|
+
gpu_state = NORMAL if check_nvidea_gpu_available(raise_error=False) else DISABLED
|
|
3249
|
+
self.threshold_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=threshold, label="BLACK THRESHOLD:", label_width=25, dropdown_width=25, value=0.5, img='threshold')
|
|
3250
|
+
self.gpu_dropdown = SimBADropDown(parent=settings_frm, dropdown_options=['TRUE', 'FALSE'], label="USE GPU:", label_width=25, dropdown_width=25, value='FALSE', img='gpu_3', state=gpu_state, tooltip_key='USE_GPU')
|
|
3239
3251
|
settings_frm.grid(row=0, column=0, sticky=NW)
|
|
3240
3252
|
self.threshold_dropdown.grid(row=0, column=0, sticky=NW)
|
|
3241
3253
|
self.gpu_dropdown.grid(row=1, column=0, sticky=NW)
|
|
@@ -3258,8 +3270,8 @@ class Convert2BlackWhitePopUp(PopUpMixin):
|
|
|
3258
3270
|
#self.main_frm.mainloop()
|
|
3259
3271
|
|
|
3260
3272
|
def run(self, multiple: bool):
|
|
3261
|
-
threshold = float(self.threshold_dropdown.
|
|
3262
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
3273
|
+
threshold = float(self.threshold_dropdown.get_value())
|
|
3274
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
3263
3275
|
if not multiple:
|
|
3264
3276
|
data_path = self.selected_video.file_path
|
|
3265
3277
|
check_file_exist_and_readable(file_path=data_path)
|
|
@@ -3384,7 +3396,7 @@ class ManualTemporalJoinPopUp(PopUpMixin):
|
|
|
3384
3396
|
unique_fps, unique_res = list(set(fps)), list(set(resolutions))
|
|
3385
3397
|
format = self.out_format_dropdown.getChoices()
|
|
3386
3398
|
quality = self.quality_dropdown.getChoices()
|
|
3387
|
-
gpu = str_2_bool(self.gpu_dropdown.
|
|
3399
|
+
gpu = str_2_bool(self.gpu_dropdown.get_value())
|
|
3388
3400
|
if len(unique_fps) > 1: raise FrameRangeError(msg=f'The selected videos contain more than one unique FPS: {unique_fps}', source=self.__class__.__name__)
|
|
3389
3401
|
if len(unique_res) > 1: raise ResolutionError(msg=f'The selected videos contain more than one unique resolutions: {unique_res}', source=self.__class__.__name__)
|
|
3390
3402
|
threading.Thread(temporal_concatenation(video_paths=video_file_paths,
|