diff --git a/app.py b/app.py index 9465a70..78b94dc 100755 --- a/app.py +++ b/app.py @@ -11,7 +11,7 @@ import cv2 from DeepLabStream import DeepLabStream, show_stream -from utils.configloader import MULTI_CAM, STREAMS, RECORD_EXP +from utils.configloader import MULTI_CAM, STREAMS, RECORD_EXP, RECORD_RAW from utils.gui_image import QFrame, ImageWindow, emit_qframes from PyQt5.QtCore import QThread @@ -45,10 +45,6 @@ def run(self): all_frames = stream_manager.get_frames() color_frames, depth_maps, infra_frames = all_frames - # writing the video - if stream_manager.recording_status(): - stream_manager.write_video(color_frames, stream_manager.frame_index) - if stream_manager.dlc_status(): # outputting the frames res_frames, res_time = stream_manager.get_analysed_frames() @@ -60,6 +56,13 @@ def run(self): else: self._stream_frames(color_frames) + # writing the video + if stream_manager.recording_status(): + if res_frames and not RECORD_RAW: + stream_manager.write_video(res_frames, stream_manager.frame_index) + else: + stream_manager.write_video(color_frames, stream_manager.frame_index) + stream_manager.frame_index += 1 def stop(self): diff --git a/utils/advanced_settings.ini b/utils/advanced_settings.ini index 70d69dc..5d9a876 100644 --- a/utils/advanced_settings.ini +++ b/utils/advanced_settings.ini @@ -4,4 +4,7 @@ STREAMS = color, depth, infrared MULTIPLE_DEVICES = False STACK_FRAMES = False -ANIMALS_NUMBER = 1 \ No newline at end of file +ANIMALS_NUMBER = 1 + +[Video] +RECORD_RAW = True \ No newline at end of file diff --git a/utils/configloader.py b/utils/configloader.py index 231e0b5..c194b31 100644 --- a/utils/configloader.py +++ b/utils/configloader.py @@ -67,3 +67,4 @@ def get_script_path(): 'STACK_FRAMES') is not None else False ANIMALS_NUMBER = adv_dsc_config['Streaming'].getint('ANIMALS_NUMBER') if adv_dsc_config['Streaming'].getint( 'ANIMALS_NUMBER') is not None else 1 +RECORD_RAW = adv_dsc_config['Video'].getboolean('RECORD_RAW')