From d285d1a85da9118bceb80c7cb81e69ac938486cd Mon Sep 17 00:00:00 2001 From: Hillobar <63615199+Hillobar@users.noreply.github.com> Date: Tue, 13 Feb 2024 21:48:20 -0800 Subject: [PATCH] Rope-Opal-01.1 Small bug fix --- rope/GUI.py | 6 +++--- rope/VideoManager.py | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rope/GUI.py b/rope/GUI.py index 86ff9896..46fb2d50 100644 --- a/rope/GUI.py +++ b/rope/GUI.py @@ -569,16 +569,16 @@ def create_gui(self): row += bottom_border_delta # Cats and Dogs - self.widget['ThreadsSlider'] = GE.Slider2(parameters_canvas, 'ThreadsSlider', 'Threads', 3, self.update_data, 'control', 398, 20, 1, row, 0.62) + self.widget['ThreadsSlider'] = GE.Slider2(parameters_canvas, 'ThreadsSlider', 'Threads', 3, self.update_data, 'parameter', 398, 20, 1, row, 0.62) row += row_delta self.widget['DetectTypeTextSel'] = GE.TextSelection(parameters_canvas, 'DetectTypeTextSel', 'Detection Type', 3, self.update_data, 'parameter', 'parameter', 398, 20, 1, row, 0.62) row += row_delta self.widget['DetectScoreSlider'] = GE.Slider2(parameters_canvas, 'DetectScoreSlider', 'Detect Score', 3, self.update_data, 'parameter', 398, 20, 1, row, 0.62) row += row_delta - self.widget['RecordTypeTextSel'] = GE.TextSelection(parameters_canvas, 'RecordTypeTextSel', 'Record Type', 3, self.update_data, 'control', 'control', 398, 20, 1, row, 0.62) + self.widget['RecordTypeTextSel'] = GE.TextSelection(parameters_canvas, 'RecordTypeTextSel', 'Record Type', 3, self.update_data, 'parameter', 'parameter', 398, 20, 1, row, 0.62) row += row_delta - self.widget['VideoQualSlider'] = GE.Slider2(parameters_canvas, 'VideoQualSlider', 'FFMPEG Quality', 3, self.update_data, 'control', 398, 20, 1, row, 0.62) + self.widget['VideoQualSlider'] = GE.Slider2(parameters_canvas, 'VideoQualSlider', 'FFMPEG Quality', 3, self.update_data, 'parameter', 398, 20, 1, row, 0.62) row += row_delta self.widget['MergeTextSel'] = GE.TextSelection(parameters_canvas, 'MergeTextSel', 'Merge Math', 3, self.update_data, 'control', 'control', 398, 20, 1, row, 0.62) diff --git a/rope/VideoManager.py b/rope/VideoManager.py index 210d8752..b74ff86d 100644 --- a/rope/VideoManager.py +++ b/rope/VideoManager.py @@ -276,7 +276,7 @@ def play_video(self, command): self.frame_timer = time.time() # Create reusable queue based on number of threads - for i in range(self.control['ThreadsSlider']): + for i in range(self.parameters['ThreadsSlider']): new_process_q = self.process_q.copy() self.process_qs.append(new_process_q) @@ -343,7 +343,7 @@ def play_video(self, command): self.process_qs = [] self.capture.set(cv2.CAP_PROP_POS_FRAMES, self.current_frame) - for i in range(self.control['ThreadsSlider']): + for i in range(self.parameters['ThreadsSlider']): new_process_q = self.process_q.copy() self.process_qs.append(new_process_q) @@ -360,7 +360,7 @@ def play_video(self, command): self.output = os.path.join(self.saved_video_path, base_filename) self.temp_file = self.output+"_temp"+self.file_name[1] - if self.control['RecordTypeTextSel']=='FFMPEG': + if self.parameters['RecordTypeTextSel']=='FFMPEG': args = ["ffmpeg", '-hide_banner', '-loglevel', 'error', @@ -370,14 +370,14 @@ def play_video(self, command): # '-g', '25', "-vf", "format=yuvj420p", "-c:v", "libx264", - "-crf", str(self.control['VideoQualSlider']), + "-crf", str(self.parameters['VideoQualSlider']), "-r", str(self.fps), "-s", str(frame_width)+"x"+str(frame_height), self.temp_file] self.sp = subprocess.Popen(args, stdin=subprocess.PIPE) - elif self.control['RecordTypeTextSel']=='OPENCV': + elif self.parameters['RecordTypeTextSel']=='OPENCV': size = (frame_width, frame_height) self.sp = cv2.VideoWriter(self.temp_file, cv2.VideoWriter_fourcc(*'mp4v') , self.fps, size) @@ -439,11 +439,11 @@ def process(self): if self.process_qs[index]['Status'] == 'finished': image = self.process_qs[index]['ProcessedFrame'] - if self.control['RecordTypeTextSel']=='FFMPEG': + if self.parameters['RecordTypeTextSel']=='FFMPEG': pil_image = Image.fromarray(image) pil_image.save(self.sp.stdin, 'BMP') - elif self.control['RecordTypeTextSel']=='OPENCV': + elif self.parameters['RecordTypeTextSel']=='OPENCV': self.sp.write(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) temp = [image, self.process_qs[index]['FrameNumber']] @@ -456,10 +456,10 @@ def process(self): if stop_time == 0: stop_time = float(self.video_frame_total) / float(self.fps) - if self.control['RecordTypeTextSel']=='FFMPEG': + if self.parameters['RecordTypeTextSel']=='FFMPEG': self.sp.stdin.close() self.sp.wait() - elif self.control['RecordTypeTextSel']=='OPENCV': + elif self.parameters['RecordTypeTextSel']=='OPENCV': self.sp.release() orig_file = self.target_video