Ders Çalışması - 19 Ekim

import matplotlib.pyplot as plt
import numpy as np
pwd
Out[2]: 'C:\\Users\\kübra'
ls *.jpg
Out[3]:
Volume in drive C has no label.
Volume Serial Number is 381C-9FAB
Directory of C:\Users\k�bra
26.10.2017  11:14             5.700 a1.jpg
img_1=plt.imread("test10.jpeg")
img_1.ndim
img_1.shape
Out[4]: (1536, 2730, 3)
img_2=img_1[1:768:2,1:1024:2]  #resim kırpma işlemi
img_2.ndim, img_2.shape
Out[7]: (384, 512, 3)
img_3=np.zeros((img_2.shape[0:2]))
img_3.shape
Out[8]: (384, 512)
img_4=np.zeros((img_2.shape[0:2]))
img_4.shape
Out[9]: (384, 512)
threshold=80
for i in range(img_2.shape[0]): #384
   for j in range(img_2.shape[1]): #512
       n=img_2[i,j,0]/3+img_2[i,j,1]/3+img_2[i,j,2]/3
       img_3[i,j]=n
       if n>threshold:
           img_4[i,j]=255
       else:
           img_4[i,j]=0
plt.subplot(1,3,1),plt.imshow(img_2)
plt.subplot(1,3,2),plt.imshow(img_3,plt.cm.gray)
plt.subplot(1,3,3),plt.imshow(img_4,plt.cm.binary)
plt.imshow(img_4,plt.cm.binary)
plt.show()

Yorumlar

Bu blogdaki popüler yayınlar

Python ile Görüntü İşleme Örnekleri

Git Nedir? - What is Git?

İlişkisel Veritabanı Modeli