Örnekler
import math def findDistance (x,y): return math . sqrt((x[ 0 ] - y[ 0 ]) **2+ (x[ 1 ] - y[ 1 ]) **2 ) d = findDistance([ 3 , 0 ],[ 0 , 4 ]) d _____________________ 5.0 ______________________ from scipy import ndimage from scipy import misc f = misc . face() import matplotlib.pyplot as plt plt . imshow(f) plt . show() f . ndim _______________________ 3 ______________________ f . shape _____________________ (768, 1024, 3) ________________ type (f) ____________________ numpy.ndarray f[:,:, 2 ] =0 plt . imshow(f) plt . show() f . shape ________________________ (768, 1024, 3) ___________________ type (f . shape) ________________________ tuple ___________________ im_size = f . shape im_size[ 0 ] ________________________ 768 __________________ center = [im_size[ 0 ] /2 ,im_size[ 1 ] /2 ] center _______________________ [384.0, 512.0] __________________ from scipy import ndimage from scipy import mis...