from uwimg import *
im = load_image("data/dog.jpg")
f = make_box_filter(7)
blur = convolve_image(im, f, 1)
save_image(blur, "dog-box7")

im = load_image("data/dog.jpg")
f = make_box_filter(7)
blur = convolve_image(im, f, 1)
thumb = nn_resize(blur, blur.w//7, blur.h//7)
save_image(thumb, "dogthumb")

im = load_image("data/dog.jpg")
f = make_sharpen_filter()
blur = convolve_image(im, f, 1)
clamp_image(blur)
save_image(blur, "dog-sharpen2")

im = load_image("data/dog.jpg")
f = make_highpass_filter()
blur = convolve_image(im, f, 0)
clamp_image(blur)
save_image(blur, "dog-highpass2")

im = load_image("data/dog.jpg")
f = make_emboss_filter()
blur = convolve_image(im, f, 1)
clamp_image(blur)
save_image(blur, "dog-emboss2")

im = load_image("data/dog.jpg")
f = make_gaussian_filter(2)
blur = convolve_image(im, f, 1)
save_image(blur, "dog-gauss2")

im = load_image("data/dog.jpg")
f = make_gaussian_filter(2)
lfreq = convolve_image(im, f, 1)
hfreq = sub_image(im, lfreq)
reconstruct = add_image(lfreq, hfreq)
save_image(lfreq, "low-frequency")
save_image(hfreq, "high-frequency")
save_image(reconstruct, "reconstruct")

im = load_image("data/dog.jpg")
f = make_gaussian_filter(2)
lfreq = convolve_image(im, f, 1)
hfreq = sub_image(im, lfreq)
reconstruct = add_image(lfreq, hfreq)
save_image(lfreq, "low-frequency")
save_image(hfreq, "high-frequency")
save_image(reconstruct, "reconstruct")

im2 = load_image("../../../../Downloads/download (2).jpg")
im1 = load_image("../../../../Downloads/vinni.jpg")
im2 = bilinear_resize(im2, im1.w, im1.h)
low_filter = make_gaussian_filter(5)
high_filter = make_gaussian_filter(10)
lfreq = convolve_image(im1, low_filter, 1)
hfreq = sub_image(im2, convolve_image(im2, high_filter, 1))
reconstruct = add_image(lfreq, hfreq)
clamp_image(hfreq)
clamp_image(reconstruct)
save_image(lfreq, "low-frequency")
save_image(hfreq, "high-frequency")
save_image(reconstruct, "reconstruct_funny_vinni")

im = load_image("data/dog.jpg")
res = colorize_sobel(im)
save_image(res, "colored_sobel_image")
