├── .gitignore ├── 01_Resim_Acma_Okuma_Yazma.py ├── 02_BGR_Mantigi_3ve2_Boyut_Farklari.py ├── 03_BGR_Pixel_Dizi_Kesit_Islemleri_Alistirma.py ├── 04_Uzatma_Aynalama_Tekrarlama_Sarma.py ├── 05_Resim_Toplama_ve_Agirlikli_Toplama.py ├── 06_Maskeleme_Aritmetik_İslemler.py ├── 07_Goruntu_Piramitleri.py ├── 08_Cizim_Line_Circle_Text.py ├── 09_Anlik_Video_Isleme_Kaydetme.py ├── 10_Boyutlandirma_ve_Renk_Uzayi.py ├── 11_HSV_Kodu_Bulma.py ├── 13_Morfolojik_Islemler.py ├── 14_Arkaplan_Filtreleme.py ├── 15_Kenar_Tespit_Laplacian_Sobel_Canny.py ├── 16_1_Hough_Transforms.py ├── 16_2_Hough_Serit_Takip.py ├── 17_Nesne_Izi_Surme.py ├── 18_Yuz_Ozellikleri.py ├── 19_El_Ozellikleri.py ├── 20_Goz_Takip.py ├── 21_Resimden_Yuz_Algilama.py ├── 22_RealTime_Yuz_Algilama.py ├── 23_Resimden_Goz_Algilama.py ├── 24_RealTime_Goz_Algilama.py ├── 25_Resimden_Insan_Govde_Algilama.py ├── 26_Videodan_Insan_Vucut_Algilama.py ├── 27_Resimden_Gulumseme_Algilama.py ├── 28_RealTime_Gulumseme_Algilama.py ├── 29_Resimden_Araba_Algilama.py ├── 30_Videodan_Araba_Algilama.py ├── 31_Plaka_Okuma.py ├── 32_Arac_Sayma.py ├── 33_RealTime_El_Hareketleri_Tanıma.py ├── 34_RealTime_Resim_Cizme.py ├── 35_Arac_Hizi_Hesaplama.py ├── Ek_Uygulamalar ├── 01_ek_Trackbar_App_Renk_Ayarlama.py ├── 02_ek_Video_Boyutlandırma_Aspect_Ratio.py ├── 03_ek_Resim_Yumuşatma.py ├── 04_ek_Bitwise_Ornek.py ├── 05_ek_Threshold.py ├── 06_ek_Histogram.py ├── 07_ek_Kose_Algilama.py ├── 08_ek_Kenar_Algilama.py ├── 09_ek_Kontur_Merkez_Alan_Cevre.py ├── 10_ek_Daire_Tespit.py ├── 11_ek_Cokgen_Algilama_Real_Time.py ├── 12_ek_Mouse_Events.py ├── 13_ek_Resim_Karsilastirma.py ├── 14_ek_Cozunurluk_Ayarlama.py ├── 15_ek_Blurlu_Goruntu_Algilama.py ├── 16_ek_Sablon_Kesit_Arama.py ├── 17_ek_Resimden_Metin_Okuma.py ├── 18_ek_RealTime_Resim_Cizme.py ├── ReadMe.md └── media │ ├── batman.jpg │ ├── bilateral_noise.jpg │ ├── bitwise1.png │ ├── bitwise2.png │ ├── kose_algila.jpg │ ├── line.mp4 │ ├── median_noise.png │ ├── test.jpg │ ├── test1.jpg │ ├── threshold.jpg │ ├── toplar.jpeg │ └── ucgen.png ├── LICENSE ├── README.md ├── haarcascade ├── car.xml ├── car1.xml ├── frontalface.xml ├── haarcascade_eye.xml ├── haarcascade_eye_tree_eyeglasses.xml ├── haarcascade_frontalcatface.xml ├── haarcascade_frontalcatface_extended.xml ├── haarcascade_frontalface_alt.xml ├── haarcascade_frontalface_alt2.xml ├── haarcascade_frontalface_alt_tree.xml ├── haarcascade_frontalface_default.txt ├── haarcascade_frontalface_default.xml ├── haarcascade_fullbody.xml ├── haarcascade_lefteye_2splits.xml ├── haarcascade_lowerbody.xml ├── haarcascade_profileface.xml ├── haarcascade_righteye_2splits.xml ├── haarcascade_smile.xml └── haarcascade_upperbody.xml └── media ├── 05_600x400.jpg ├── 05_600x400_2.jpg ├── 06_batman.jpg ├── 06_zongi.jpg ├── body.jpg ├── body.mp4 ├── car.jpg ├── car1.jpeg ├── cars.mp4 ├── closing.png ├── dog.mp4 ├── face.jpg ├── gozler.mp4 ├── h_line.png ├── klavye.jpg ├── license_plate.jpg ├── line.mp4 ├── morph.png ├── opening.png └── smile.jpeg /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /01_Resim_Acma_Okuma_Yazma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | #img2 = cv2.imread("750x750_siyah.jpg") 9 | img = cv2.imread("750x750.jpg",0) 10 | """ resmi img degiskenine atadik. '0' parametresi direkt olarak siyah-beyaza gecis yapar 11 | print(type(img)) #->numpy.ndarray """ 12 | 13 | cv2.imwrite("......./Desktop/750x750_siyah.jpg", img) 14 | #img degiskeni siyah-beyaz olarak masaustune kaydedildi 15 | 16 | cv2.imshow("Deneme Resmi", img) #resim ekranda gosterildi 17 | 18 | #cv2.imshow("Deneme Resmi", img) #resim ekranda gosterildi 19 | 20 | cv2.waitKey(0) 21 | cv2.destroyAllWindows() 22 | -------------------------------------------------------------------------------- /02_BGR_Mantigi_3ve2_Boyut_Farklari.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | """ 7 | RGB (Red,Green,Blue) olarak bildigimiz renk kanalları 8 | OpenCV mantiginda BGR (Blue,Green,Red) olarak calismaktadir. 9 | (0-255, 0-255, 0-255) arasi degerler alirlar, yani sadece 10 | sayidan ibaretler. Bilgisayar ise bu sayilari anlamlandirarak 11 | bize renk karsiliklarini sunmaktadir. 12 | 13 | """ 14 | 15 | import cv2 16 | 17 | img = cv2.imread("750x750.jpg") 18 | 19 | print("img.type : ",type(img)) #numpy.ndarray -> n dimensional(boyutlu) array 20 | 21 | print("img.dtype : ",img.dtype) #resmin data tipi -> uint8 -> 8 bitten olusuyor. bu yuzden max 255 degerini alabiliyor. 22 | 23 | print("img.shape : ",img.shape) #(yukseklik,genislik,renk kanali sayisi) seklinde cikti verir. 24 | 25 | print("img.size : ",img.size) #(yukseklik * genislik * renk kanali) -> resmin kac pikselden olustugunu yazdirir. 26 | 27 | #print("img matrisi : ",img) #komutuyla; resmimizin BGR(0-255) karsiliklarini matris seklinde gormekteyiz. 28 | 29 | """ 30 | deneme olarak programa aldiginiz resmin; yukaridaki print komutlariyla beraber 31 | ne kadar buyuk boyutlara sahip oldugunu goreceksiniz. ve tahmin edersiniz ki 32 | o boyutlarda calismak oldukca zorlu olacak. bu yuzden goruntu isleme uygulamalarina 33 | resimlerin boyutlarini dusurerek baslayacagiz. bunun icin en basit yontem : 34 | resmi siyah-beyaz olarak almaktir. resmi bir kez daha (siyah-beyaz) okuyarak 35 | boyut degerlerinin karsilastirmasini yapacagiz. PRINT CIKTILARINI (size,shape,img matris) 36 | KONTROL EDINIZ. 37 | """ 38 | 39 | img2 = cv2.imread("deneme.jpg",0) 40 | 41 | print("img.type (siyah-beyaz) : ",type(img2)) 42 | 43 | print("img.dtype (siyah-beyaz) : ",img2.dtype) 44 | 45 | print("img.shape (siyah-beyaz) : ",img2.shape) 46 | 47 | print("img.size (siyah-beyaz) : ",img2.size) 48 | 49 | print("50,50 pikseldeki renk degeri : ",img.item(50,50)) #rengin 0-255 arasindaki degerini verir 50 | 51 | #print("img matrisi (siyah-beyaz) : ",img2) 52 | 53 | 54 | 55 | cv2.waitKey(0) 56 | cv2.destroyAllWindows() 57 | -------------------------------------------------------------------------------- /03_BGR_Pixel_Dizi_Kesit_Islemleri_Alistirma.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """@author: omerkocadayi""" 3 | 4 | #cv2.imshow pencere ciktilarini ayri ayri inceleyiniz. 5 | 6 | import cv2 7 | def pencere_kapat(): 8 | cv2.waitKey(0) 9 | cv2.destroyAllWindows() 10 | 11 | img = cv2.imread("750x750.jpg") 12 | 13 | blue, green, red = cv2.split(img) #split metodu resmi bgr 3 renk kanalina ayirmaktadir. 14 | #tek kanalda islem yapmamız gerektiginde bu metodu uygulayabiliriz. 15 | 16 | #kanallari ayrilmis resmi nasil tek parcaya toplariz ? 17 | yeni_img = cv2.merge((blue,green,red)) #cv2.merge metodu ile kanallari siralayarak islemi gerceklestirebiliriz. 18 | 19 | cv2.imshow("Orijinal Resim",img) 20 | pencere_kapat() 21 | cv2.imshow("Resim BLue Kanali",blue) 22 | pencere_kapat() 23 | cv2.imshow("Resim Green Kanali",green) 24 | pencere_kapat() 25 | cv2.imshow("Resim Red Kanali",red) 26 | pencere_kapat() 27 | cv2.imshow("Ayri Kanallari Birlestirme (Merge)",yeni_img) 28 | pencere_kapat() 29 | 30 | 31 | #_____________________________________________________________________________ 32 | 33 | yeni_img[240:450,320:650,0] = 255 # virgulden sonraki 0 parametresi blue, 1 parametresi green, 2 parametresi red'i temsil eder 34 | """ y1=240, y2=320 35 | x1=450, x2=650 araligindaki bolgenin mavi kanalini maksimum degere yukselttik """ 36 | cv2.imshow("Blue Kanala 255 Atama",yeni_img) 37 | pencere_kapat() 38 | 39 | 40 | #_____________________________________________________________________________ 41 | 42 | for i in range(100): 43 | img[i,i] = [255,255,255] 44 | """cv2 kutuphanesi resimleri np.ndarray formatinda almaktadir. 45 | diziler uzerinde yaptigimiz islemleri resimler uzerinde de gerceklestirebilmekteyiz. 46 | bu dongu ile resmin 0;0 pikselinden itibaren capraz olarak 100 piksellik 47 | beyaz bir cizgi cekmis olacagiz.""" 48 | cv2.imshow("Cizgi Deneme",img) 49 | pencere_kapat() 50 | 51 | 52 | #_____________________________________________________________________________ 53 | 54 | kesit = img[150:250,300:500] 55 | """ resmin y1 = 150, y2 = 300 ; x1 = 250, x2 = 500 araligindaki bolgesini 56 | kesit degiskenine atamis olduk. resmin sadece belli bolgesinde islem yapmak 57 | istiyorsak bu benzeri yontemleri kullancagiz.""" 58 | 59 | cv2.imshow("Kesit Deneme",kesit) 60 | pencere_kapat() 61 | 62 | 63 | #_____________________________________________________________________________ 64 | 65 | for i in range(200): 66 | img[100,i] = [255,255,255] 67 | if i < 100: 68 | img[i,200] = [255,255,255] 69 | 70 | img[0:100,0:200] = kesit 71 | """ resmin y1 = 0, y2 = 0; x1 = 100, x2 = 200 araligindaki bolgesine 72 | kesit degiskeninde tutulan bolgeyi kopyala-yapistir yapmis olduk 73 | ve 2. for dongusuyle bu kesitin etrafina beyaz cizgi cektik""" 74 | 75 | cv2.imshow("Kesit Yapistirma + Cerceve Deneme",img) 76 | pencere_kapat() 77 | -------------------------------------------------------------------------------- /04_Uzatma_Aynalama_Tekrarlama_Sarma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | """ resim uzatma 7 | resim aynalama 8 | resmi tekrar etme 9 | resmin etrafini sarma 10 | alan secme 11 | islemleri gerceklestirilecektir. 12 | """ 13 | 14 | import cv2 15 | def pencere_kapat(): 16 | cv2.waitKey(0) 17 | cv2.destroyAllWindows() 18 | 19 | img = cv2.imread("750x750.jpg") 20 | 21 | img_uzatma = cv2.copyMakeBorder(img,100,100,100,100, cv2.BORDER_REPLICATE) 22 | 23 | img_aynalama = cv2.copyMakeBorder(img,250,250,250,250, cv2.BORDER_REFLECT) 24 | 25 | img_tekrar = cv2.copyMakeBorder(img,150,150,150,150, cv2.BORDER_WRAP) 26 | 27 | img_sarma = cv2.copyMakeBorder(img,25,25,25,25, cv2.BORDER_CONSTANT, value = [0,150,0]) 28 | 29 | 30 | #alan secme 31 | cv2.rectangle(img, (50,120), (140,60), [0,0,200], 2) 32 | #cv2.rectangle(img, 1.nokta, 2.nokta, renk, kalınlık, cizgi tipi) 33 | 34 | cv2.imshow("Orijinal",img) 35 | pencere_kapat() 36 | cv2.imshow("Uzatma",img_uzatma) 37 | pencere_kapat() 38 | cv2.imshow("Aynalama",img_aynalama) 39 | pencere_kapat() 40 | cv2.imshow("Tekrar",img_tekrar) 41 | pencere_kapat() 42 | cv2.imshow("Sarma",img_sarma) 43 | pencere_kapat() 44 | -------------------------------------------------------------------------------- /05_Resim_Toplama_ve_Agirlikli_Toplama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | """resimlerin saglikli olarak toplanabilmesi icin boyutlarinin denk olmasi gerekmektedir.""" 7 | 8 | import cv2 9 | 10 | img = cv2.imread("05_600x400.jpg") 11 | img2 = cv2.imread("05_600x400_2.jpg") 12 | 13 | print("[175,250] pikselleri icin\n\n" 14 | "img\t: ",img[175,250],"\nimg2\t: ",img2[175,250], 15 | "\n\nduz toplama (mod)\t= ",img[250,250]+img2[250,250]) 16 | 17 | """ kodu benim kullanmis oldugum gorseller ile calistirirsaniz; 18 | print ciktilari incelendiginde doygunluk kaybimiz oldugunu goreceksiniz. 19 | blue ve green kanallari toplaminda iki renk de max noktasi olan 255 degerini 20 | geciyor. yani en doygun noktayi.. fakat buraya 255 degerini degil, toplamin 21 | 255e modunu yaziyor. bu doygunluk kaybini yasamamak icin cv2.add 22 | metodunu kullanacagiz. toplam degeri 255in uzerine cikan bolumlerde 23 | tam doygun noktayi, yani 255'i yazacagiz. 24 | 25 | print ciktilarini dogru inceleyebilmeniz icin 05_600x400 ve 05_600x400_2 26 | isimli gorselleri indirerek calismalariniza devam etmenizi oneririm.""" 27 | 28 | toplam = cv2.add(img,img2) 29 | print("cv2.add sonucu\t\t: ",toplam[175,255]) 30 | 31 | agirlikli_toplam = cv2.addWeighted(img,0.225,img2,0.775,0) 32 | print("cv2.Addweihgt sonucu\t: ",agirlikli_toplam[175,250]) 33 | #addWeighted metoduna girilen agirlik parametreleri toplami 1 olmak zorundadir. 34 | 35 | cv2.imshow("600x400 - IMG 1",img) 36 | cv2.imshow("600x400_2 - IMG 2",img2) 37 | cv2.imshow("TOPLAM",toplam) 38 | cv2.imshow("AGIRLIKLI TOPLAM",agirlikli_toplam) 39 | cv2.waitKey(0) 40 | cv2.destroyAllWindows() 41 | -------------------------------------------------------------------------------- /06_Maskeleme_Aritmetik_İslemler.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | """ Kodu; paylasmis oldugum 06_zongi.jpg ve 06_batman.jpg ile birlikte calistirin. 7 | Maskeleme isleminin anlasilmasi acisindan sizin adiniza iyi olacaktir. 8 | pencere ciktilarini adim adim incelemek istiyorsaniz yorum satırlarını aktif 9 | hale getirebilirsiniz.""" 10 | import cv2 11 | 12 | def pencere_kapat(): 13 | cv2.waitKey(0) 14 | cv2.destroyAllWindows() 15 | 16 | def main(): 17 | img = cv2.imread("06_zongi.jpg") 18 | img2 = cv2.imread("06_batman.jpg") 19 | bat_gri = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY) 20 | 21 | cv2.imshow("Zongi",img) 22 | cv2.imshow("Batman",img2) 23 | #cv2.imshow("Batman_Gri",bat_gri) 24 | pencere_kapat() 25 | 26 | img_h, img_w, img_ch = img2.shape #yukseklik-h , genislik-w, renk kanali-ch 27 | roi = img[0:img_h , 0:img_w] 28 | 29 | ret, mask = cv2.threshold(bat_gri, 20, 255, cv2.THRESH_BINARY) 30 | #mask degiskenine ndarray formatinda maskelenmis resim atanir. 31 | ters_mask = cv2.bitwise_not(mask) 32 | 33 | sonuc = cv2.add(cv2.bitwise_and(roi,roi, mask = ters_mask), img2) 34 | img[0:img_h, 0:img_w] = sonuc 35 | 36 | #cv2.imshow("Maske",mask) 37 | #cv2.imshow("Ters Maske",ters_mask) 38 | cv2.imshow("Zongi-Batman-Final",img) 39 | pencere_kapat() 40 | 41 | if __name__ == "__main__": 42 | main() 43 | -------------------------------------------------------------------------------- /07_Goruntu_Piramitleri.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | """ goruntu alirken nesnelerin uzaklik-yakinliklarina gore 7 | o anki kapladigi alan, piksel degerleri degisebilmektedir. 8 | daha rahat islem yapabilmek adina resimleri buyutmek,kucultmek, 9 | piramit yapisi kullanmak bize fayda saglayacaktir.""" 10 | 11 | import cv2 12 | import numpy as np 13 | 14 | img = cv2.imread("06_zongi.jpg") 15 | 16 | buyuk_img = cv2.pyrUp(img) #resmi 2 kat buyuttuk 17 | kucuk_img = cv2.pyrDown(img) #resmi 2 kat kuculttuk 18 | 19 | print("Orijinal boyut\t: ",img.shape, 20 | "\nbuyutulmus\t: ",buyuk_img.shape, 21 | "\nkucultulmus\t: ",kucuk_img.shape) 22 | 23 | resim = np.zeros((500,500,3), dtype="uint8") 24 | #500x500 piksel ve 3 renk kanalina sahip siyah bir resim elde ettik 25 | cv2.rectangle(resim, (150,350), (350,150), (150,50,50), 2) 26 | 27 | cv2.imshow("np.zeros",resim) 28 | 29 | cv2.waitKey(0) 30 | cv2.destroyAllWindows() 31 | -------------------------------------------------------------------------------- /08_Cizim_Line_Circle_Text.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | def main(): 10 | img = np.zeros((500,500,3), dtype = "uint8") 11 | img.fill(255) #tum matrisi tek bir degerle doldurur. 0-255 arasi 12 | 13 | cv2.line(img, (50,100),(250,250),(150,120,255), 3) 14 | #baslangic : 50:100, bitis : 250:250 araliginda bir cizgi cektik 15 | 16 | cv2.circle(img, (400,100), 50, (30,200,30), 2) 17 | #merkez : 400:100 , yaricap : 50 degerlerinde cember cizimi 18 | 19 | cv2.rectangle(img, (10,10), (50,50), (0,255,0), thickness=-1) 20 | cv2.rectangle(img, (400,350), (480,480), (0,255,0), thickness=-1) 21 | #dikdörtgen cizimleri 22 | 23 | pts = np.array([[[100, 200], [300, 250], [230, 420], [400,100]]], np.int32) 24 | cv2.polylines(img, [pts], True, (0,50,0), 2) 25 | #cokgen cizimleri 26 | 27 | cv2.putText(img, "OmerKocadayi_GoruntuIsleme", (75,400), cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, (255,50,50), 1) 28 | #baslangic : 75:400, yazi_tipi:HERSHEY_COMPLEX_SMALL, boyut:1, renk (255,50,50), kalinlik 1 29 | 30 | cv2.imshow("Image",img) 31 | cv2.waitKey(0) 32 | cv2.destroyAllWindows() 33 | 34 | if __name__ == "__main__": 35 | main() 36 | -------------------------------------------------------------------------------- /09_Anlik_Video_Isleme_Kaydetme.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Oct 2 00:32:35 2020 4 | 5 | @author: omerkocadayi 6 | """ 7 | import cv2 8 | 9 | cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) #dahili webcam için 0, farklı cam için 1, var olan video için dosya yolu 10 | outName = "LiveTest.mp4" #q tuşuna basılana kadar alınan görüntü LiveTest.mp4 adında kaydedilecek 11 | codec = cv2.VideoWriter_fourcc('M', 'P', '4', '2') #farklı formatlarda kayıt için codec arayabilirsiniz. 12 | frameRate = 10 #saniyede 10 kare kayıt 13 | resolution = (640, 480) 14 | videoOutput = cv2.VideoWriter(outName, codec, frameRate, resolution) 15 | 16 | while True: 17 | ret, frame = cap.read() 18 | #var olan bir video işlenecekse 'if ret==0: break' eklanmeli. sonsuz döngüden kaçınmak için. 19 | 20 | frame = cv2.flip(frame, 1) #videoyu y eksenli aynalamak için.. x ekseni için -1.. 21 | videoOutput.write(frame) 22 | cv2.imshow("Live Cam", frame) 23 | 24 | if cv2.waitKey(1) & 0xFF == ord("q"): # her frame'i 1 ms göster, q ile çık.. 25 | #cam fps değerine göre ideal bir değer ayarlanmalı. 26 | break 27 | 28 | videoOutput.release() 29 | cap.release() 30 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /10_Boyutlandirma_ve_Renk_Uzayi.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Oct 2 14:51:53 2020 4 | 5 | @author: omerkocadayi 6 | """ 7 | 8 | import cv2 9 | 10 | cap = cv2.VideoCapture(0) 11 | 12 | while True: 13 | ret, frame = cap.read() 14 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 15 | frame = cv2.flip(frame, 1) 16 | 17 | if ret == False: 18 | break 19 | 20 | if cv2.waitKey(1) & 0xFF == ord("q"): 21 | break 22 | 23 | cv2.imshow("Test RGB to GRAY", frame) 24 | 25 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /11_HSV_Kodu_Bulma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | cap = cv2.VideoCapture(0) 10 | 11 | def empty(x): 12 | pass 13 | 14 | cv2.namedWindow("Trackbar") 15 | cv2.resizeWindow("Trackbar", 500, 500) 16 | 17 | cv2.createTrackbar("Lower H", "Trackbar", 0, 180, empty) 18 | cv2.createTrackbar("Lower S", "Trackbar", 0, 255, empty) 19 | cv2.createTrackbar("Lower V", "Trackbar", 0, 255, empty) 20 | 21 | 22 | cv2.createTrackbar("Upper H", "Trackbar", 0, 180, empty) 23 | cv2.createTrackbar("Upper S", "Trackbar", 0, 255, empty) 24 | cv2.createTrackbar("Upper V", "Trackbar", 0, 255, empty) 25 | 26 | cv2.setTrackbarPos("Upper H", "Trackbar", 180) 27 | cv2.setTrackbarPos("Upper S", "Trackbar", 255) 28 | cv2.setTrackbarPos("Upper V", "Trackbar", 255) 29 | 30 | while True: 31 | ret, frame = cap.read() 32 | frame = cv2.flip(frame, 1) 33 | frame_hsv = cv2.cvtColor(frame, cv2.COLOR_RGB2HSV) 34 | 35 | lower_h = cv2.getTrackbarPos("Lower H", "Trackbar") 36 | lower_s = cv2.getTrackbarPos("Lower S", "Trackbar") 37 | lower_v = cv2.getTrackbarPos("Lower V", "Trackbar") 38 | 39 | upper_h = cv2.getTrackbarPos("Upper H", "Trackbar") 40 | upper_s = cv2.getTrackbarPos("Upper S", "Trackbar") 41 | upper_v = cv2.getTrackbarPos("Upper V", "Trackbar") 42 | 43 | lower_color = np.array([lower_h, lower_s, lower_v]) 44 | upper_color = np.array([upper_h, upper_s, upper_v]) 45 | 46 | mask = cv2.inRange(frame_hsv, lower_color, upper_color) 47 | 48 | cv2.imshow("Original", frame) 49 | cv2.imshow("With Mask", mask) 50 | 51 | if cv2.waitKey(10) & 0xFF == ord("q"): 52 | break 53 | 54 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /13_Morfolojik_Islemler.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img = cv2.imread("morph.png",0) 10 | img1 = cv2.imread("opening.png",0) 11 | img2 = cv2.imread("closing.png",0) 12 | 13 | kernel = np.ones((5,5), np.uint8) 14 | 15 | erosion = cv2.erode(img, kernel, iterations = 1) 16 | dilation = cv2.dilate(img, kernel, iterations = 1) 17 | cv2.imshow("Original", img) 18 | #cv2.imshow("Erosion", erosion) 19 | #cv2.imshow("Dilation", dilation) 20 | 21 | opening = cv2.morphologyEx(img1, cv2.MORPH_OPEN, kernel) 22 | #cv2.imshow("Original for Open", img1) 23 | #cv2.imshow("Opening", opening) 24 | 25 | closing = cv2.morphologyEx(img2, cv2.MORPH_CLOSE, kernel) 26 | #cv2.imshow("Original for Close", img2) 27 | #cv2.imshow("Closing", closing) 28 | 29 | gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel) 30 | #cv2.imshow("Gradient", gradient) 31 | 32 | top_hat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel) 33 | #♠cv2.imshow("Top Hat", top_hat) 34 | 35 | black_hat = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel) 36 | #cv2.imshow("Black Hat", black_hat) 37 | 38 | cv2.waitKey(0) 39 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /14_Arkaplan_Filtreleme.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | cap = cv2.VideoCapture("cars.mp4") 10 | cap2 = cv2.VideoCapture("cars.mp4") 11 | 12 | ret, firstFrame = cap.read() 13 | firstFrame = cv2.resize(firstFrame, (640,480)) 14 | firstGray = cv2.cvtColor(firstFrame, cv2.COLOR_BGR2GRAY) 15 | firstGray = cv2.GaussianBlur(firstGray, (3,3), 0) 16 | 17 | subtractor = cv2.createBackgroundSubtractorMOG2(history = 100, varThreshold = 75, detectShadows = True) 18 | 19 | 20 | while True: 21 | ret, frame = cap.read() 22 | ret, frame1 = cap2.read() 23 | 24 | frame = cv2.resize(frame, (640,480)) 25 | frame1 = cv2.resize(frame1, (640,480)) 26 | 27 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 28 | gray = cv2.GaussianBlur(gray, (3,3), 0) 29 | 30 | diff = cv2.absdiff(firstGray, gray) 31 | ret, diff = cv2.threshold(diff, 40, 355, cv2.THRESH_BINARY) 32 | 33 | mask = subtractor.apply(frame) 34 | 35 | cv2.imshow("Frame", frame) 36 | cv2.imshow("Opencv Function Result", mask) 37 | cv2.imshow("Manuel Result", diff) 38 | 39 | if cv2.waitKey(15) & 0xFF == ord('q'): 40 | break 41 | 42 | cap.release() 43 | cv2.destroyAllWindows() 44 | -------------------------------------------------------------------------------- /15_Kenar_Tespit_Laplacian_Sobel_Canny.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture(0) 9 | img = cv2.imread("06_batman.jpg",0) 10 | 11 | while True: 12 | ret, frame = cap.read() 13 | frame = cv2.flip(frame,1) 14 | 15 | canny = cv2.Canny(frame, 80,180) 16 | laplacian = cv2.Laplacian(frame,cv2.CV_64F) 17 | sobelx = cv2.Sobel(frame,cv2.CV_64F,1,0,ksize=5) 18 | sobely = cv2.Sobel(frame,cv2.CV_64F,0,1,ksize=5) 19 | 20 | cv2.imshow("Frame", frame) 21 | cv2.imshow("Canny", canny) 22 | cv2.imshow("Laplacian", laplacian) 23 | cv2.imshow("Sobel X", sobelx) 24 | cv2.imshow("Sobel Y", sobely) 25 | 26 | 27 | if cv2.waitKey(1) & 0xFF == ord('q'): 28 | break 29 | """ 30 | #Fotograf uzerinden yapilan ornekler 31 | 32 | canny1 = cv2.Canny(img, 80,180) 33 | laplacian1 = cv2.Laplacian(img,cv2.CV_64F) 34 | sobelx1 = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5) 35 | sobely1 = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5) 36 | 37 | cv2.imshow("Original", img) 38 | cv2.imshow("Canny", canny1) 39 | cv2.imshow("Laplacian", laplacian1) 40 | cv2.imshow("Sobel X", sobelx1) 41 | cv2.imshow("Sobel Y", sobely1) 42 | cv2.waitKey(0) 43 | """ 44 | 45 | cap.release() 46 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /16_1_Hough_Transforms.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img = cv2.imread("klavye.jpg") 10 | img2 = cv2.imread("h_line.png") 11 | 12 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 13 | gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY) 14 | 15 | edges = cv2.Canny(gray, 50, 200) 16 | edges2 = cv2.Canny(gray2, 75, 150) 17 | 18 | lines = cv2.HoughLinesP(edges, 1, np.pi/180, 150, maxLineGap = 75) 19 | lines2 = cv2.HoughLinesP(edges2, 1, np.pi/180, 50, maxLineGap = 125) 20 | 21 | for line in lines: 22 | x1, y1, x2, y2 = line[0] 23 | cv2.line(img, (x1,y1), (x2,y2), (180,0,180), 1) 24 | 25 | for line in lines2: 26 | x1, y1, x2, y2 = line[0] 27 | cv2.line(img2, (x1,y1), (x2,y2), (180,0,180), 2) 28 | 29 | 30 | cv2.imshow("Original Image 1", img) 31 | cv2.imshow("Edges of Image1", edges) 32 | 33 | cv2.imshow("Original Image 2", img2) 34 | cv2.imshow("Edges of Image2", edges2) 35 | 36 | cv2.waitKey(0) 37 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /16_2_Hough_Serit_Takip.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | cap = cv2.VideoCapture("line.mp4") 10 | 11 | while True: 12 | ret,frame=cap.read() 13 | frame = cv2.resize(frame,(640,480)) 14 | hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) 15 | 16 | lower_yellow = np.array([18,94,140],np.uint8) 17 | upper_yellow = np.array([48,255,255],np.uint8) 18 | 19 | mask = cv2.inRange(hsv,lower_yellow,upper_yellow) 20 | edges = cv2.Canny(mask,75,250) 21 | 22 | lines = cv2.HoughLinesP(edges,1,np.pi/180,50,maxLineGap=50) 23 | 24 | for line in lines: 25 | x1, y1, x2, y2 = line[0] 26 | cv2.line(frame,(x1,y1),(x2,y2),(200,0,200),5) 27 | 28 | cv2.imshow("Hough Line",frame) 29 | 30 | if cv2.waitKey(20) & 0xFF==ord('q'): 31 | break 32 | 33 | cap.release() 34 | cv2.destroyAllWindows() 35 | -------------------------------------------------------------------------------- /17_Nesne_Izi_Surme.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | cap = cv2.VideoCapture("dog.mp4") 10 | 11 | while True: 12 | ret, frame = cap.read() 13 | 14 | hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) 15 | lower_red = np.array([0, 0, 240]) 16 | upper_red = np.array([255, 15, 255]) 17 | 18 | mask = cv2.inRange(hsv, lower_red, upper_red) 19 | res = cv2.bitwise_and(frame, frame, mask = mask) 20 | 21 | cv2.imshow("Frame", frame) 22 | cv2.imshow("Mask", mask) 23 | cv2.imshow("Result", res) 24 | 25 | 26 | if cv2.waitKey(2) & 0xFF == ord("q"): 27 | break 28 | 29 | cv2.destroyAllWindows() 30 | -------------------------------------------------------------------------------- /18_Yuz_Ozellikleri.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | import math 9 | 10 | def findMaxContour(contours): 11 | max_i = 0 12 | max_area =0 13 | for i in range(len(contours)): 14 | area_face = cv2.contourArea(contours[i]) 15 | 16 | if max_area 0: 47 | 48 | c = findMaxContour(contours) 49 | 50 | extLeft = tuple(c[c[:, :, 0].argmin()][0]) 51 | extRight = tuple(c[c[:, :, 0].argmax()][0]) 52 | extTop = tuple(c[c[:, :, 1].argmin()][0]) 53 | extBot = tuple(c[c[:, :, 1].argmax()][0]) 54 | 55 | cv2.circle(roi,extLeft,5,(0,255,0),2) 56 | cv2.circle(roi,extRight,5,(0,255,0),2) 57 | cv2.circle(roi,extTop,5,(0,255,0),2) 58 | cv2.circle(roi,extBot,5,(0,255,0),2) 59 | 60 | cv2.line(roi,extLeft,extTop,(255,0,0),2) 61 | cv2.line(roi,extTop,extRight,(255,0,0),2) 62 | cv2.line(roi,extRight,extBot,(255,0,0),2) 63 | cv2.line(roi,extBot,extLeft,(255,0,0),2) 64 | 65 | a = math.sqrt((extRight[0]-extTop[0])**2+(extRight[1]-extTop[1])**2) 66 | b = math.sqrt((extBot[0]-extRight[0])**2+(extBot[1]-extRight[1])**2) 67 | c = math.sqrt((extBot[0]-extTop[0])**2+(extBot[1]-extTop[1])**2) 68 | 69 | try: 70 | angle_ab= int(math.acos((a**2+b**2-c**2)/(2*b*c))*57) 71 | cv2.putText(roi,str(angle_ab),(extRight[0]-100+50,extRight[1]),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,255),2,cv2.LINE_AA) 72 | except: 73 | cv2.putText(roi," ? ",(extRight[0]-100+50,extRight[1]),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,255),2,cv2.LINE_AA) 74 | 75 | cv2.imshow("frame",frame) 76 | cv2.imshow("roi",roi) 77 | cv2.imshow("mask",mask) 78 | 79 | if cv2.waitKey(5) & 0xFF == ord('q'): 80 | break 81 | 82 | cap.release() 83 | cv2.destroyAllWindows() 84 | -------------------------------------------------------------------------------- /19_El_Ozellikleri.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | import math 9 | 10 | def findMaxContour(contours): 11 | max_i = 0 12 | max_area =0 13 | for i in range(len(contours)): 14 | area_hand = cv2.contourArea(contours[i]) 15 | 16 | if max_area 0: 48 | 49 | c = findMaxContour(contours) 50 | 51 | extLeft = tuple(c[c[:, :, 0].argmin()][0]) 52 | extRight = tuple(c[c[:, :, 0].argmax()][0]) 53 | extTop = tuple(c[c[:, :, 1].argmin()][0]) 54 | 55 | cv2.circle(roi,extLeft,5,(0,255,0),2) 56 | cv2.circle(roi,extRight,5,(0,255,0),2) 57 | cv2.circle(roi,extTop,5,(0,255,0),2) 58 | 59 | cv2.line(roi,extLeft,extTop,(255,0,0),2) 60 | cv2.line(roi,extTop,extRight,(255,0,0),2) 61 | cv2.line(roi,extRight,extLeft,(255,0,0),2) 62 | 63 | a = math.sqrt((extRight[0]-extTop[0])**2+(extRight[1]-extTop[1])**2) 64 | c = math.sqrt((extTop[0]-extLeft[0])**2+(extTop[1]-extLeft[1])**2) 65 | b = math.sqrt((extRight[0]-extLeft[0])**2+(extRight[1]-extLeft[1])**2) 66 | 67 | try: 68 | angle_ab= int(math.acos((a**2+b**2-c**2)/(2*b*c))*57) 69 | cv2.putText(roi,str(angle_ab),(extRight[0]-100+50,extRight[1]),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,255),2,cv2.LINE_AA) 70 | 71 | if angle_ab >70: 72 | cv2.rectangle(frame,(0,0),(100,100),(255,0,0),-1) 73 | else: 74 | pass 75 | 76 | except: 77 | cv2.putText(roi," ? ",(extRight[0]-100+50,extRight[1]),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,255),2,cv2.LINE_AA) 78 | 79 | cv2.imshow("frame",frame) 80 | cv2.imshow("roi",roi) 81 | cv2.imshow("mask",mask) 82 | 83 | if cv2.waitKey(5) & 0xFF == ord('q'): 84 | break 85 | 86 | cap.release() 87 | cv2.destroyAllWindows() 88 | -------------------------------------------------------------------------------- /20_Goz_Takip.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | vid = cv2.VideoCapture("gozler.mp4") 9 | 10 | while True: 11 | ret, frame = vid.read() 12 | frame = cv2.resize(frame, (960,540)) 13 | if ret is False: 14 | break 15 | 16 | roi = frame[190:250,350:470] 17 | 18 | gray = cv2.cvtColor(roi, cv2.COLOR_BGR2GRAY) 19 | _, threshold = cv2.threshold(gray, 12, 255, cv2.THRESH_BINARY_INV) 20 | 21 | contours,_ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) 22 | contours = sorted(contours, key=lambda x : cv2.contourArea(x), reverse = True) 23 | 24 | rows, cols, _ = roi.shape 25 | 26 | for cnt in contours: 27 | (a,b,c,d) = cv2.boundingRect(cnt) 28 | cv2.rectangle(roi, (a,b), (a+c, b+d), (0,255,0), 3) 29 | cv2.line(roi, (a+int(c/2),0), (a+int(c/2), rows), (180,0,180), 2) 30 | cv2.line(roi, (0,b+int(d/2)), (cols,b+int(d/2)), (180,0,180), 2) 31 | 32 | break 33 | frame[190:250,350:470] = roi 34 | 35 | cv2.imshow("Eye Tracking", frame) 36 | #cv2.imshow("Roi", roi) 37 | #cv2.imshow("Threshold", threshold) 38 | if cv2.waitKey(20) & 0xFF == ord('q'): 39 | break 40 | 41 | vid.release() 42 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /21_Resimden_Yuz_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("face.jpg") 9 | img = cv2.resize(img, (int(img.shape[1]/2),int(img.shape[0]/2))) 10 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 11 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 12 | 13 | rects = faceCascade.detectMultiScale(gray, 14 | scaleFactor=1.3, 15 | minNeighbors=4, 16 | minSize=(50, 50), 17 | flags=cv2.CASCADE_SCALE_IMAGE) 18 | 19 | for (a,b,c,d) in rects: 20 | cv2.rectangle(img, (a,b), (a+c, b+d), (0,255,255), 2) 21 | 22 | cv2.imshow("img", img) 23 | cv2.waitKey(0) 24 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /22_RealTime_Yuz_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture(0) 9 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 10 | 11 | while True: 12 | ret, frame = cap.read() 13 | frame = cv2.flip(frame, 1) 14 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 15 | 16 | rects = faceCascade.detectMultiScale(gray, 17 | scaleFactor=1.3, 18 | minNeighbors=4, 19 | minSize=(50, 50), 20 | flags=cv2.CASCADE_SCALE_IMAGE) 21 | 22 | for (a,b,c,d) in rects: 23 | cv2.rectangle(frame, (a,b), (a+c, b+d), (0,255,255), 2) 24 | 25 | cv2.imshow("Frame", frame) 26 | 27 | if cv2.waitKey(2) & 0xFF == ord('q'): 28 | break 29 | 30 | cap.release() 31 | cv2.destroyAllWindows() 32 | -------------------------------------------------------------------------------- /23_Resimden_Goz_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("face.jpg") 9 | img = cv2.resize(img, (int(img.shape[1]/2),int(img.shape[0]/2))) 10 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 11 | eyeCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_eye.xml") 12 | 13 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 14 | 15 | faces = faceCascade.detectMultiScale(gray, 16 | scaleFactor=1.3, 17 | minNeighbors=4, 18 | minSize=(50, 50), 19 | flags=cv2.CASCADE_SCALE_IMAGE) 20 | 21 | for (a,b,c,d) in faces: 22 | cv2.rectangle(img, (a,b), (a+c, b+d), (0,255,255), 3) 23 | 24 | roi = img[b:b+d, a:a+c] 25 | gray1 = gray[b:b+d, a:a+d] 26 | 27 | eyes = eyeCascade.detectMultiScale(gray1) 28 | 29 | for (a,b,c,d) in eyes: 30 | cv2.rectangle(roi, (a,b), (a+c, b+d), (180,0,180), 3) 31 | 32 | cv2.imshow("img", img) 33 | cv2.waitKey(0) 34 | cv2.destroyAllWindows() 35 | -------------------------------------------------------------------------------- /24_RealTime_Goz_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture(0) 9 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 10 | eyeCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_eye.xml") 11 | 12 | 13 | while True: 14 | ret, frame = cap.read() 15 | frame = cv2.flip(frame, 1) 16 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 17 | 18 | faces = faceCascade.detectMultiScale(gray, 19 | scaleFactor=1.3, 20 | minNeighbors=5, 21 | minSize=(50, 50), 22 | flags=cv2.CASCADE_SCALE_IMAGE) 23 | 24 | for (a,b,c,d) in faces: 25 | cv2.rectangle(frame, (a,b), (a+c, b+d), (0,255,255), 3) 26 | 27 | roi = frame[b:b+d, a:a+c] 28 | gray1 = gray[b:b+d, a:a+d] 29 | eyes = eyeCascade.detectMultiScale(gray1) 30 | 31 | for (a,b,c,d) in eyes: 32 | cv2.rectangle(roi, (a,b), (a+c, b+d), (180,0,180), 3) 33 | 34 | cv2.imshow("Frame", frame) 35 | 36 | if cv2.waitKey(2) & 0xFF == ord('q'): 37 | break 38 | 39 | cap.release() 40 | cv2.destroyAllWindows() 41 | -------------------------------------------------------------------------------- /25_Resimden_Insan_Govde_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("body.jpg") 9 | img = cv2.resize(img, (int(img.shape[1]/3),int(img.shape[0]/3))) 10 | bodyCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_upperbody.xml") 11 | 12 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 13 | 14 | bodies = bodyCascade.detectMultiScale(gray, 15 | scaleFactor = 1.02, 16 | minNeighbors = 5, 17 | minSize = (30, 50), 18 | flags = cv2.CASCADE_SCALE_IMAGE) 19 | 20 | for (a,b,c,d) in bodies: 21 | cv2.rectangle(img, (a,b), (a+c, b+d), (0,255,255), 2) 22 | 23 | cv2.imshow("Image", img) 24 | cv2.waitKey(0) 25 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /26_Videodan_Insan_Vucut_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture("body.mp4") 9 | bodyCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_fullbody.xml") 10 | 11 | while True: 12 | ret, frame = cap.read() 13 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 14 | 15 | rects = bodyCascade.detectMultiScale(gray, 16 | scaleFactor=1.1, 17 | minNeighbors=3, 18 | minSize=(10, 15), 19 | maxSize=(70,100), 20 | flags=cv2.CASCADE_SCALE_IMAGE) 21 | 22 | for (a,b,c,d) in rects: 23 | cv2.rectangle(frame, (a,b), (a+c, b+d), (0,255,255), 2) 24 | 25 | cv2.imshow("Frame", frame) 26 | 27 | if cv2.waitKey(2) & 0xFF == ord('q'): 28 | break 29 | 30 | cap.release() 31 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /27_Resimden_Gulumseme_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("smile.jpeg") 9 | img = cv2.resize(img, (int(img.shape[1]/3),int(img.shape[0]/3))) 10 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 11 | smileCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_smile.xml") 12 | 13 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 14 | 15 | faces = faceCascade.detectMultiScale(gray, 16 | scaleFactor=1.3, 17 | minNeighbors=5, 18 | minSize=(200, 200), 19 | flags=cv2.CASCADE_SCALE_IMAGE) 20 | 21 | for (a,b,c,d) in faces: 22 | cv2.rectangle(img, (a,b), (a+c, b+d), (0,255,255), 3) 23 | 24 | roi = img[b:b+d, a:a+c] 25 | gray1 = gray[b:b+d, a:a+d] 26 | 27 | smiles = smileCascade.detectMultiScale(gray1, 28 | scaleFactor=1.3, 29 | minNeighbors=5, 30 | minSize=(80, 80), 31 | flags=cv2.CASCADE_SCALE_IMAGE) 32 | 33 | for (a,b,c,d) in smiles: 34 | cv2.rectangle(roi, (a,b), (a+c, b+d), (180,0,180), 3) 35 | 36 | cv2.imshow("img", img) 37 | cv2.waitKey(0) 38 | cv2.destroyAllWindows() 39 | -------------------------------------------------------------------------------- /28_RealTime_Gulumseme_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture(0) 9 | faceCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_frontalface_default.xml") 10 | smileCascade = cv2.CascadeClassifier("haarcascade\\haarcascade_smile.xml") 11 | 12 | 13 | while True: 14 | ret, frame = cap.read() 15 | #frame = cv2.resize(frame, (1280,960)) 16 | frame = cv2.flip(frame, 1) 17 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 18 | 19 | faces = faceCascade.detectMultiScale(gray, 20 | scaleFactor=1.3, 21 | minNeighbors=5, 22 | minSize=(100, 100), 23 | flags=cv2.CASCADE_SCALE_IMAGE) 24 | 25 | for (a,b,c,d) in faces: 26 | cv2.rectangle(frame, (a,b), (a+c, b+d), (0,255,255), 3) 27 | 28 | roi = frame[b:b+d, a:a+c] 29 | gray1 = gray[b:b+d, a:a+d] 30 | smiles = smileCascade.detectMultiScale(gray1, 31 | scaleFactor=1.3, 32 | minNeighbors=5, 33 | minSize=(70, 70), 34 | flags=cv2.CASCADE_SCALE_IMAGE) 35 | 36 | for (a,b,c,d) in smiles: 37 | cv2.rectangle(roi, (a,b), (a+c, b+d), (180,0,180), 3) 38 | 39 | cv2.imshow("Frame", frame) 40 | 41 | if cv2.waitKey(2) & 0xFF == ord('q'): 42 | break 43 | 44 | cap.release() 45 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /29_Resimden_Araba_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("car.jpg") 9 | img1 = cv2.imread("car1.jpeg") 10 | carCascade = cv2.CascadeClassifier("haarcascade\\car.xml") 11 | 12 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 13 | cars = carCascade.detectMultiScale(gray, 14 | scaleFactor=1.05, 15 | minNeighbors=4, 16 | minSize=(60, 60), 17 | flags=cv2.CASCADE_SCALE_IMAGE) 18 | 19 | gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY) 20 | cars1 = carCascade.detectMultiScale(gray1, 21 | scaleFactor=1.03, 22 | minNeighbors=3, 23 | minSize=(60, 60), 24 | flags=cv2.CASCADE_SCALE_IMAGE) 25 | for (a,b,c,d) in cars: 26 | cv2.rectangle(img, (a,b), (a+c, b+d), (0,255,255), 2) 27 | 28 | for (a,b,c,d) in cars1: 29 | cv2.rectangle(img1, (a,b), (a+c, b+d), (0,255,255), 2) 30 | 31 | cv2.imshow("Image", img) 32 | cv2.imshow("Image 1", img1) 33 | cv2.waitKey(0) 34 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /30_Videodan_Araba_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | vid = cv2.VideoCapture("car1.mp4") 9 | carCascade = cv2.CascadeClassifier("haarcascade\\car.xml") 10 | 11 | while True: 12 | ret, frame = vid.read() 13 | frame = cv2.flip(frame, 1) 14 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 15 | 16 | cars = carCascade.detectMultiScale(gray, 17 | scaleFactor=1.05, 18 | minNeighbors=2, 19 | minSize=(50, 50), 20 | flags=cv2.CASCADE_SCALE_IMAGE) 21 | 22 | for (a,b,c,d) in cars: 23 | cv2.rectangle(frame, (a,b), (a+c, b+d), (0,255,255), 2) 24 | 25 | cv2.imshow("Frame", frame) 26 | 27 | if cv2.waitKey(2) & 0xFF == ord('q'): 28 | break 29 | 30 | vid.release() 31 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /31_Plaka_Okuma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | import pytesseract 9 | import imutils 10 | 11 | img = cv2.imread("license_plate.jpg") 12 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 13 | temp = cv2.bilateralFilter(gray, 7, 250, 250) 14 | edged = cv2.Canny(temp, 50, 200) 15 | 16 | contours = cv2.findContours(edged, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) 17 | cnts = imutils.grab_contours(contours) 18 | cnts = sorted(cnts, key=cv2.contourArea, reverse=True)[:10] 19 | 20 | screen = None 21 | 22 | for cnt in cnts: 23 | epsilon = 0.018 * cv2.arcLength(cnt, True) 24 | approx = cv2.approxPolyDP(cnt, epsilon, True) 25 | if len(approx) == 4: 26 | screen = approx 27 | break 28 | 29 | mask = np.zeros(gray.shape, np.uint8) 30 | result = cv2.drawContours(mask, [screen], 0, (255,255,255), -1) 31 | result = cv2.bitwise_and(img, img, mask=mask) 32 | (x,y) = np.where(mask == 255) 33 | (topx, topy) = (np.min(x), np.min(y)) 34 | (botx, boty) = (np.max(x), np.max(y)) 35 | 36 | cropped = gray[topx:botx+1, topy:boty+1] 37 | 38 | print(pytesseract.image_to_string(cropped, lang="eng")) 39 | 40 | cv2.imshow("Original", img) 41 | cv2.imshow("Cropped", cropped) 42 | 43 | cv2.waitKey(0) 44 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /32_Arac_Sayma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | vid = cv2.VideoCapture("cars.mp4") 9 | backsub = cv2.createBackgroundSubtractorMOG2() 10 | c = 0 11 | 12 | while True: 13 | ret,frame = vid.read() 14 | if ret: 15 | mask = backsub.apply(frame) 16 | cv2.line(frame,(0,470),(1280,470),(0,0,255),3) 17 | cv2.line(frame,(0,520),(1280,520),(0,0,255),3) 18 | cv2.rectangle(frame, (940,10), (1275, 95), (255,0,0), 3) 19 | 20 | contours,hierarchy = cv2.findContours(mask,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) 21 | try : hierarchy = hierarchy[0] 22 | except: hierarchy=[] 23 | 24 | for contour,hier in zip(contours,hierarchy): 25 | (x,y,w,h) = cv2.boundingRect(contour) 26 | if w>150 and h >150: 27 | cv2.rectangle(frame,(x,y),(x+w,y+h),(0,255,0),3) 28 | if y>490 and y<525: 29 | c+=1 30 | 31 | try : hierarchy = hierarchy[1] 32 | except: hierarchy=[] 33 | 34 | 35 | #cv2.putText(source_image,text,coordinates,font,size,color,thickness,better look) 36 | cv2.putText(frame,"CAR:"+str(c),(945,85),cv2.FONT_HERSHEY_SIMPLEX,3,(0,255,255),3,cv2.LINE_AA) 37 | 38 | cv2.imshow("Mask",mask) 39 | cv2.imshow("Frame",frame) 40 | 41 | if cv2.waitKey(40) & 0xFF==ord('q'): 42 | break 43 | 44 | vid.release() 45 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /33_RealTime_El_Hareketleri_Tanıma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | import math 9 | 10 | cap = cv2.VideoCapture(0) 11 | 12 | while True: 13 | try: 14 | ret, frame = cap.read() 15 | frame = cv2.flip(frame, 1) 16 | roi = frame[75:350, 350:620] 17 | cv2.rectangle(frame, (350,75), (620,350), (255,0,255), 2) 18 | 19 | hsv = cv2.cvtColor(roi, cv2.COLOR_BGR2HSV) 20 | 21 | lowerColor = np.array([0,40,80], dtype = np.uint8) 22 | upperColor = np.array([20,150,255], dtype = np.uint8) 23 | 24 | kernel = np.ones((4,4), np.uint8) 25 | mask = cv2.inRange(hsv, lowerColor, upperColor) 26 | mask = cv2.dilate(mask, kernel, iterations=3) 27 | mask = cv2.GaussianBlur(mask, (5,5), 100) 28 | 29 | contours,_ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) 30 | 31 | cnt = max(contours, key=lambda x:cv2.contourArea(x)) 32 | epsilon = 0.0005 * cv2.arcLength(cnt, True) 33 | approx = cv2.approxPolyDP(cnt, epsilon, True) 34 | 35 | hull = cv2.convexHull(cnt) 36 | area_hull = cv2.contourArea(hull) 37 | area_cnt = cv2.contourArea(cnt) 38 | area_ratio = ((area_hull-area_cnt) / area_cnt) * 100 39 | 40 | hull = cv2.convexHull(approx, returnPoints=False) 41 | defects = cv2.convexityDefects(approx, hull) 42 | 43 | dc = 0 44 | 45 | for i in range(defects.shape[0]): 46 | s,e,f,d = defects[i,0] 47 | start = tuple(approx[s][0]) 48 | end = tuple(approx[e][0]) 49 | far = tuple(approx[f][0]) 50 | 51 | a = math.sqrt((end [0]-start[0]) **2 + (end[1]-start[1]) **2) 52 | b = math.sqrt((far [0]-start[0]) **2 + (far[1]-start[1]) **2) 53 | c = math.sqrt((end [0]-far[0]) **2 + (end[1]-far[1]) **2) 54 | 55 | s = (a+b+c) / 2 56 | area = math.sqrt(s*(s-a)*(s-b)*(s-c)) 57 | d = (2*area) / a 58 | 59 | angle = math.acos((b**2+c**2-a**2) / (2*b*c))*57 60 | if angle <= 90 and d>30: 61 | dc += 1 62 | cv2.circle(roi, far, 3, [255,0,0], -1) 63 | 64 | cv2.line(roi,start, end, [0,255,0], 2) 65 | 66 | dc += 1 67 | font = cv2.FONT_HERSHEY_SIMPLEX 68 | 69 | if dc == 1: 70 | if area_cnt < 2000: 71 | cv2.putText(frame, "Put your hand in the box", (50,50), font, 1, (0,0,255), 2, cv2.LINE_AA) 72 | else: 73 | if area_ratio < 12: 74 | cv2.putText(frame, "0", (0,50), font, 2, (0,0,255), 2, cv2.LINE_AA) 75 | 76 | elif area_ratio < 17.5: 77 | cv2.putText(frame, "Good Job", (0,50), font, 2, (0,0,255), 2, cv2.LINE_AA) 78 | 79 | else: 80 | cv2.putText(frame, "1", (0,50), font, 2, (0,0,255), 2, cv2.LINE_AA) 81 | 82 | elif dc==2: 83 | cv2.putText(frame,'2',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 84 | 85 | elif dc==3: 86 | if area_ratio<27: 87 | cv2.putText(frame,'3',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 88 | else: 89 | cv2.putText(frame,'ok',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 90 | 91 | elif dc==4: 92 | cv2.putText(frame,'4',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 93 | 94 | elif dc==5: 95 | cv2.putText(frame,'5',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 96 | 97 | elif dc==6: 98 | cv2.putText(frame,'reposition',(0,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 99 | 100 | else : 101 | cv2.putText(frame,'reposition',(10,50), font, 2, (0,0,255), 3, cv2.LINE_AA) 102 | 103 | except: 104 | pass 105 | 106 | cv2.imshow("Frame", frame) 107 | 108 | if cv2.waitKey(2) & 0xFF == ord('q'): 109 | break 110 | 111 | cap.release() 112 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /34_RealTime_Resim_Cizme.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | # Mavi bir nesne ile frame üzerine çizimler yapabilirsiniz. 7 | 8 | import cv2 9 | import numpy as np 10 | from collections import deque 11 | 12 | cap = cv2.VideoCapture(0) 13 | 14 | lower_blue= np.array([100,60,60]) 15 | upper_blue= np.array([140,255,255]) 16 | 17 | blue_points = [deque(maxlen=512)] 18 | green_points = [deque(maxlen=512)] 19 | red_points = [deque(maxlen=512)] 20 | yellow_points = [deque(maxlen=512)] 21 | 22 | blue_index=0 23 | green_index=0 24 | red_index=0 25 | yellow_index=0 26 | 27 | colors = [(255,0,0),(0,255,0),(0,0,255),(0,255,255)] 28 | color_index = 0 29 | 30 | paintWindow = np.zeros((471,636,3))+255 31 | 32 | paintWindow = cv2.rectangle(paintWindow,(40,1),(140,65),(0,0,0),2) 33 | paintWindow = cv2.rectangle(paintWindow,(160,1),(255,65),colors[0],-1) 34 | paintWindow = cv2.rectangle(paintWindow,(275,1),(370,65),colors[1],-1) 35 | paintWindow = cv2.rectangle(paintWindow,(390,1),(485,65),colors[2],-1) 36 | paintWindow = cv2.rectangle(paintWindow,(505,1),(600,65),colors[3],-1) 37 | 38 | font = cv2.FONT_HERSHEY_SIMPLEX 39 | cv2.putText(paintWindow,"CLEAR ALL",(49,33),font,0.5,(0,0,0),2,cv2.LINE_AA) 40 | cv2.putText(paintWindow,"BLUE",(185,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 41 | cv2.putText(paintWindow,"GREEN",(298,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 42 | cv2.putText(paintWindow,"RED",(420,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 43 | cv2.putText(paintWindow,"YELLOW",(520,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 44 | 45 | cv2.namedWindow("Paint") 46 | 47 | 48 | while 1: 49 | ret,frame = cap.read() 50 | frame = cv2.flip(frame,1) 51 | hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) 52 | 53 | frame = cv2.rectangle(frame,(40,1),(140,65),(0,0,0),2) 54 | frame = cv2.rectangle(frame,(160,1),(255,65),colors[0],-1) 55 | frame = cv2.rectangle(frame,(275,1),(370,65),colors[1],-1) 56 | frame = cv2.rectangle(frame,(390,1),(485,65),colors[2],-1) 57 | frame = cv2.rectangle(frame,(505,1),(600,65),colors[3],-1) 58 | 59 | font = cv2.FONT_HERSHEY_SIMPLEX 60 | cv2.putText(frame,"CLEAR ALL",(49,33),font,0.5,(0,0,0),2,cv2.LINE_AA) 61 | cv2.putText(frame,"BLUE",(185,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 62 | cv2.putText(frame,"GREEN",(298,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 63 | cv2.putText(frame,"RED",(420,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 64 | cv2.putText(frame,"YELLOW",(520,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 65 | 66 | if ret is False: 67 | break 68 | 69 | mask = cv2.inRange(hsv,lower_blue,upper_blue) 70 | 71 | mask = cv2.erode(mask,(5,5),iterations =2) 72 | mask = cv2.morphologyEx(mask,cv2.MORPH_OPEN,(5,5)) 73 | mask = cv2.dilate(mask,(5,5),iterations = 1) 74 | 75 | contours,_ =cv2.findContours(mask,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) 76 | center = None 77 | 78 | if len(contours) > 0: 79 | max_contours = sorted(contours, key = cv2.contourArea, reverse=True)[0] 80 | ((x,y),radius) = cv2.minEnclosingCircle(max_contours) 81 | cv2.circle(frame,(int(x),int(y)),int(radius),(255,255,0),3) 82 | 83 | M = cv2.moments(max_contours) 84 | center = (int(M["m10"]/M["m00"]),int(M["m01"]/M["m00"])) 85 | 86 | if center[1] <= 65: 87 | if 40<=center[0]<=140: 88 | 89 | blue_points = [deque(maxlen=512)] 90 | green_points = [deque(maxlen=512)] 91 | red_points = [deque(maxlen=512)] 92 | yellow_points = [deque(maxlen=512)] 93 | 94 | blue_index=0 95 | green_index=0 96 | red_index=0 97 | yellow_index=0 98 | 99 | paintWindow[67:,:,:]=255 100 | 101 | elif 160<=center[0]<=255: 102 | color_index = 0 103 | 104 | elif 275<=center[0]<=370: 105 | color_index = 1 106 | 107 | elif 390<=center[0]<=485: 108 | color_index = 2 109 | 110 | elif 505<=center[0]<=600: 111 | color_index = 3 112 | 113 | else: 114 | if color_index == 0: 115 | blue_points[blue_index].appendleft(center) 116 | 117 | elif color_index == 1: 118 | green_points[green_index].appendleft(center) 119 | 120 | elif color_index == 2: 121 | red_points[red_index].appendleft(center) 122 | 123 | elif color_index == 3: 124 | yellow_points[yellow_index].appendleft(center) 125 | 126 | else: 127 | blue_points.append(deque(maxlen=512)) 128 | blue_index+=1 129 | 130 | green_points.append(deque(maxlen=512)) 131 | green_index+=1 132 | 133 | red_points.append(deque(maxlen=512)) 134 | red_index+=1 135 | 136 | yellow_points.append(deque(maxlen=512)) 137 | yellow_index+=1 138 | 139 | points = [blue_points,green_points,red_points,yellow_points] 140 | 141 | for i in range(len(points)): 142 | for j in range(len(points[i])): 143 | for k in range(1,len(points[i][j])): 144 | if points[i][j][k-1] is None or points[i][j][k] is None: 145 | continue 146 | 147 | cv2.line(frame,points[i][j][k-1], points[i][j][k], colors[i], 2) 148 | cv2.line(paintWindow,points[i][j][k-1], points[i][j][k], colors[i], 2) 149 | 150 | 151 | cv2.imshow("Frame",frame) 152 | cv2.imshow("Paint",paintWindow) 153 | 154 | if cv2.waitKey(3) & 0xFF == ord('q'): 155 | break 156 | 157 | cap.release() 158 | cv2.destroyAllWindows() 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /35_Arac_Hizi_Hesaplama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import time 8 | 9 | vid = cv2.VideoCapture("cars.mp4") 10 | carCascade = cv2.CascadeClassifier("haarcascade/car1.xml") 11 | 12 | crd = [[620,220],[740,220],[580,500],[815,500]] 13 | distance, t1, t2, speed, p_frame, n_frame, cnt = 0.025, 0, 0, "", 0, 0, 0 14 | 15 | while True: 16 | ret, frame = vid.read() 17 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 18 | 19 | cars = carCascade.detectMultiScale(gray, 20 | scaleFactor=1.1, 21 | minNeighbors=3, 22 | minSize=(100, 100), 23 | flags=cv2.CASCADE_SCALE_IMAGE) 24 | 25 | cv2.line(frame, (crd[0][0],crd[0][1]),(crd[1][0],crd[1][1]),(0,0,255), 2) 26 | cv2.line(frame, (crd[0][0],crd[0][1]),(crd[2][0],crd[2][1]),(0,0,255), 2) 27 | cv2.line(frame, (crd[2][0],crd[2][1]),(crd[3][0],crd[3][1]),(0,0,255), 2) 28 | cv2.line(frame, (crd[1][0],crd[1][1]),(crd[3][0],crd[3][1]),(0,0,255), 2) 29 | 30 | for (a,b,c,d) in cars: 31 | cx, cy = int(a+c/2), int(b+d/2) 32 | 33 | if(cx >= crd[2][0] and cx <= crd[3][0] and cy >= (crd[2][1]-10) and cy <= (crd[3][1]+5)): 34 | cv2.circle(frame,(cx,cy),4,(0,255,255),-1) 35 | cv2.line(frame, (crd[2][0],crd[2][1]),(crd[3][0],crd[3][1]),(0,255,0), 2) 36 | t1 = time.time() 37 | 38 | if(cx >= crd[0][0] and cx <= crd[1][0] and cy >= (crd[0][1]-10) and cy <= (crd[1][1]+5)): 39 | cv2.circle(frame,(cx,cy),4,(0,255,255),-1) 40 | cv2.line(frame, (crd[0][0],crd[0][1]),(crd[1][0],crd[1][1]),(0,255,0), 2) 41 | t2 = time.time() 42 | fps = cnt/(t2-t1) 43 | if t2-t1 > 0: 44 | sp = distance/((t2-t1)/3600) 45 | if sp * (30/fps) < 250: 46 | if sp * (30/fps) > 50 : 47 | speed = str(sp* (30/fps)) 48 | else: 49 | speed = str(sp) 50 | cnt = 0 51 | break; 52 | 53 | if speed != "" : cv2.putText(frame,""+str(speed[:5])+"km/h",(crd[0][0]-20,crd[0][1]-20),cv2.FONT_HERSHEY_SIMPLEX,1,(0,255,255),1,cv2.LINE_AA) 54 | 55 | cv2.imshow("Frame", frame) 56 | cnt+=1 57 | if cv2.waitKey(2) & 0xFF == ord('q'): 58 | break 59 | 60 | vid.release() 61 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/01_ek_Trackbar_App_Renk_Ayarlama.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Fri Oct 2 13:48:59 2020 4 | 5 | @author: omerkocadayi 6 | """ 7 | 8 | import cv2 9 | import numpy as np 10 | 11 | def nothing(i): 12 | pass 13 | 14 | img = np.zeros((480,480, 3), np.uint8) 15 | cv2.namedWindow("trackbar_test") 16 | 17 | cv2.createTrackbar("B", "trackbar_test", 0, 255, nothing) 18 | cv2.createTrackbar("G", "trackbar_test", 0, 255, nothing) 19 | cv2.createTrackbar("R", "trackbar_test", 0, 255, nothing) 20 | 21 | while True: 22 | cv2.imshow("Test", img) 23 | if cv2.waitKey(2) & 0xFF == ord("q"): 24 | break 25 | 26 | b = cv2.getTrackbarPos("B", "trackbar_test") 27 | g = cv2.getTrackbarPos("G", "trackbar_test") 28 | r = cv2.getTrackbarPos("R", "trackbar_test") 29 | 30 | img[:] = [b,g,r] 31 | 32 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/02_ek_Video_Boyutlandırma_Aspect_Ratio.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Created on Wed Sep 30 18:21:47 2020 4 | 5 | @author: omerkocadayi 6 | """ 7 | import cv2 8 | 9 | def resizeAspectRatio(img, width = None, height = None, inter = cv2.INTER_AREA): 10 | dimension = None 11 | (h,w) = img.shape[:2] 12 | 13 | if width is None and height is None: 14 | return img 15 | 16 | if width is None: 17 | r = height / float(h) 18 | dimension = (int(w*r), height) 19 | else: 20 | r = width / float(w) 21 | dimension = (width, int(h*r)) 22 | 23 | return cv2.resize(img, dimension, interpolation = inter) 24 | 25 | 26 | 27 | img = cv2.imread("deneme.jpg") 28 | img1 = resizeAspectRatio(img, None, 450, cv2.INTER_AREA) 29 | 30 | cv2.imshow("orjinal", img) 31 | cv2.imshow("resized", img1) 32 | #img = cv2.resize(img, (200,500)) #boyut ayarlama (en/boy oranı dikkate alınmalı) 33 | 34 | cv2.waitKey(0) 35 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/03_ek_Resim_Yumuşatma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img_0 = cv2.imread("06_batman.jpg") 10 | #img_1 = cv2.imread("median_noise.png") 11 | #img_2 = cv2.imread("bilateral_noise.jpg") 12 | 13 | img_0_0 = cv2.blur(img_0, (5,5)) 14 | img_0_1 = cv2.GaussianBlur(img_0, (5,5), cv2.BORDER_DEFAULT) 15 | 16 | cv2.imshow("Original - No Blur", img_0) 17 | cv2.imshow("Blur", img_0_0) 18 | cv2.imshow("Gaussian Blur", img_0_1) 19 | 20 | 21 | #img_1_0 = cv2.medianBlur(img_1, 7) 22 | #cv2.imshow("Original - With Median Noise", img_1) 23 | #cv2.imshow("Smooting Median", img_1_0) 24 | 25 | 26 | #img_2_0 = cv2.bilateralFilter(img_2, 10, 90, 90) 27 | #cv2.imshow("Original - With Bilateral Noise", img_2) 28 | #cv2.imshow("Smooting Bilateral", img_2_0) 29 | 30 | cv2.waitKey(0) 31 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/04_ek_Bitwise_Ornek.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img1 = cv2.imread("bitwise1.png") 10 | img2 = cv2.imread("bitwise2.png") 11 | 12 | cv2.imshow("Original Image 1", img1) 13 | cv2.imshow("Original Image 2", img2) 14 | 15 | bit_and = cv2.bitwise_and(img1,img2) 16 | bit_or = cv2.bitwise_or(img1,img2) 17 | bit_not = cv2.bitwise_not(img1,img2) 18 | bit_xor = cv2.bitwise_xor(img1,img2) 19 | 20 | #cv2.imshow("Bitwise AND", bit_and) # 1&1=1 , gerisi 0 21 | #cv2.imshow("Bitwise OR", bit_or) # 0|0=0 , gerisi 1 22 | #cv2.imshow("Bitwise NOT", bit_not) # 0~0=1 , 0~1=1 , gerisi 0 23 | #cv2.imshow("Bitwise XOR", bit_xor) # 0^0=0 , 1^1=0, gerisi 1 24 | 25 | cv2.waitKey(0) 26 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/05_ek_Threshold.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("threshold.jpg", 0) 9 | 10 | ret, th1 = cv2.threshold(img, 160, 250, cv2.THRESH_BINARY) # renk değeri 160'tan büyük ise 250'ye eşitle, gerisi 0 11 | th2 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY, 21, 5) 12 | th3 = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C , cv2.THRESH_BINARY , 21, 5) 13 | 14 | cv2.imshow("Original Image", img) 15 | cv2.imshow("With Threshold", th1) 16 | cv2.imshow("With Mean Threshold - Adaptive", th2) 17 | cv2.imshow("With Gaussian Threshold - Adaptive", th3) 18 | 19 | cv2.waitKey(0) 20 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/06_ek_Histogram.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | """ 6 | Spyder IDE kullananlar için plt.show() çalışmayabilir. 7 | Tools->Preferences->IPython Console->Graphics->Graphics Backend-> Backend = 'Automatic' olarak seçin 8 | Bu şekilde düzelecektir. Aksi takdirde plt.show() yerine plt.draw() metodunu deneyiniz. 9 | """ 10 | 11 | import cv2 12 | from matplotlib import pyplot as plt 13 | 14 | img = cv2.imread("test.jpg") 15 | b,g,r = cv2.split(img) 16 | 17 | plt.hist(b.ravel(), 256, [0,256]) 18 | plt.hist(g.ravel(), 256, [0,256]) 19 | plt.hist(r.ravel(), 256, [0,256]) 20 | #plt.hist(img.ravel(), 256, [0,256]) 21 | 22 | cv2.imshow("Image", img) 23 | plt.show() 24 | 25 | cv2.waitKey(0) 26 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/07_ek_Kose_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img = cv2.imread("kose_algila.jpg") 10 | 11 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 12 | gray = np.float32(gray) 13 | 14 | corners = cv2.goodFeaturesToTrack(gray, 75, 0.01, 10) 15 | corners = np.int0(corners) 16 | 17 | for crn in corners: 18 | x,y = crn.ravel() 19 | cv2.circle(img, (x,y), 3, (180,0,180), -1) 20 | 21 | cv2.imshow("Corners", img) 22 | cv2.waitKey(0) 23 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/08_ek_Kenar_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture(0) 9 | 10 | while True: 11 | ret, frame = cap.read() 12 | frame = cv2.flip(frame,1) 13 | 14 | edges = cv2.Canny(frame, 80,180) 15 | 16 | cv2.imshow("Frame", frame) 17 | cv2.imshow("Edges", edges) 18 | 19 | if cv2.waitKey(1) & 0xFF == ord('q'): 20 | break 21 | cap.release() 22 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/09_ek_Kontur_Merkez_Alan_Cevre.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | ##Kontur Uygulaması 9 | img = cv2.imread("contour1.png") 10 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 11 | cv2.imshow("Original Image for Contour App", img) 12 | 13 | _, thresh = cv2.threshold(gray,127,255,cv2.THRESH_BINARY) 14 | contours, _=cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) 15 | cv2.drawContours(img,contours,-1,(180,0,180),3) 16 | 17 | ############################################################################ 18 | ##Geometri Merkezi Bulma Uygulamasi 19 | img2 = cv2.imread("ucgen.png") 20 | cv2.imshow("Original Triangle for Center and Area", img2) 21 | gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY) 22 | _, thresh2 = cv2.threshold(gray2,127,255,cv2.THRESH_BINARY) 23 | M = cv2.moments(thresh2) 24 | 25 | X = int(M["m10"]/ M["m00"]) 26 | Y = int(M["m01"]/ M["m00"]) 27 | 28 | cv2.circle(img2, (X,Y), 5, (200,0,200), -1) 29 | 30 | 31 | ############################################################################ 32 | ##Kontur - Alan, Çevre Uygulaması 33 | 34 | img3 = cv2.imread("ucgen.png") 35 | gray3 = cv2.cvtColor(img3, cv2.COLOR_BGR2GRAY) 36 | _, thresh3 = cv2.threshold(gray3,127,255,cv2.THRESH_BINARY) 37 | 38 | contours3, _=cv2.findContours(thresh3,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) 39 | 40 | cnt = contours3[0] 41 | area = cv2.contourArea(cnt) 42 | length = cv2.arcLength(cnt, True) 43 | print("Area = ",area,"\nLength = ",length) 44 | 45 | 46 | cv2.imshow("Contour",img) 47 | cv2.imshow("Triangle Center", img2) 48 | cv2.waitKey(0) 49 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/10_ek_Daire_Tespit.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img = cv2.imread("toplar.jpeg") 10 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 11 | 12 | gray = cv2.medianBlur(gray, 3) 13 | rows = gray.shape[0] 14 | 15 | circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, rows / 8, param1=100, param2=30, minRadius=40, maxRadius=220) 16 | 17 | if circles is not None: 18 | circles = np.uint16(np.around(circles)) 19 | for i in circles[0, :]: 20 | center = (i[0], i[1]) 21 | # circle center 22 | cv2.circle(img, center, 1, (0, 100, 100), 3) 23 | # circle outline 24 | radius = i[2] 25 | cv2.circle(img, center, radius, (255, 0, 255), 3) 26 | 27 | cv2.imshow("Circles", img) 28 | cv2.waitKey(0) 29 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/11_ek_Cokgen_Algilama_Real_Time.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | def nothing(x): 10 | pass 11 | 12 | cap = cv2.VideoCapture(0) 13 | cv2.namedWindow("Settings") 14 | cv2.createTrackbar("Lower-Hue", "Settings", 0, 180, nothing) 15 | cv2.createTrackbar("Lower-Saturation", "Settings", 0, 255, nothing) 16 | cv2.createTrackbar("Lower-Value", "Settings", 0, 255, nothing) 17 | cv2.createTrackbar("Upper-Hue", "Settings", 0, 180, nothing) 18 | cv2.createTrackbar("Upper-Saturation", "Settings", 0, 255, nothing) 19 | cv2.createTrackbar("Upper-Value", "Settings", 0, 255, nothing) 20 | 21 | font = cv2.FONT_HERSHEY_SIMPLEX 22 | 23 | while True: 24 | ret, frame = cap.read() 25 | frame = cv2.flip(frame, 1) 26 | hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV) 27 | 28 | lh = cv2.getTrackbarPos("Lower-Hue", "Settings") 29 | ls = cv2.getTrackbarPos("Lower-Saturation", "Settings") 30 | lv = cv2.getTrackbarPos("Lower-Value", "Settings") 31 | uh = cv2.getTrackbarPos("Upper-Hue", "Settings") 32 | us = cv2.getTrackbarPos("Upper-Saturation", "Settings") 33 | uv = cv2.getTrackbarPos("Upper-Value", "Settings") 34 | 35 | lower_color = np.array([lh,ls,lv]) 36 | upper_color = np.array([uh,us,uv]) 37 | 38 | mask = cv2.inRange(hsv, lower_color, upper_color) 39 | 40 | kernel = np.ones((3,3), np.uint8) 41 | mask = cv2.erode(mask, kernel) 42 | 43 | contours, ret = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) 44 | 45 | for cnt in contours: 46 | area = cv2.contourArea(cnt) 47 | epsilon = 0.02 * cv2.arcLength(cnt, True) 48 | approx = cv2.approxPolyDP(cnt, epsilon, True) 49 | 50 | x = approx.ravel()[0] 51 | y = approx.ravel()[1] 52 | 53 | if area > 350: 54 | cv2.drawContours(frame, [approx], 0, (180,0,180), 4) 55 | if len(approx) == 3: 56 | cv2.putText(frame, "Triangle", (x,y), font, 1, (0,0,0)) 57 | if len(approx) == 4: 58 | cv2.putText(frame, "Rectangle", (x,y), font, 1, (0,0,0)) 59 | if len(approx) == 5: 60 | cv2.putText(frame, "Polygon", (x,y), font, 1, (0,0,0)) 61 | elif len(approx) > 8: 62 | cv2.putText(frame, "Circle", (x,y), font, 1, (0,0,0)) 63 | 64 | cv2.imshow("Frame", frame) 65 | cv2.imshow("Mask", mask) 66 | 67 | if cv2.waitKey(2) & 0xFF == ord('q'): 68 | break 69 | 70 | cap.release() 71 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/12_ek_Mouse_Events.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | cap = cv2.VideoCapture("line.mp4") 9 | circles = [] 10 | 11 | def mouse(event,x,y,flags,params): 12 | if event==cv2.EVENT_LBUTTONDOWN: 13 | circles.append((x,y)) 14 | 15 | cv2.namedWindow("Frame") 16 | cv2.setMouseCallback("Frame",mouse) 17 | 18 | while 1: 19 | _,frame = cap.read() 20 | frame = cv2.resize(frame,(640,480)) 21 | for center in circles: 22 | cv2.circle(frame,center,20,(255,0,0),-1) 23 | 24 | cv2.imshow("Frame",frame) 25 | key = cv2.waitKey(1) 26 | if key==27: 27 | break 28 | elif key == ord("h"): 29 | circles =[] 30 | 31 | cap.release() 32 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/13_ek_Resim_Karsilastirma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | path1 = "batman.jpg" 9 | 10 | img1 = cv2.imread(path1) 11 | img2 = cv2.imread(path1) 12 | img3 = cv2.medianBlur(img1,3) 13 | 14 | if img1.shape == img2.shape: 15 | print("Img1 and Img2 are the same size") 16 | else: 17 | print("Img1 and Img2 are not the same size") 18 | 19 | diff = cv2.subtract(img1,img3) 20 | b,g,r = cv2.split(diff) 21 | 22 | if cv2.countNonZero(b) == 0 and cv2.countNonZero(g) == 0 and cv2.countNonZero(r) == 0 : 23 | print("completely equal") 24 | else: 25 | print("NOT completely equal") 26 | 27 | cv2.imshow("Difference",diff) 28 | 29 | cv2.waitKey(0) 30 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/14_ek_Cozunurluk_Ayarlama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | window_name = "Live" 8 | cv2.namedWindow(window_name) 9 | 10 | cap = cv2.VideoCapture(0) 11 | 12 | print("Original Resolution : "+str(cap.get(3))+" * "+str(cap.get(4))) 13 | 14 | cap.set(3, cap.get(3) + cap.get(3)*0.3) #or cap.get(3)*1.3 15 | cap.set(4, cap.get(4) + cap.get(4)*0.3) #or cap.get(4)*1.3 16 | 17 | print("\n+30%.. Resolution : "+str(cap.get(3))+" * "+str(cap.get(4))) 18 | 19 | while 1: 20 | _, frame = cap.read() 21 | frame = cv2.flip(frame,1) 22 | 23 | cv2.imshow(window_name, frame) 24 | 25 | if cv2.waitKey(5) & 0xFF == ord('q'): 26 | break 27 | 28 | cap.release() 29 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/15_ek_Blurlu_Goruntu_Algilama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | 8 | img = cv2.imread("batman.jpg") 9 | blur = cv2.medianBlur(img, 3) 10 | 11 | laplacian_img = cv2.Laplacian(img, cv2.CV_64F).var() 12 | laplacian_blur = cv2.Laplacian(blur, cv2.CV_64F).var() 13 | 14 | print("Original img laplacian value : "+str(laplacian_img)+"\nBlurry img laplacian value : "+str(laplacian_blur) ) 15 | 16 | if laplacian_blur <= 500: 17 | print("\nBlurry Image !") 18 | 19 | cv2.imshow("Original", img) 20 | cv2.imshow("Blurry", blur) 21 | cv2.waitKey(0) 22 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Ek_Uygulamalar/16_ek_Sablon_Kesit_Arama.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | import cv2 7 | import numpy as np 8 | 9 | img = cv2.imread("test.jpg") 10 | temp = cv2.imread("test1.jpg") 11 | 12 | gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 13 | gray_temp= cv2.cvtColor(temp, cv2.COLOR_BGR2GRAY) 14 | 15 | result = cv2.matchTemplate(gray_img, gray_temp, cv2.TM_CCORR_NORMED) 16 | location = np.where(result >= 0.99) 17 | 18 | w,h = gray_temp.shape[::-1] 19 | 20 | for point in zip(*location[::-1]): 21 | cv2.rectangle(img, point, (point[0]+ w,point[1]+h), (0,255,255), 2) 22 | 23 | cv2.imshow("Original Img", img) 24 | cv2.imshow("Template", temp) 25 | cv2.waitKey(0) 26 | cv2.destroyAllWindows() 27 | -------------------------------------------------------------------------------- /Ek_Uygulamalar/17_ek_Resimden_Metin_Okuma.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | from PIL import Image 7 | import pytesseract 8 | 9 | img = Image.open("kose_algila.jpg") 10 | text = pytesseract.image_to_string(img, lang = "tur") 11 | print(text) 12 | -------------------------------------------------------------------------------- /Ek_Uygulamalar/18_ek_RealTime_Resim_Cizme.py: -------------------------------------------------------------------------------- 1 | """ -*- coding: utf-8 -*- 2 | @author: omerkocadayi 3 | https://github.com/omerkocadayi 4 | https://www.linkedin.com/in/omerkocadayi/ """ 5 | 6 | # Mavi bir nesne ile frame üzerine çizimler yapabilirsiniz. 7 | 8 | import cv2 9 | import numpy as np 10 | from collections import deque 11 | 12 | cap = cv2.VideoCapture(0) 13 | 14 | lower_blue= np.array([100,60,60]) 15 | upper_blue= np.array([140,255,255]) 16 | 17 | blue_points = [deque(maxlen=512)] 18 | green_points = [deque(maxlen=512)] 19 | red_points = [deque(maxlen=512)] 20 | yellow_points = [deque(maxlen=512)] 21 | 22 | blue_index=0 23 | green_index=0 24 | red_index=0 25 | yellow_index=0 26 | 27 | colors = [(255,0,0),(0,255,0),(0,0,255),(0,255,255)] 28 | color_index = 0 29 | 30 | paintWindow = np.zeros((471,636,3))+255 31 | 32 | paintWindow = cv2.rectangle(paintWindow,(40,1),(140,65),(0,0,0),2) 33 | paintWindow = cv2.rectangle(paintWindow,(160,1),(255,65),colors[0],-1) 34 | paintWindow = cv2.rectangle(paintWindow,(275,1),(370,65),colors[1],-1) 35 | paintWindow = cv2.rectangle(paintWindow,(390,1),(485,65),colors[2],-1) 36 | paintWindow = cv2.rectangle(paintWindow,(505,1),(600,65),colors[3],-1) 37 | 38 | font = cv2.FONT_HERSHEY_SIMPLEX 39 | cv2.putText(paintWindow,"CLEAR ALL",(49,33),font,0.5,(0,0,0),2,cv2.LINE_AA) 40 | cv2.putText(paintWindow,"BLUE",(185,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 41 | cv2.putText(paintWindow,"GREEN",(298,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 42 | cv2.putText(paintWindow,"RED",(420,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 43 | cv2.putText(paintWindow,"YELLOW",(520,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 44 | 45 | cv2.namedWindow("Paint") 46 | 47 | 48 | while 1: 49 | ret,frame = cap.read() 50 | frame = cv2.flip(frame,1) 51 | hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) 52 | 53 | frame = cv2.rectangle(frame,(40,1),(140,65),(0,0,0),2) 54 | frame = cv2.rectangle(frame,(160,1),(255,65),colors[0],-1) 55 | frame = cv2.rectangle(frame,(275,1),(370,65),colors[1],-1) 56 | frame = cv2.rectangle(frame,(390,1),(485,65),colors[2],-1) 57 | frame = cv2.rectangle(frame,(505,1),(600,65),colors[3],-1) 58 | 59 | font = cv2.FONT_HERSHEY_SIMPLEX 60 | cv2.putText(frame,"CLEAR ALL",(49,33),font,0.5,(0,0,0),2,cv2.LINE_AA) 61 | cv2.putText(frame,"BLUE",(185,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 62 | cv2.putText(frame,"GREEN",(298,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 63 | cv2.putText(frame,"RED",(420,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 64 | cv2.putText(frame,"YELLOW",(520,33),font,0.5,(255,255,255),2,cv2.LINE_AA) 65 | 66 | if ret is False: 67 | break 68 | 69 | mask = cv2.inRange(hsv,lower_blue,upper_blue) 70 | 71 | mask = cv2.erode(mask,(5,5),iterations =2) 72 | mask = cv2.morphologyEx(mask,cv2.MORPH_OPEN,(5,5)) 73 | mask = cv2.dilate(mask,(5,5),iterations = 1) 74 | 75 | contours,_ =cv2.findContours(mask,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) 76 | center = None 77 | 78 | if len(contours) > 0: 79 | max_contours = sorted(contours, key = cv2.contourArea, reverse=True)[0] 80 | ((x,y),radius) = cv2.minEnclosingCircle(max_contours) 81 | cv2.circle(frame,(int(x),int(y)),int(radius),(255,255,0),3) 82 | 83 | M = cv2.moments(max_contours) 84 | center = (int(M["m10"]/M["m00"]),int(M["m01"]/M["m00"])) 85 | 86 | if center[1] <= 65: 87 | if 40<=center[0]<=140: 88 | 89 | blue_points = [deque(maxlen=512)] 90 | green_points = [deque(maxlen=512)] 91 | red_points = [deque(maxlen=512)] 92 | yellow_points = [deque(maxlen=512)] 93 | 94 | blue_index=0 95 | green_index=0 96 | red_index=0 97 | yellow_index=0 98 | 99 | paintWindow[67:,:,:]=255 100 | 101 | elif 160<=center[0]<=255: 102 | color_index = 0 103 | 104 | elif 275<=center[0]<=370: 105 | color_index = 1 106 | 107 | elif 390<=center[0]<=485: 108 | color_index = 2 109 | 110 | elif 505<=center[0]<=600: 111 | color_index = 3 112 | 113 | else: 114 | if color_index == 0: 115 | blue_points[blue_index].appendleft(center) 116 | 117 | elif color_index == 1: 118 | green_points[green_index].appendleft(center) 119 | 120 | elif color_index == 2: 121 | red_points[red_index].appendleft(center) 122 | 123 | elif color_index == 3: 124 | yellow_points[yellow_index].appendleft(center) 125 | 126 | else: 127 | blue_points.append(deque(maxlen=512)) 128 | blue_index+=1 129 | 130 | green_points.append(deque(maxlen=512)) 131 | green_index+=1 132 | 133 | red_points.append(deque(maxlen=512)) 134 | red_index+=1 135 | 136 | yellow_points.append(deque(maxlen=512)) 137 | yellow_index+=1 138 | 139 | points = [blue_points,green_points,red_points,yellow_points] 140 | 141 | for i in range(len(points)): 142 | for j in range(len(points[i])): 143 | for k in range(1,len(points[i][j])): 144 | if points[i][j][k-1] is None or points[i][j][k] is None: 145 | continue 146 | 147 | cv2.line(frame,points[i][j][k-1], points[i][j][k], colors[i], 2) 148 | cv2.line(paintWindow,points[i][j][k-1], points[i][j][k], colors[i], 2) 149 | 150 | 151 | cv2.imshow("Frame",frame) 152 | cv2.imshow("Paint",paintWindow) 153 | 154 | if cv2.waitKey(3) & 0xFF == ord('q'): 155 | break 156 | 157 | cap.release() 158 | cv2.destroyAllWindows() 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /Ek_Uygulamalar/ReadMe.md: -------------------------------------------------------------------------------- 1 | ### *Uygulamalarda kullanılan fotoğraflar, resimler, videolar; 'media' klasörü içinde bulunuyor. 2 | ### *Uygulamaya uygun medyayı kodun bulunduğu dizine indirip, o şekilde çalıştırınız. 3 | -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/batman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/batman.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/bilateral_noise.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/bilateral_noise.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/bitwise1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/bitwise1.png -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/bitwise2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/bitwise2.png -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/kose_algila.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/kose_algila.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/line.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/line.mp4 -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/median_noise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/median_noise.png -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/test.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/test1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/test1.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/threshold.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/threshold.jpg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/toplar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/toplar.jpeg -------------------------------------------------------------------------------- /Ek_Uygulamalar/media/ucgen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/Ek_Uygulamalar/media/ucgen.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ömer Faruk Kocadayı 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### *Uygulamalarda kullanılan fotoğraflar, resimler, videolar; 'media' klasörü içinde bulunuyor. 2 | ### *Uygulamaya uygun medyayı kodun bulunduğu dizine indirip, o şekilde çalıştırınız. 3 | 4 | Giriş Seviyesinden İleri Seviyeye Kadar Python ile Görüntü İşleme.. 5 | Ek_Uygulamalar klasöründe de bolca örnek uygulama bulunmakta. 6 | Göz atmanızı tavsiye ederim. 7 | 8 | Giriş Seviyesi Örnekler : 01 - 02 ...... 08 9 | - Resim Açma - Resim Okuma - Resim Yazma 10 | - BGR ve Pixel Mantığı Uygulamaları 11 | - Resim Aynalama, Tekrarlama, Uzatma, Alan Seçme vs. 12 | - Ağırlıklı Toplama - Maskeleme - Aritmetik İşlemler 13 | - Görüntü Piramitleri 14 | - Line, Circle, Text 15 | 16 | Orta Seviye Örnekler : 17 | - Video Kameradan Anlık Görüntü Alma 18 | - Anlık Video Renk Uzayı Değiştirme / Gri Ton 19 | - HSV Kodu Bulma - Trackbar 20 | - Renk Ayırt Etme, Renk Filtreleme 21 | - Morfolojik Filtreleme 22 | - Arka Plan Filtreleme 23 | 24 | İleri Seviye Örnekler : 25 | - Kenar Tespit Algoritmaları (Laplacian, Sobel, Canny) 26 | - Hough Dönüşümleri 27 | - HSV ile Nesne İzi Sürme 28 | - İnsan Yüz, Göz, Beden Tespiti 29 | - Nesne Algılama, Nesne Takibi 30 | - Araba Algılama, Sayma, Plaka Okuma 31 | -------------------------------------------------------------------------------- /media/05_600x400.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/05_600x400.jpg -------------------------------------------------------------------------------- /media/05_600x400_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/05_600x400_2.jpg -------------------------------------------------------------------------------- /media/06_batman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/06_batman.jpg -------------------------------------------------------------------------------- /media/06_zongi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/06_zongi.jpg -------------------------------------------------------------------------------- /media/body.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/body.jpg -------------------------------------------------------------------------------- /media/body.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/body.mp4 -------------------------------------------------------------------------------- /media/car.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/car.jpg -------------------------------------------------------------------------------- /media/car1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/car1.jpeg -------------------------------------------------------------------------------- /media/cars.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/cars.mp4 -------------------------------------------------------------------------------- /media/closing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/closing.png -------------------------------------------------------------------------------- /media/dog.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/dog.mp4 -------------------------------------------------------------------------------- /media/face.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/face.jpg -------------------------------------------------------------------------------- /media/gozler.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/gozler.mp4 -------------------------------------------------------------------------------- /media/h_line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/h_line.png -------------------------------------------------------------------------------- /media/klavye.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/klavye.jpg -------------------------------------------------------------------------------- /media/license_plate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/license_plate.jpg -------------------------------------------------------------------------------- /media/line.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/line.mp4 -------------------------------------------------------------------------------- /media/morph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/morph.png -------------------------------------------------------------------------------- /media/opening.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/opening.png -------------------------------------------------------------------------------- /media/smile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerkocadayi/Python_Goruntu_Isleme/4a13d2b2343a51b3af292996d0c6884a102503a9/media/smile.jpeg --------------------------------------------------------------------------------