Skip to content

Commit

Permalink
Rope-Opal-01.1
Browse files Browse the repository at this point in the history
Small bug fix
  • Loading branch information
Hillobar authored Feb 14, 2024
1 parent 2259abf commit d285d1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions rope/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
18 changes: 9 additions & 9 deletions rope/VideoManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand All @@ -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',
Expand All @@ -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)

Expand Down Expand Up @@ -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']]
Expand All @@ -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
Expand Down

0 comments on commit d285d1a

Please sign in to comment.