23 __all__ = [
"noDistort",
"linearXDistort",
"quadraticDistortX",
24 "cubicDistortX",
"manyTermX",
"crossTerms1",
25 "crossTerms2",
"crossTerms3",
"quadraticDistort",
26 "T2DistortX",
"T2DistortX"]
35 """Do no distortion. Used for sanity checking""" 37 out = src.table.copyRecord(src)
42 """Increase the x value in a Source object by frac. E.g 43 src.x = 1000 --> 1001 if frac=.001 47 frac How much to change X by 50 A deep copy of src, with the value of x changed 53 out = src.table.copyRecord(src)
54 out.set(out.table.getCentroidKey().getX(), out.getX()*(1+frac))
59 """Distort image by terms with power <=2 60 i.e y, y^2, x, xy, x^2 63 out = src.table.copyRecord(src)
68 out.set(out.table.getCentroidKey().getX(), x + val*frac)
69 out.set(out.table.getCentroidKey().getY(), y)
74 """Distort image by terms with power <=2 75 i.e y, y^2, x, xy, x^2 78 out = src.table.copyRecord(src)
83 out.set(out.table.getCentroidKey().getX(), x + val*frac)
84 out.set(out.table.getCentroidKey().getY(), y)
89 out = src.table.copyRecord(src)
92 val = x**3 - 2*x**2 + 4*x - 9
94 out.set(out.table.getCentroidKey().getX(), x + val*frac)
95 out.set(out.table.getCentroidKey().getY(), y)
100 """Increase the y value in a Source object by frac. E.g 101 src.x = 1000 --> 1001 if frac=.001 105 frac How much to change Y by 108 A deep copy of src, with the value of y changed 111 out = src.table.copyRecord(src)
112 out.set(out.table.getCentroidKey().getY(), out.getY()*(1+frac))
117 """Distort image by terms with power <=2 118 i.e y, y^2, x, xy, x^2 121 out = src.table.copyRecord(src)
126 out.set(out.table.getCentroidKey().getX(), x)
127 out.set(out.table.getCentroidKey().getY(), y + val*frac)
132 """Distort image by terms with power <=2 133 i.e y, y^2, x, xy, x^2 136 out = src.table.copyRecord(src)
141 out.set(out.table.getCentroidKey().getX(), x)
142 out.set(out.table.getCentroidKey().getY(), y + val*frac)
147 out = src.table.copyRecord(src)
150 val = y**3 - 2*y**2 + 4*y - 9
152 out.set(out.table.getCentroidKey().getX(), x)
153 out.set(out.table.getCentroidKey().getY(), y + val*frac)
158 out = src.table.copyRecord(src)
163 out.set(out.table.getCentroidKey().getX(), x)
164 out.set(out.table.getCentroidKey().getY(), y + val*frac)
169 out = src.table.copyRecord(src)
172 val = y**3 - 2*y**2 + 4*y - 9
174 out.set(out.table.getCentroidKey().getX(), x + val*frac)
175 out.set(out.table.getCentroidKey().getY(), y)
180 out = src.table.copyRecord(src)
183 valx = x**3 - 2*x**2 + 4*x - 9
184 valy = y**3 - 2*y**2 + 4*y - 9
186 out.set(out.table.getCentroidKey().getX(), x + valy*frac)
187 out.set(out.table.getCentroidKey().getY(), y + valx*frac)
192 """Distort image by terms with power <=2 193 i.e y, y^2, x, xy, x^2 196 out = src.table.copyRecord(src)
203 out.set(out.table.getCentroidKey().getX(), x + val*frac)
204 out.set(out.table.getCentroidKey().getY(), y)
209 """Distort image by a 2nd order Cheby polynomial""" 211 out = src.table.copyRecord(src)
214 out.set(out.table.getCentroidKey().getX(), x + frac*val)
219 """Create a copy of srcList, and apply function to distort the 223 srcList a SourceSet object 224 function: A function that does a deep copy of a single Source 230 out.append(function(src))
233 for i
in range(len(srcList)):
237 x1, y1 = s.getX(), s.getY()
238 x2, y2 = o.getX(), o.getY()
240 diff = math.hypot(x1-x2, y1-y2)
241 maxDiff = max(diff, maxDiff)
243 print(
"Max deviation is %e pixels" % (maxDiff))
def quadraticDistort(src, frac=1e-6)
def crossTerms3(src, frac=1e-9)
def manyTermX(src, frac=1e-9)
def manyTermY(src, frac=1e-9)
def cubicDistortY(src, frac=1e-9)
def cubicDistortX(src, frac=1e-9)
def crossTerms2(src, frac=1e-11)
def T2DistortX(src, frac=1e-6)
def linearXDistort(src, frac=.001)
def quadraticDistortX(src, frac=1e-6)
def quadraticDistortY(src, frac=1e-6)
def linearYDistort(src, frac=.001)
def crossTerms1(src, frac=1e-11)
def distortList(srcList, function)