This session provides a brief overview about SciPy image processing functions
Fourier transformation
Statistics
Convolution
Filter
Linear shift invariant
Ranking filter
Recursive filter
Sampling and interpolation
Jähne 10.4, p 288
1 from scipy import *
2 from scipy.ndimage import *
3 from pylab import *
4 from scipy import linalg
5
6
7 def mapping_func((y,x)): # Uebergabe der Koordinaten als Tupel
8 v0=array([y,x,1]).transpose()
9 v1=dot(A,v0) # globale Variable A ist im Hauptprogramm deklariert
10 return (v1[0],v1[1])
11
12 def display(B,n,t,y00,x00,y01,x01,y02,x02):
13 figure(n)
14 imshow(B,origin='lower',interpolation='nearest')
15 text(y00,x00,'y0,x0')
16 text(y01,x01,'y1,x1')
17 text(y02,x02,'y2,x2')
18 title(t)
19 colorbar()
20 show()
21
22
23 Y,X=512,512
24 B0=zeros((Y,X),float)
25
26 # Punkte im Originalbild
27 y00,x00,y01,x01,y02,x02=200,200,200,300,300,300
28 # Punkte im transformierten Bild
29 y10,x10,y11,x11,y12,x12=200,200,100,250,500,400
30 B0[y00:y02,x00:x02]=1 # Rechteck mit eins gefuellt
31 sigma=1
32 B0=gaussian_filter(B0,sigma) # Simuliere Aufnahmevorgang (Verunschaerfen)
33
34 close('all')
35 display(B0,1,'Original',y00,x00,y01,x01,y02,x02)
36
37 P0=array([[x00, x01, x02],[y00,y01,y02],[1.0,1.0,1.0]])
38 P1=array([[x10, x11, x12],[y10,y11,y12],[1.0,1.0,1.0]])
39
40 # Berechne Transformationsmatrix
41 A=dot(P1,linalg.inv(P0))
42
43
44 A=linalg.inv(A)
45 # Hier wird die Inverse von A berechnet,
46 # da geometric_transform "rueckwaerts" definiert ist
47
48
49 B1=geometric_transform(B0,mapping_func,prefilter=True,order=3,output_shape=(700,700))
50 display(B1,2,'Transformiert',y10,x10,y11,x11,y12,x12)
Multiscale representation
Edge detection
Texture
Segmentation
Inverse filtering
Morphology
Shape