diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..628de45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.vscode/ +imageEngine/images/ +imageEngine/test/ +imageEngine/__pycache__/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 457f44d..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.analysis.typeCheckingMode": "basic" -} \ No newline at end of file diff --git a/imageEngine/__pycache__/umage.cpython-311.pyc b/imageEngine/__pycache__/umage.cpython-311.pyc deleted file mode 100644 index c07f66a..0000000 Binary files a/imageEngine/__pycache__/umage.cpython-311.pyc and /dev/null differ diff --git a/imageEngine/filters/canny.py b/imageEngine/filters/canny.py new file mode 100644 index 0000000..f1469fc --- /dev/null +++ b/imageEngine/filters/canny.py @@ -0,0 +1,39 @@ +from usefull_func import * +from math import sqrt, atan2 + +#En_cours... +def filtre_canny(img): + + def norme_gradient(pixel1, pixel2): + color_x = pixel1[0] + color_y = pixel2[0] + + norm = round(sqrt(color_x**2 + color_y**2)) + norm = min(norm, 255) + + grad = atan2(color_y, color_x) + return norm, grad + + def liste_normGrad(im1, im2): + liste = [] + for j in range(len(im1)): + ligne = [] + for i in range(len(im1[0])): + normGrad = norme_gradient(im1[j][i], im2[j][i]) + ligne.append(normGrad) + liste.append(ligne) + return liste + + if not is_greyscale(img): + img = greyscale(img) + + mat_x = [[-1,0,1]] + mat_y = [[1],[0],[-1]] + + #lissage/suppression des bri + img_no_bruit = convolution_gauss(img) + Jx = convolution(img, mat_x) + Jy = convolution(img, mat_y) + normGrad = liste_normGrad(Jx, Jy) + #Suppresion des non-maximum + diff --git a/imageEngine/filters/sobel.py b/imageEngine/filters/sobel.py new file mode 100644 index 0000000..677ec51 --- /dev/null +++ b/imageEngine/filters/sobel.py @@ -0,0 +1,16 @@ +from usefull_func import * + + +def filtre_sobel(img): + + if not is_greyscale(img): + img = greyscale(img) + + mat_x = [[-1,0,1],[-2,0,2],[-1,0,1]] + mat_y = [[-1,-2,-1],[0,0,0],[1,2,1]] + Gx = convolution(img, mat_x) + Gy = convolution(img, mat_y) + + filtred_image = application_norme(Gx,Gy) + return filtred_image + diff --git a/imageEngine/filters/usefull_func.py b/imageEngine/filters/usefull_func.py new file mode 100644 index 0000000..af173a5 --- /dev/null +++ b/imageEngine/filters/usefull_func.py @@ -0,0 +1,105 @@ +from math import sqrt + +def greyscale(mat_img): + gray_img = [] + for ligne in mat_img: + lig = [] + for r,g,b in ligne: + v = int(r*0.2125 + g*0.7154 + b*0.0721) + lig.append((v,)*3) + gray_img.append(lig) + return gray_img + +def appliquer_convolution(img, mat, i, j): + somme = 0 + for y in range(len(mat)): + for x in range(len(mat[0])): + pixel_i = i - (len(mat[0]) // 2) + x + pixel_j = j - (len(mat) // 2) + y + pix = pixel(img, pixel_i, pixel_j) + somme += pix[0]*mat[y][x] + return min(max(somme,0), 255) + +def convolution(mat_img, mat): + return_img = [] + for j in range(len(mat_img)): + ligne = [] + for i in range(len(mat_img[0])): + val = appliquer_convolution(mat_img, mat, i, j) + ligne.append((val,)*3) + return_img.append(ligne) + return return_img + +def is_greyscale(img): + _greyscale = True + for ligne in img: + for r,g,b in ligne: + if not (r==g and g==b): + _greyscale = False + break + if not _greyscale: + break + return _greyscale + +def invert(img): + result_image = [] + for ligne in img: + result_ligne = [] + for r,g,b in ligne: + result_ligne.append((255-r, 255-g, 255-b)) + result_image.append(result_ligne) + return result_image + +def pixel(img, i, j, default=(0,0,0)): + #i la colone et j la ligne + if 0 <= i < len(img[0]) and 0 <= j < len(img): + return img[j][i] + else: + return default + +def reduction_bruit(img, mat, i, j): + somme = 0 + for y in range(len(mat)): + for x in range(len(mat[0])): + pixel_i = i - (len(mat[0]) // 2) + x + pixel_j = j - (len(mat) // 2) + y + pix = pixel(img, pixel_i, pixel_j) + somme += pix[0]*mat[y][x] + normalise = round(somme) + return normalise + +def convolution_gauss(mat_img): + mat_gauss = [ + [2/159, 4/159, 5/159, 4/159,2/159], + [4/159, 9/159,12/159, 9/159,4/159], + [5/159,12/159,15/159,12/159,5/159], + [4/159, 9/159,12/159, 9/159,4/159], + [2/159, 4/159, 5/159, 4/159,2/159] + ] + + return_img = [] + for j in range(len(mat_img)): + ligne = [] + for i in range(len(mat_img[0])): + val = reduction_bruit(mat_img, mat_gauss, i, j) + ligne.append((val,)*3) + return_img.append(ligne) + return return_img + +def calcul_norme(pixel1, pixel2): + valeur = pixel1[0]**2 + pixel2[0]**2 + norm = round(sqrt(valeur)) + norm = int(min(norm, 255)) + return norm + +def application_norme(im_x, im_y): + result_image = [] + for j in range(len(im_x)): + ligne = [] + for i in range(len(im_x[0])): + pixel1 = im_x[j][i] + pixel2 = im_y[j][i] + norme = calcul_norme(pixel1, pixel2) + ligne.append((norme,)*3) + result_image.append(ligne) + return result_image \ No newline at end of file diff --git a/imageEngine/gray_images/cute_gray.png b/imageEngine/gray_images/cute_gray.png deleted file mode 100644 index a9f57ab..0000000 Binary files a/imageEngine/gray_images/cute_gray.png and /dev/null differ diff --git a/imageEngine/gray_images/figure_2_gray.png b/imageEngine/gray_images/figure_2_gray.png deleted file mode 100644 index a544245..0000000 Binary files a/imageEngine/gray_images/figure_2_gray.png and /dev/null differ diff --git a/imageEngine/image_test.jpg b/imageEngine/image_test.jpg deleted file mode 100644 index d401a4f..0000000 Binary files a/imageEngine/image_test.jpg and /dev/null differ diff --git a/imageEngine/images/figure_2.png b/imageEngine/images/figure_2.png deleted file mode 100644 index 4076ea9..0000000 Binary files a/imageEngine/images/figure_2.png and /dev/null differ diff --git a/imageEngine/images/lena.png b/imageEngine/images/lena.png deleted file mode 100644 index 9760430..0000000 Binary files a/imageEngine/images/lena.png and /dev/null differ diff --git a/imageEngine/images/valve.png b/imageEngine/images/valve.png deleted file mode 100644 index 79ee8d5..0000000 Binary files a/imageEngine/images/valve.png and /dev/null differ diff --git a/imageEngine/invert_images/invert_cute.png b/imageEngine/invert_images/invert_cute.png deleted file mode 100644 index 3c21051..0000000 Binary files a/imageEngine/invert_images/invert_cute.png and /dev/null differ diff --git a/imageEngine/main.py b/imageEngine/main.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/imageEngine/main.py @@ -0,0 +1 @@ + diff --git a/imageEngine/my_images/#男性 hiro 016 - JUNKTのイラスト - pixiv.jpeg b/imageEngine/my_images/#男性 hiro 016 - JUNKTのイラスト - pixiv.jpeg deleted file mode 100644 index da34de1..0000000 Binary files a/imageEngine/my_images/#男性 hiro 016 - JUNKTのイラスト - pixiv.jpeg and /dev/null differ diff --git a/imageEngine/my_images/002 wallpaper by mrdmtx - Download on ZEDGE™ _ f370.jpeg b/imageEngine/my_images/002 wallpaper by mrdmtx - Download on ZEDGE™ _ f370.jpeg deleted file mode 100644 index 27e6797..0000000 Binary files a/imageEngine/my_images/002 wallpaper by mrdmtx - Download on ZEDGE™ _ f370.jpeg and /dev/null differ diff --git a/imageEngine/my_images/16140374-1277-4256-b868-c3e2afa22d92.jpeg b/imageEngine/my_images/16140374-1277-4256-b868-c3e2afa22d92.jpeg deleted file mode 100644 index b257269..0000000 Binary files a/imageEngine/my_images/16140374-1277-4256-b868-c3e2afa22d92.jpeg and /dev/null differ diff --git a/imageEngine/my_images/48447f61-564c-4117-b0ce-ecddb9b2f523.jpeg b/imageEngine/my_images/48447f61-564c-4117-b0ce-ecddb9b2f523.jpeg deleted file mode 100644 index 2b3a738..0000000 Binary files a/imageEngine/my_images/48447f61-564c-4117-b0ce-ecddb9b2f523.jpeg and /dev/null differ diff --git a/imageEngine/my_images/5252b97a-f315-4f8d-b90c-61cded685a41.jpeg b/imageEngine/my_images/5252b97a-f315-4f8d-b90c-61cded685a41.jpeg deleted file mode 100644 index 5dad44a..0000000 Binary files a/imageEngine/my_images/5252b97a-f315-4f8d-b90c-61cded685a41.jpeg and /dev/null differ diff --git a/imageEngine/my_images/6e57e80c-01cc-43b4-8869-d8fe002c9d17.jpeg b/imageEngine/my_images/6e57e80c-01cc-43b4-8869-d8fe002c9d17.jpeg deleted file mode 100644 index 00ed5a0..0000000 Binary files a/imageEngine/my_images/6e57e80c-01cc-43b4-8869-d8fe002c9d17.jpeg and /dev/null differ diff --git a/imageEngine/my_images/7dd03be6-fc18-4c03-91e5-6d7da4b4a804.jpeg b/imageEngine/my_images/7dd03be6-fc18-4c03-91e5-6d7da4b4a804.jpeg deleted file mode 100644 index 64980a3..0000000 Binary files a/imageEngine/my_images/7dd03be6-fc18-4c03-91e5-6d7da4b4a804.jpeg and /dev/null differ diff --git a/imageEngine/my_images/83d01294-7873-4b40-8ccd-3a0fa5180726.jpeg b/imageEngine/my_images/83d01294-7873-4b40-8ccd-3a0fa5180726.jpeg deleted file mode 100644 index 3fb7355..0000000 Binary files a/imageEngine/my_images/83d01294-7873-4b40-8ccd-3a0fa5180726.jpeg and /dev/null differ diff --git a/imageEngine/my_images/86db3e06-216f-4470-b209-db062275fe42.jpeg b/imageEngine/my_images/86db3e06-216f-4470-b209-db062275fe42.jpeg deleted file mode 100644 index 59ed115..0000000 Binary files a/imageEngine/my_images/86db3e06-216f-4470-b209-db062275fe42.jpeg and /dev/null differ diff --git a/imageEngine/my_images/892b9be3-4622-4f2f-929b-2b322121fb53.jpeg b/imageEngine/my_images/892b9be3-4622-4f2f-929b-2b322121fb53.jpeg deleted file mode 100644 index 44b366c..0000000 Binary files a/imageEngine/my_images/892b9be3-4622-4f2f-929b-2b322121fb53.jpeg and /dev/null differ diff --git a/imageEngine/my_images/90455a49-ad7c-43db-a6f2-c7e02629d8a1.jpeg b/imageEngine/my_images/90455a49-ad7c-43db-a6f2-c7e02629d8a1.jpeg deleted file mode 100644 index ef0b644..0000000 Binary files a/imageEngine/my_images/90455a49-ad7c-43db-a6f2-c7e02629d8a1.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Anime Funny Art on Twitter.jpeg b/imageEngine/my_images/Anime Funny Art on Twitter.jpeg deleted file mode 100644 index 9bbdcc9..0000000 Binary files a/imageEngine/my_images/Anime Funny Art on Twitter.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Christmas Spectre [Twitter lists 彩羽とも].jpeg b/imageEngine/my_images/Christmas Spectre [Twitter lists 彩羽とも].jpeg deleted file mode 100644 index b38181a..0000000 Binary files a/imageEngine/my_images/Christmas Spectre [Twitter lists 彩羽とも].jpeg and /dev/null differ diff --git a/imageEngine/my_images/CosplayClass Official Site - Shop Cosplay Costumes Latest & Greatest_.jpeg b/imageEngine/my_images/CosplayClass Official Site - Shop Cosplay Costumes Latest & Greatest_.jpeg deleted file mode 100644 index 3ccf91e..0000000 Binary files a/imageEngine/my_images/CosplayClass Official Site - Shop Cosplay Costumes Latest & Greatest_.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Cute.jpg b/imageEngine/my_images/Cute.jpg deleted file mode 100644 index b2d9fc1..0000000 Binary files a/imageEngine/my_images/Cute.jpg and /dev/null differ diff --git a/imageEngine/my_images/Download Beautiful Anime Girl, Manga Anime, Anime Art, Zero - Two Darling Render Zero Two PNG Image with No Backgroud - PNGkey_com.png b/imageEngine/my_images/Download Beautiful Anime Girl, Manga Anime, Anime Art, Zero - Two Darling Render Zero Two PNG Image with No Backgroud - PNGkey_com.png deleted file mode 100644 index ef08b88..0000000 Binary files a/imageEngine/my_images/Download Beautiful Anime Girl, Manga Anime, Anime Art, Zero - Two Darling Render Zero Two PNG Image with No Backgroud - PNGkey_com.png and /dev/null differ diff --git a/imageEngine/my_images/Fond d'écran Chainsaw Man à télécharger HD_4K_1080p - Fond-Ecran-Anime_fr.png b/imageEngine/my_images/Fond d'écran Chainsaw Man à télécharger HD_4K_1080p - Fond-Ecran-Anime_fr.png deleted file mode 100644 index 3221407..0000000 Binary files a/imageEngine/my_images/Fond d'écran Chainsaw Man à télécharger HD_4K_1080p - Fond-Ecran-Anime_fr.png and /dev/null differ diff --git a/imageEngine/my_images/Image about cute in Darling In The Franxx 💕 by _ Pinky_Bubble _ ♥️.jpeg b/imageEngine/my_images/Image about cute in Darling In The Franxx 💕 by _ Pinky_Bubble _ ♥️.jpeg deleted file mode 100644 index 3802d55..0000000 Binary files a/imageEngine/my_images/Image about cute in Darling In The Franxx 💕 by _ Pinky_Bubble _ ♥️.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Jabami Yumeko - Kakegurui - Image by mangajin08 #2390684 - Zerochan Anime Image Board.jpeg b/imageEngine/my_images/Jabami Yumeko - Kakegurui - Image by mangajin08 #2390684 - Zerochan Anime Image Board.jpeg deleted file mode 100644 index 12eecbc..0000000 Binary files a/imageEngine/my_images/Jabami Yumeko - Kakegurui - Image by mangajin08 #2390684 - Zerochan Anime Image Board.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Kerno(カーノ) on Twitter.jpeg b/imageEngine/my_images/Kerno(カーノ) on Twitter.jpeg deleted file mode 100644 index 7a58fc8..0000000 Binary files a/imageEngine/my_images/Kerno(カーノ) on Twitter.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Kitagawa Marin - Sono Bisque Doll wa Koi wo Suru - Image by Lancheu #3572716 - Zerochan Anime Image Board.jpeg b/imageEngine/my_images/Kitagawa Marin - Sono Bisque Doll wa Koi wo Suru - Image by Lancheu #3572716 - Zerochan Anime Image Board.jpeg deleted file mode 100644 index b0595d0..0000000 Binary files a/imageEngine/my_images/Kitagawa Marin - Sono Bisque Doll wa Koi wo Suru - Image by Lancheu #3572716 - Zerochan Anime Image Board.jpeg and /dev/null differ diff --git a/imageEngine/my_images/LiL¥⛧.jpeg b/imageEngine/my_images/LiL¥⛧.jpeg deleted file mode 100644 index 97f9aaf..0000000 Binary files a/imageEngine/my_images/LiL¥⛧.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Makima chainsaw man.jpeg b/imageEngine/my_images/Makima chainsaw man.jpeg deleted file mode 100644 index 607c626..0000000 Binary files a/imageEngine/my_images/Makima chainsaw man.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Makima.png b/imageEngine/my_images/Makima.png deleted file mode 100644 index 5a282c8..0000000 Binary files a/imageEngine/my_images/Makima.png and /dev/null differ diff --git a/imageEngine/my_images/Marin Kitagawa Icon.jpeg b/imageEngine/my_images/Marin Kitagawa Icon.jpeg deleted file mode 100644 index ff78e5f..0000000 Binary files a/imageEngine/my_images/Marin Kitagawa Icon.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Marin Kitagawa📸🔥.jpeg b/imageEngine/my_images/Marin Kitagawa📸🔥.jpeg deleted file mode 100644 index 3ecb506..0000000 Binary files a/imageEngine/my_images/Marin Kitagawa📸🔥.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Marin.jpeg b/imageEngine/my_images/Marin.jpeg deleted file mode 100644 index 3b0c1bd..0000000 Binary files a/imageEngine/my_images/Marin.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Mary y Yumeko.jpeg b/imageEngine/my_images/Mary y Yumeko.jpeg deleted file mode 100644 index 5b2b0f0..0000000 Binary files a/imageEngine/my_images/Mary y Yumeko.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Megumi Fushiguro.jpeg b/imageEngine/my_images/Megumi Fushiguro.jpeg deleted file mode 100644 index 5432a7e..0000000 Binary files a/imageEngine/my_images/Megumi Fushiguro.jpeg and /dev/null differ diff --git a/imageEngine/my_images/My Anime For Life.jpeg b/imageEngine/my_images/My Anime For Life.jpeg deleted file mode 100644 index 339d645..0000000 Binary files a/imageEngine/my_images/My Anime For Life.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Nardack🦋 on Twitter.jpeg b/imageEngine/my_images/Nardack🦋 on Twitter.jpeg deleted file mode 100644 index 6d264cb..0000000 Binary files a/imageEngine/my_images/Nardack🦋 on Twitter.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Pin de aiSticker en Stikers en 2022 _ Dibujos kawaii, Personajes de anime, Dibujos bonitos.jpeg b/imageEngine/my_images/Pin de aiSticker en Stikers en 2022 _ Dibujos kawaii, Personajes de anime, Dibujos bonitos.jpeg deleted file mode 100644 index dbc2900..0000000 Binary files a/imageEngine/my_images/Pin de aiSticker en Stikers en 2022 _ Dibujos kawaii, Personajes de anime, Dibujos bonitos.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Pinterest.jpeg b/imageEngine/my_images/Pinterest.jpeg deleted file mode 100644 index 7a01429..0000000 Binary files a/imageEngine/my_images/Pinterest.jpeg and /dev/null differ diff --git a/imageEngine/my_images/SCROLL.jpeg b/imageEngine/my_images/SCROLL.jpeg deleted file mode 100644 index ffe96da..0000000 Binary files a/imageEngine/my_images/SCROLL.jpeg and /dev/null differ diff --git a/imageEngine/my_images/STE.jpeg b/imageEngine/my_images/STE.jpeg deleted file mode 100644 index 6433c9e..0000000 Binary files a/imageEngine/my_images/STE.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Steven A_ Starphase - Kekkai Sensen - Mobile Wallpaper by Nngs #2067816 - Zerochan Anime Image Board.jpeg b/imageEngine/my_images/Steven A_ Starphase - Kekkai Sensen - Mobile Wallpaper by Nngs #2067816 - Zerochan Anime Image Board.jpeg deleted file mode 100644 index 36834c9..0000000 Binary files a/imageEngine/my_images/Steven A_ Starphase - Kekkai Sensen - Mobile Wallpaper by Nngs #2067816 - Zerochan Anime Image Board.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Tanya Degurechaff.jpeg b/imageEngine/my_images/Tanya Degurechaff.jpeg deleted file mode 100644 index 716cbe0..0000000 Binary files a/imageEngine/my_images/Tanya Degurechaff.jpeg and /dev/null differ diff --git a/imageEngine/my_images/This one's for Zero Two.jpeg b/imageEngine/my_images/This one's for Zero Two.jpeg deleted file mode 100644 index e4bfa8d..0000000 Binary files a/imageEngine/my_images/This one's for Zero Two.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Twitter.jpeg b/imageEngine/my_images/Twitter.jpeg deleted file mode 100644 index ee47d3e..0000000 Binary files a/imageEngine/my_images/Twitter.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Youjo Senki wallpaper by MOTOVOh - Download on ZEDGE™ _ c84d.jpeg b/imageEngine/my_images/Youjo Senki wallpaper by MOTOVOh - Download on ZEDGE™ _ c84d.jpeg deleted file mode 100644 index df6380f..0000000 Binary files a/imageEngine/my_images/Youjo Senki wallpaper by MOTOVOh - Download on ZEDGE™ _ c84d.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Zero two, anime girl, artwork, 480x800 wallpaper.jpeg b/imageEngine/my_images/Zero two, anime girl, artwork, 480x800 wallpaper.jpeg deleted file mode 100644 index 3263f87..0000000 Binary files a/imageEngine/my_images/Zero two, anime girl, artwork, 480x800 wallpaper.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Zero_Two.jpeg b/imageEngine/my_images/Zero_Two.jpeg deleted file mode 100644 index 8efd10b..0000000 Binary files a/imageEngine/my_images/Zero_Two.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Zero_Two.png b/imageEngine/my_images/Zero_Two.png deleted file mode 100644 index 2738792..0000000 Binary files a/imageEngine/my_images/Zero_Two.png and /dev/null differ diff --git a/imageEngine/my_images/Zero_Two_1.jpeg b/imageEngine/my_images/Zero_Two_1.jpeg deleted file mode 100644 index b8d42b1..0000000 Binary files a/imageEngine/my_images/Zero_Two_1.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Zero_Two_3.jpeg b/imageEngine/my_images/Zero_Two_3.jpeg deleted file mode 100644 index fa6c311..0000000 Binary files a/imageEngine/my_images/Zero_Two_3.jpeg and /dev/null differ diff --git a/imageEngine/my_images/aa8f3d45-e396-48a1-994e-32fab5570483.jpeg b/imageEngine/my_images/aa8f3d45-e396-48a1-994e-32fab5570483.jpeg deleted file mode 100644 index 083c2b0..0000000 Binary files a/imageEngine/my_images/aa8f3d45-e396-48a1-994e-32fab5570483.jpeg and /dev/null differ diff --git a/imageEngine/my_images/couple icon.jpeg b/imageEngine/my_images/couple icon.jpeg deleted file mode 100644 index c145fb0..0000000 Binary files a/imageEngine/my_images/couple icon.jpeg and /dev/null differ diff --git a/imageEngine/my_images/d51cfc50-f94e-442b-89f9-7aa58b1740b5.jpeg b/imageEngine/my_images/d51cfc50-f94e-442b-89f9-7aa58b1740b5.jpeg deleted file mode 100644 index 60024db..0000000 Binary files a/imageEngine/my_images/d51cfc50-f94e-442b-89f9-7aa58b1740b5.jpeg and /dev/null differ diff --git a/imageEngine/my_images/e1a62b2d-ad82-4737-9b2d-aea11ee5c6ae.jpeg b/imageEngine/my_images/e1a62b2d-ad82-4737-9b2d-aea11ee5c6ae.jpeg deleted file mode 100644 index 1c1d0fd..0000000 Binary files a/imageEngine/my_images/e1a62b2d-ad82-4737-9b2d-aea11ee5c6ae.jpeg and /dev/null differ diff --git a/imageEngine/my_images/ffa4cbeb-7827-4c96-998a-0c968324f42a.jpeg b/imageEngine/my_images/ffa4cbeb-7827-4c96-998a-0c968324f42a.jpeg deleted file mode 100644 index d7e13d1..0000000 Binary files a/imageEngine/my_images/ffa4cbeb-7827-4c96-998a-0c968324f42a.jpeg and /dev/null differ diff --git a/imageEngine/my_images/saber_alter.jpeg b/imageEngine/my_images/saber_alter.jpeg deleted file mode 100644 index 9c5d465..0000000 Binary files a/imageEngine/my_images/saber_alter.jpeg and /dev/null differ diff --git a/imageEngine/my_images/téléchargement.jpeg b/imageEngine/my_images/téléchargement.jpeg deleted file mode 100644 index c4375ae..0000000 Binary files a/imageEngine/my_images/téléchargement.jpeg and /dev/null differ diff --git a/imageEngine/my_images/wenay_anime.jpeg b/imageEngine/my_images/wenay_anime.jpeg deleted file mode 100644 index f9c0a20..0000000 Binary files a/imageEngine/my_images/wenay_anime.jpeg and /dev/null differ diff --git a/imageEngine/my_images/zero_two_2.jpeg b/imageEngine/my_images/zero_two_2.jpeg deleted file mode 100644 index 6eb2541..0000000 Binary files a/imageEngine/my_images/zero_two_2.jpeg and /dev/null differ diff --git a/imageEngine/my_images/ɪɴᴄᴏʀʀᴇᴄᴛ ǫᴜᴏᴛᴇs!.jpeg b/imageEngine/my_images/ɪɴᴄᴏʀʀᴇᴄᴛ ǫᴜᴏᴛᴇs!.jpeg deleted file mode 100644 index d940f16..0000000 Binary files a/imageEngine/my_images/ɪɴᴄᴏʀʀᴇᴄᴛ ǫᴜᴏᴛᴇs!.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Пауэр человек бензопила манга.jpeg b/imageEngine/my_images/Пауэр человек бензопила манга.jpeg deleted file mode 100644 index caf78fb..0000000 Binary files a/imageEngine/my_images/Пауэр человек бензопила манга.jpeg and /dev/null differ diff --git a/imageEngine/my_images/صور بنات انمي.jpeg b/imageEngine/my_images/صور بنات انمي.jpeg deleted file mode 100644 index e921410..0000000 Binary files a/imageEngine/my_images/صور بنات انمي.jpeg and /dev/null differ diff --git a/imageEngine/my_images/Ảnh Anime Đẹp ( 2 ) - Zero Two ( Darling in the FranXX ).jpeg b/imageEngine/my_images/Ảnh Anime Đẹp ( 2 ) - Zero Two ( Darling in the FranXX ).jpeg deleted file mode 100644 index 1dd06d0..0000000 Binary files a/imageEngine/my_images/Ảnh Anime Đẹp ( 2 ) - Zero Two ( Darling in the FranXX ).jpeg and /dev/null differ diff --git a/imageEngine/my_images/• Wallpaper Power • Chainsaw Man.jpeg b/imageEngine/my_images/• Wallpaper Power • Chainsaw Man.jpeg deleted file mode 100644 index 74412ff..0000000 Binary files a/imageEngine/my_images/• Wallpaper Power • Chainsaw Man.jpeg and /dev/null differ diff --git a/imageEngine/my_images/⇉𝑻𝑶𝑮𝑨 𝑯𝑰𝑴𝑰𝑲𝑶 ⇉𝑩𝒐𝒌𝒖 𝒏𝒐 𝑯𝒆𝒓𝒐 𝑨𝒄𝒂𝒅𝒆𝒎𝒊𝒂_ _ Dibujos de figuras geometricas, Foto en dibujo, Imagenes de togas.jpeg b/imageEngine/my_images/⇉𝑻𝑶𝑮𝑨 𝑯𝑰𝑴𝑰𝑲𝑶 ⇉𝑩𝒐𝒌𝒖 𝒏𝒐 𝑯𝒆𝒓𝒐 𝑨𝒄𝒂𝒅𝒆𝒎𝒊𝒂_ _ Dibujos de figuras geometricas, Foto en dibujo, Imagenes de togas.jpeg deleted file mode 100644 index 0aa8be5..0000000 Binary files a/imageEngine/my_images/⇉𝑻𝑶𝑮𝑨 𝑯𝑰𝑴𝑰𝑲𝑶 ⇉𝑩𝒐𝒌𝒖 𝒏𝒐 𝑯𝒆𝒓𝒐 𝑨𝒄𝒂𝒅𝒆𝒎𝒊𝒂_ _ Dibujos de figuras geometricas, Foto en dibujo, Imagenes de togas.jpeg and /dev/null differ diff --git a/imageEngine/my_images/ゆうり.png b/imageEngine/my_images/ゆうり.png deleted file mode 100644 index a1ca6f6..0000000 Binary files a/imageEngine/my_images/ゆうり.png and /dev/null differ diff --git a/imageEngine/my_images/𓏲 𝗠𝗮𝗿𝗶𝗻 𝗞𝗶𝘁𝗮𝗴𝗮𝘄𝗮 𖤐⋆ ࣪.jpeg b/imageEngine/my_images/𓏲 𝗠𝗮𝗿𝗶𝗻 𝗞𝗶𝘁𝗮𝗴𝗮𝘄𝗮 𖤐⋆ ࣪.jpeg deleted file mode 100644 index f5dc7ab..0000000 Binary files a/imageEngine/my_images/𓏲 𝗠𝗮𝗿𝗶𝗻 𝗞𝗶𝘁𝗮𝗴𝗮𝘄𝗮 𖤐⋆ ࣪.jpeg and /dev/null differ diff --git a/imageEngine/my_images/𝐏𝐨𝐰𝐞𝐫.jpeg b/imageEngine/my_images/𝐏𝐨𝐰𝐞𝐫.jpeg deleted file mode 100644 index cb59868..0000000 Binary files a/imageEngine/my_images/𝐏𝐨𝐰𝐞𝐫.jpeg and /dev/null differ diff --git a/imageEngine/my_images/𝐦𝐬 𝐌𝐚𝐤𝐢𝐦𝐚.jpeg b/imageEngine/my_images/𝐦𝐬 𝐌𝐚𝐤𝐢𝐦𝐚.jpeg deleted file mode 100644 index 39c1938..0000000 Binary files a/imageEngine/my_images/𝐦𝐬 𝐌𝐚𝐤𝐢𝐦𝐚.jpeg and /dev/null differ diff --git a/imageEngine/re_serie_7.py b/imageEngine/re_serie_7.py deleted file mode 100644 index 6f6f3e4..0000000 --- a/imageEngine/re_serie_7.py +++ /dev/null @@ -1,294 +0,0 @@ -import umage as um -from math import sqrt, atan2, sin, cos, pi - -def greyscale(mat_img): - gray_img = [] - for ligne in mat_img: - lig = [] - for r,g,b in ligne: - v = int(r*0.2125 + g*0.7154 + b*0.0721) - lig.append((v,)*3) - gray_img.append(lig) - return gray_img - -def convolution(mat_img, mat): - return_img = [] - for j in range(len(mat_img)): - ligne = [] - for i in range(len(mat_img[0])): - val = appliquer_convolution(mat_img, mat, i, j) - ligne.append((val,)*3) - return_img.append(ligne) - return return_img - -def filtre_sobel(img): - - def calcul_norme(pixel1, pixel2): - valeur = pixel1[0]**2 + pixel2[0]**2 - norm = round(sqrt(valeur)) - norm = int(min(norm, 255)) - return norm - - def application_norme(im_x, im_y): - result_image = [] - for j in range(len(im_x)): - ligne = [] - for i in range(len(im_x[0])): - pixel1 = im_x[j][i] - pixel2 = im_y[j][i] - norme = calcul_norme(pixel1, pixel2) - ligne.append((norme,)*3) - result_image.append(ligne) - return result_image - - if not is_greyscale(img): - img = greyscale(img) - - mat_x = [[-1,0,1],[-2,0,2],[-1,0,1]] - mat_y = [[-1,-2,-1],[0,0,0],[1,2,1]] - Gx = convolution(img, mat_x) - Gy = convolution(img, mat_y) - - filtred_image = application_norme(Gx,Gy) - return filtred_image - - - -######################################################################### -########################Exercices Supplémentaires######################## -######################################################################### - -def is_greyscale(img): - _greyscale = True - for ligne in img: - for r,g,b in ligne: - if not (r==g and g==b): - _greyscale = False - break - if not _greyscale: - break - return _greyscale - -def invert(img): - result_image = [] - for ligne in img: - result_ligne = [] - for r,g,b in ligne: - result_ligne.append((255-r, 255-g, 255-b)) - result_image.append(result_ligne) - return result_image - -def pixel(img, i, j, default=(0,0,0)): - #i la colone et j la ligne - if 0 <= i < len(img[0]) and 0 <= j < len(img): - return img[j][i] - else: - return default - -def appliquer_convolution(img, mat, i, j): - somme = 0 - for y in range(len(mat)): - for x in range(len(mat[0])): - pixel_i = i - (len(mat[0]) // 2) + x - pixel_j = j - (len(mat) // 2) + y - pix = pixel(img, pixel_i, pixel_j) - somme += pix[0]*mat[y][x] - return min(max(somme,0), 255) - - - -###################################################################### -########################Exercices personnelles######################## -###################################################################### -def convolution_gauss(mat_img): - mat_gauss = [ - [2/159, 4/159, 5/159, 4/159,2/159], - [4/159, 9/159,12/159, 9/159,4/159], - [5/159,12/159,15/159,12/159,5/159], - [4/159, 9/159,12/159, 9/159,4/159], - [2/159, 4/159, 5/159, 4/159,2/159] - ] - - return_img = [] - for j in range(len(mat_img)): - ligne = [] - for i in range(len(mat_img[0])): - val = reduction_bruit(mat_img, mat_gauss, i, j) - ligne.append((val,)*3) - return_img.append(ligne) - return return_img - -def reduction_bruit(img, mat, i, j): - somme = 0 - for y in range(len(mat)): - for x in range(len(mat[0])): - pixel_i = i - (len(mat[0]) // 2) + x - pixel_j = j - (len(mat) // 2) + y - pix = pixel(img, pixel_i, pixel_j) - somme += pix[0]*mat[y][x] - normalise = round(somme) - return normalise - -def filtre_canny(img): - - def norme_gradient(pixel1, pixel2): - color_x = pixel1[0] - color_y = pixel2[0] - - norm = round(sqrt(color_x**2 + color_y**2)) - norm = min(norm, 255) - - grad = atan2(color_y, color_x) - return norm, grad - - def liste_normGrad(im1, im2): - liste = [] - for j in range(len(im1)): - ligne = [] - for i in range(len(im1[0])): - normGrad = norme_gradient(im1[j][i], im2[j][i]) - ligne.append(normGrad) - liste.append(ligne) - return liste - - if not is_greyscale(img): - img = greyscale(img) - - mat_x = [[-1,0,1]] - mat_y = [[1],[0],[-1]] - - #lissage/suppression des bri - img_no_bruit = convolution_gauss(img) - Jx = convolution(img, mat_x) - Jy = convolution(img, mat_y) - normGrad = liste_normGrad(Jx, Jy) - - #Suppresion des non-maximum - - -#temp -def norme_gradient(pixel1, pixel2): - color_x = pixel1[0] - color_y = pixel2[0] - - norm = round(sqrt(color_x**2 + color_y**2)) - norm = min(norm, 255) - - grad = atan2(color_y, color_x) - return norm, grad - -#temp -def liste_normGrad(im1, im2): - liste = [] - for j in range(len(im1)): - ligne = [] - for i in range(len(im1[0])): - normGrad = norme_gradient(im1[j][i], im2[j][i]) - ligne.append(normGrad) - liste.append(ligne) - return liste - -mat_x = [[-1,0,1]] -mat_y = [[1],[0],[-1]] -#temp -#lissage -img = um.load("imageEngine\\images\\valve.png") -img = convolution_gauss(img) -Jx = convolution(img, mat_x) -Jy = convolution(img, mat_y) -normGrad = liste_normGrad(Jx, Jy) -########### - - - -def find_neighbord_norm(mat, i, j, rad): - x = 0 - y = 0 - if sin(pi/8) <= abs(sin(rad)): - y = 1 - if cos(3*pi/8)>abs(cos(rad)): - x = 1 - - norm_pix1 = -1 - norm_pix2 = -1 - if 0 <= j-y < len(mat): - if 0 <= i-x < len(mat[0]): - norm_pix1 = mat[j-y][i-x][0] - if 0 <= j+y < len(mat): - if 0 <= i+x < len(mat[0]): - norm_pix2 = mat[j+y][i+x][0] - - return norm_pix1, norm_pix2 - -def delete_pixel(mat_img, mat): - img_to_return = [] - for j in range(len(mat)): - ligne = [] - for i in range(len(mat[0])): - rad = mat[j][i][1] - norms = find_neighbord_norm(mat, i, j, rad) - if rad < norms[0] or rad < norms[1]: - ligne.append((0,)*3) - else: - ligne.append(mat_img[j][i]) - img_to_return.append(ligne) - return img_to_return - - -""" -def hysteresis(mat_img, mat_norm, Th): - Tl = Th / 2 - mat_img = yesOrNo(mat_img, Th, Tl) - result_image = [] - for j in range(len(mat_img)): - ligne = [] - for i in range(len(mat_img[0])): - rad = mat_norm[j][i][1] - color1, color2 = find_neighbord_pixel(mat_img, i, j, rad+(pi/2)) - if color1 == 255 or color2 == 255: - ligne.append((255,)*3) - else: - ligne.append((0,)*3) - result_image.append(ligne) - return result_image - -def find_neighbord_pixel(mat_image, i, j, rad): - x = 0 - y = 0 - if sin(pi/8) <= abs(sin(rad)): - y = 1 - if cos(3*pi/8)>abs(cos(rad)): - x = 1 - - color_pix1 = 0 - color_pix2 = 0 - if 0 <= j-y < len(mat_image): - if 0 <= i-x < len(mat_image[0]): - color_pix1 = mat_image[j-y][i-x][0] - if 0 <= j+y < len(mat_image): - if 0 <= i+x < len(mat_image[0]): - color_pix2 = mat_image[j+y][i+x][0] - - return color_pix1, color_pix2 - -def yesOrNo(mat_img, Th, Tl): - result_image = [] - for j in range(len(mat_img)): - ligne = [] - for i in range(len(mat_img[0])): - pix = mat_img[j][i] - if Th <= pix[0]: - ligne.append((255,)*3) - elif pix[0] < Tl: - ligne.append((0,)*3) - else: - ligne.append(pix) - result_image.append(ligne) - return result_image - - -zt_no_maxima = delete_pixel(img, normGrad) -zt_hysteresis = hysteresis(zt_no_maxima, normGrad, 200) - -um.save(zt_hysteresis, "imageEngine\\test\\valve", "png") -""" \ No newline at end of file diff --git a/imageEngine/sobel/image_test.png b/imageEngine/sobel/image_test.png deleted file mode 100644 index b16cde2..0000000 Binary files a/imageEngine/sobel/image_test.png and /dev/null differ diff --git a/imageEngine/test/valve.png b/imageEngine/test/valve.png deleted file mode 100644 index f422ef2..0000000 Binary files a/imageEngine/test/valve.png and /dev/null differ diff --git a/imageEngine/test/zt_bruit.png b/imageEngine/test/zt_bruit.png deleted file mode 100644 index 64345df..0000000 Binary files a/imageEngine/test/zt_bruit.png and /dev/null differ diff --git a/imageEngine/test/zt_hysteresis.png b/imageEngine/test/zt_hysteresis.png deleted file mode 100644 index be4cd7c..0000000 Binary files a/imageEngine/test/zt_hysteresis.png and /dev/null differ diff --git a/imageEngine/test/zt_no_bruit.png b/imageEngine/test/zt_no_bruit.png deleted file mode 100644 index 7073128..0000000 Binary files a/imageEngine/test/zt_no_bruit.png and /dev/null differ diff --git a/imageEngine/test/zt_no_maxima.png b/imageEngine/test/zt_no_maxima.png deleted file mode 100644 index 2c63275..0000000 Binary files a/imageEngine/test/zt_no_maxima.png and /dev/null differ diff --git a/new2.jpg b/new2.jpg deleted file mode 100644 index 18f6d22..0000000 Binary files a/new2.jpg and /dev/null differ