removed all print statements
This commit is contained in:
parent
17c939c15d
commit
2655b22f4c
|
@ -42,9 +42,7 @@ class WorkerThread(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
video = cv2.VideoCapture(self.video_path)
|
video = cv2.VideoCapture(self.video_path)
|
||||||
if not video.isOpened():
|
if not video.isOpened():
|
||||||
print(f"Error opening video file {self.video_path}")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
for i in range(self.thread_id, self.last_frame, self.thread_count):
|
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.
|
video.set(cv2.CAP_PROP_POS_FRAMES, i) # Seek to the correct frame.
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,6 @@ class Labeling(Ctk.CTkFrame):
|
||||||
|
|
||||||
def set_data_mode(self, value):
|
def set_data_mode(self, value):
|
||||||
system_code.data_mode = value
|
system_code.data_mode = value
|
||||||
print(system_code.data_mode)
|
|
||||||
if system_code.data_mode == "Resize":
|
if system_code.data_mode == "Resize":
|
||||||
self.reset_rectangle()
|
self.reset_rectangle()
|
||||||
else:
|
else:
|
||||||
|
@ -202,8 +201,6 @@ class Labeling(Ctk.CTkFrame):
|
||||||
self.save_cropped.save(save_path)
|
self.save_cropped.save(save_path)
|
||||||
self.resolution = self.save_cropped.size
|
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.data_saver.append_to_json_file(save_path, self.resolution, self.labeled, self.labeling_boxes, self.mpenn_data[0])
|
||||||
self.reset_rectangle()
|
self.reset_rectangle()
|
||||||
os.remove(self.img_paths[self.index])
|
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
|
# It's assumed to be a file path, try to open as an image file
|
||||||
try:
|
try:
|
||||||
self.original_image = Image.open(to_displayed)
|
self.original_image = Image.open(to_displayed)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
print(f"Error opening image: {e}")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
self.return_image_information()
|
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()
|
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
|
original_width, original_height = self.original_image.size
|
||||||
aspect_ratio = original_width / original_height
|
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)
|
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_width = original_width / new_width
|
||||||
size_factor_height = original_height / new_height
|
size_factor_height = original_height / new_height
|
||||||
|
|
||||||
self.img_factor_x = size_factor_width
|
self.img_factor_x = size_factor_width
|
||||||
self.img_factor_y = size_factor_height
|
self.img_factor_y = size_factor_height
|
||||||
print(f"Size Factor: {self.img_factor_x}, {self.img_factor_y}")
|
|
||||||
|
|
||||||
def display_image(self):
|
def display_image(self):
|
||||||
"""Display the image centered in the canvas."""
|
"""Display the image centered in the canvas."""
|
||||||
|
@ -380,7 +374,6 @@ class Labeling(Ctk.CTkFrame):
|
||||||
self.start_y = self.end_y
|
self.start_y = self.end_y
|
||||||
self.end_y = temp
|
self.end_y = temp
|
||||||
self.big_canvas.coords(self.rect, self.start_x, self.start_y, self.end_x, self.end_y)
|
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.display_cropped_part() # New line to display the cropped area
|
||||||
self.dragging = False # Reset dragging flag
|
self.dragging = False # Reset dragging flag
|
||||||
if system_code.data_mode == "Labeling" and self.rect is not None:
|
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
|
# Optionally, if desired, clear the dragging states
|
||||||
self.dragging = False
|
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):
|
def delete_current_rectangle(self, obj):
|
||||||
"""Remove the rectangle object if coordinates are invalid."""
|
"""Remove the rectangle object if coordinates are invalid."""
|
||||||
self.big_canvas.delete(obj)
|
self.big_canvas.delete(obj)
|
||||||
|
|
|
@ -46,7 +46,6 @@ class SaveData:
|
||||||
try:
|
try:
|
||||||
with open(file_path, 'w') as json_file:
|
with open(file_path, 'w') as json_file:
|
||||||
json.dump({}, json_file) # Creating an empty JSON object
|
json.dump({}, json_file) # Creating an empty JSON object
|
||||||
print(f"File '{file_name}' successfully created at '{folder}'.")
|
|
||||||
return file_path
|
return file_path
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
raise OSError(f"Failed to create file in {folder}. Error: {e}")
|
raise OSError(f"Failed to create file in {folder}. Error: {e}")
|
||||||
|
@ -91,8 +90,6 @@ class SaveData:
|
||||||
with open(filename, 'w') as file:
|
with open(filename, 'w') as file:
|
||||||
json.dump(data, file, indent=4)
|
json.dump(data, file, indent=4)
|
||||||
|
|
||||||
print(f"Entry added to {filename}.")
|
|
||||||
|
|
||||||
def calculate_missing_coordinates_for_each(self, rectangles):
|
def calculate_missing_coordinates_for_each(self, rectangles):
|
||||||
"""
|
"""
|
||||||
Calculate missing coordinates for each rectangle set in
|
Calculate missing coordinates for each rectangle set in
|
||||||
|
|
|
@ -83,7 +83,6 @@ def save_setting_change():
|
||||||
thread_data = {
|
thread_data = {
|
||||||
"used_threads": calculate_automatic_threads(),
|
"used_threads": calculate_automatic_threads(),
|
||||||
}
|
}
|
||||||
print("hello", data_mode)
|
|
||||||
save_data = {
|
save_data = {
|
||||||
"img_format": img_format,
|
"img_format": img_format,
|
||||||
"skipable_frames": skipable_frames,
|
"skipable_frames": skipable_frames,
|
||||||
|
@ -104,7 +103,6 @@ def save_setting_change():
|
||||||
|
|
||||||
def save_windows_information(geometry, state):
|
def save_windows_information(geometry, state):
|
||||||
global data
|
global data
|
||||||
print(data)
|
|
||||||
"""Save window information to JSON file."""
|
"""Save window information to JSON file."""
|
||||||
width, height, _, _ = map(int, re.findall(r'\d+', geometry))
|
width, height, _, _ = map(int, re.findall(r'\d+', geometry))
|
||||||
# Get current window information
|
# Get current window information
|
||||||
|
|
|
@ -89,7 +89,6 @@ class Settings(Ctk.CTkFrame):
|
||||||
)
|
)
|
||||||
|
|
||||||
def change_manual_threads(self, value):
|
def change_manual_threads(self, value):
|
||||||
print(value)
|
|
||||||
system_code.used_threads = value
|
system_code.used_threads = value
|
||||||
self.thread_count_switch.set(value)
|
self.thread_count_switch.set(value)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue