Skip to content
Snippets Groups Projects
Verified Commit 2c7849db authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

feat: gauss (i dont effing know tbhh) lab4

parent eade7d6a
Branches
No related tags found
No related merge requests found
......@@ -108,11 +108,21 @@ def sharpen(img: Img, isotropy: Isotropy) -> Img:
return new_image
def gauss_kernel(length: int = 3, sigma: float = 1.0) -> Img:
half = (length - 1) / 2
x_axis = np.linspace(-half, half, length)
gauss = np.exp(-0.5 * np.square(x_axis) / np.square(sigma))
kernel = np.outer(gauss, gauss)
return kernel / np.sum(kernel)
if __name__ == "__main__":
img = load_img("resources/hotel.png")
img = load_img("resources/noisy_hotel.png")
gray = rgb_to_gray(img)
laplacian = laplace(gray, Isotropy.ISO_45)
laplacian = laplace(xcorr(gray, gauss_kernel()), Isotropy.ISO_45)
thresholded = thresholding(laplacian, 50)
sharp_iso_90 = sharpen(gray, Isotropy.ISO_90)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment