Skip to content
Snippets Groups Projects
Commit 4cfed8cb authored by Christian's avatar Christian
Browse files

Started formatting

parent 4ee3e3a9
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,6 @@ from PyQt5.QtGui import QPixmap, QImage
from PyQt5.QtCore import Qt
import numpy as np
class AdvancedSettingsWidget(QWidget):
"""
Shows toggle rainbow, circle editor, line smoothing slider, contrast slider,
......
......@@ -4,12 +4,24 @@ from compute_disk_size import compute_disk_size
from load_image import load_image
from preprocess_image import preprocess_image
from circle_edge_kernel import circle_edge_kernel
def compute_cost_image(path, user_radius, sigma=3, clip_limit=0.01):
import numpy as np
def compute_cost_image(path: str, user_radius: int, sigma: int = 3, clip_limit: float = 0.01) -> np.ndarray:
"""
Compute the cost image for a given image path, user radius, and optional parameters.
Args:
path: The path to the image file.
user_radius: The radius of the disk.
sigma: The standard deviation for Gaussian smoothing.
clip_limit: The limit for contrasting the image.
Returns:
The cost image as a NumPy array.
"""
disk_size = compute_disk_size(user_radius)
### Load image
# Load image
image = load_image(path)
# Apply smoothing
......@@ -18,7 +30,7 @@ def compute_cost_image(path, user_radius, sigma=3, clip_limit=0.01):
# Apply Canny edge detection
canny_img = canny(smoothed_img)
# Do disk thing
# Perform disk convolution
binary_img = canny_img
kernel = circle_edge_kernel(k_size=disk_size)
convolved = convolve2d(binary_img, kernel, mode='same', boundary='fill')
......
......@@ -244,8 +244,6 @@ class MainWindow(QMainWindow):
print(f"Exported path with {len(full_xy)} points to {file_path}")
def clear_points(self):
self.image_view.clear_guide_points()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment