Differences between revisions 7 and 8
Revision 7 as of 2008-04-26 21:31:56
Size: 2101
Editor: anonymous
Comment:
Revision 8 as of 2008-04-27 16:21:18
Size: 559
Editor: anonymous
Comment:
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:
Jähne 10.4, p 288

{{attachment:affine_transform_orig.png}} {{attachment:affine_transform.png}}

{{{#!python
from scipy import *
from scipy.ndimage import *
from pylab import *
from scipy import linalg


def mapping_func((y,x)): # Uebergabe der Koordinaten als Tupel
        v0=array([y,x,1]).transpose()
        v1=dot(A,v0) # globale Variable A ist im Hauptprogramm deklariert
        return (v1[0],v1[1])

def display(B,n,t,y00,x00,y01,x01,y02,x02):
        figure(n)
        imshow(B,origin='lower',interpolation='nearest')
        text(y00,x00,'y0,x0')
        text(y01,x01,'y1,x1')
        text(y02,x02,'y2,x2')
        title(t)
        colorbar()
        show()


Y,X=512,512
B0=zeros((Y,X),float)

# Punkte im Originalbild
y00,x00,y01,x01,y02,x02=200,200,200,300,300,300
# Punkte im transformierten Bild
y10,x10,y11,x11,y12,x12=200,200,100,250,500,400
B0[y00:y02,x00:x02]=1 # Rechteck mit eins gefuellt
sigma=1
B0=gaussian_filter(B0,sigma) # Simuliere Aufnahmevorgang (Verunschaerfen)

close('all')
display(B0,1,'Original',y00,x00,y01,x01,y02,x02)

P0=array([[x00, x01, x02],[y00,y01,y02],[1.0,1.0,1.0]])
P1=array([[x10, x11, x12],[y10,y11,y12],[1.0,1.0,1.0]])

# Berechne Transformationsmatrix
A=dot(P1,linalg.inv(P0))


A=linalg.inv(A)
# Hier wird die Inverse von A berechnet,
# da geometric_transform "rueckwaerts" definiert ist


B1=geometric_transform(B0,mapping_func,prefilter=True,order=3,output_shape=(700,700))
display(B1,2,'Transformiert',y10,x10,y11,x11,y12,x12)}}}

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

Multiscale representation

Edge detection

Texture

Segmentation

Inverse filtering

Morphology

Shape

Classification

LehreWiki: SiaProgrammingPythonImageProc (last edited 2008-06-30 09:06:50 by anonymous)