
224 Image Enhancement and Correction
Listing 5.15 : Image–image registratio n with the similarity transform.
1 #!/ usr / bin / env pytho n
2 # Name : ex5_5 .py
3 IMPO RT auxil . auxil as a uxil
4 IMPO RT os
5 FROM num py IMPORT *
6 FROM osg eo IMPORT gdal
7 FROM sci py IMPORT nd image
8 FROM osg eo . g dalconst IMPORT GA_Re adOnly , GDT_ Byte
9
10 DEF parse_gcp ( gcpf ile ):
11 with OPEN ( gcp file ) as f :
12 pts = []
13 FOR i IN RA NGE (6):
14 line = f. readli ne ()
15 WHILE line :
16 pts . appen d ( MAP ( EVAL , line . spl it ()))
17 line = f . re adline ()
18 f. close ()
19 pts = arr ay ( pts )
20 RETU RN ( pts [: ,:2] , pts [: ,2:])
21
22 DEF main ():
23 gda