removed all print statements

This commit is contained in:
Falko Victor Habel 2024-03-10 17:14:53 +01:00
parent 17c939c15d
commit 2655b22f4c
5 changed files with 2 additions and 23 deletions

View File

@ -42,9 +42,7 @@ class WorkerThread(threading.Thread):
def run(self):
video = cv2.VideoCapture(self.video_path)
if not video.isOpened():
print(f"Error opening video file {self.video_path}")
return
for i in range(self.thread_id, self.last_frame, self.thread_count):
video.set(cv2.CAP_PROP_POS_FRAMES, i) # Seek to the correct frame.

View File

@ -132,7 +132,6 @@ class Labeling(Ctk.CTkFrame):
def set_data_mode(self, value):
system_code.data_mode = value
print(system_code.data_mode)
if system_code.data_mode == "Resize":
self.reset_rectangle()
else:
@ -202,8 +201,6 @@ class Labeling(Ctk.CTkFrame):
self.save_cropped.save(save_path)
self.resolution = self.save_cropped.size
print( self.labeling_boxes)
self.data_saver.append_to_json_file(save_path, self.resolution, self.labeled, self.labeling_boxes, self.mpenn_data[0])
self.reset_rectangle()
os.remove(self.img_paths[self.index])
@ -249,8 +246,7 @@ class Labeling(Ctk.CTkFrame):
# It's assumed to be a file path, try to open as an image file
try:
self.original_image = Image.open(to_displayed)
except Exception as e:
print(f"Error opening image: {e}")
except Exception:
return
self.return_image_information()
@ -273,7 +269,6 @@ class Labeling(Ctk.CTkFrame):
panel_width, panel_height = self.big_canvas.winfo_width(), self.big_canvas.winfo_height()
print("resized:", panel_width, panel_height)
original_width, original_height = self.original_image.size
aspect_ratio = original_width / original_height
@ -289,13 +284,12 @@ class Labeling(Ctk.CTkFrame):
self.displayed_image = self.original_image.resize((new_width, new_height), Image.LANCZOS)
# Calculate and print the size_factor
# Calculate the size_factor
size_factor_width = original_width / new_width
size_factor_height = original_height / new_height
self.img_factor_x = size_factor_width
self.img_factor_y = size_factor_height
print(f"Size Factor: {self.img_factor_x}, {self.img_factor_y}")
def display_image(self):
"""Display the image centered in the canvas."""
@ -380,7 +374,6 @@ class Labeling(Ctk.CTkFrame):
self.start_y = self.end_y
self.end_y = temp
self.big_canvas.coords(self.rect, self.start_x, self.start_y, self.end_x, self.end_y)
print(f"Rectangle coordinates: Start({self.start_x}, {self.start_y}) End({self.end_x}, {self.end_y})")
self.display_cropped_part() # New line to display the cropped area
self.dragging = False # Reset dragging flag
if system_code.data_mode == "Labeling" and self.rect is not None:
@ -506,14 +499,8 @@ class Labeling(Ctk.CTkFrame):
# Optionally, if desired, clear the dragging states
self.dragging = False
# Now print the image position and size if an image is displayed, else, print "No image displayed."
if self.displayed_image:
image_width, image_height = self.displayed_image.size
print(f"Image position: {self.image_position}, Size: {image_width}x{image_height}")
def delete_current_rectangle(self, obj):
"""Remove the rectangle object if coordinates are invalid."""
self.big_canvas.delete(obj)

View File

@ -46,7 +46,6 @@ class SaveData:
try:
with open(file_path, 'w') as json_file:
json.dump({}, json_file) # Creating an empty JSON object
print(f"File '{file_name}' successfully created at '{folder}'.")
return file_path
except OSError as e:
raise OSError(f"Failed to create file in {folder}. Error: {e}")
@ -91,8 +90,6 @@ class SaveData:
with open(filename, 'w') as file:
json.dump(data, file, indent=4)
print(f"Entry added to {filename}.")
def calculate_missing_coordinates_for_each(self, rectangles):
"""
Calculate missing coordinates for each rectangle set in

View File

@ -83,7 +83,6 @@ def save_setting_change():
thread_data = {
"used_threads": calculate_automatic_threads(),
}
print("hello", data_mode)
save_data = {
"img_format": img_format,
"skipable_frames": skipable_frames,
@ -104,7 +103,6 @@ def save_setting_change():
def save_windows_information(geometry, state):
global data
print(data)
"""Save window information to JSON file."""
width, height, _, _ = map(int, re.findall(r'\d+', geometry))
# Get current window information

View File

@ -89,7 +89,6 @@ class Settings(Ctk.CTkFrame):
)
def change_manual_threads(self, value):
print(value)
system_code.used_threads = value
self.thread_count_switch.set(value)