Revision 18389 trunk/extensions/extRemoteSensing/src/org/gvsig/remotesensing/georeferencing/geotransform/GeoTransformProcess.java
GeoTransformProcess.java | ||
---|---|---|
84 | 84 |
// Lista con los valores de las potencias de x e y |
85 | 85 |
private int exp[][] = null; |
86 | 86 |
|
87 |
// error de la funcion en x
|
|
87 |
// vector con error de la funcion en x para cada punto
|
|
88 | 88 |
private double[] xError= null; |
89 | 89 |
|
90 |
// error de la funcion para las y
|
|
90 |
//vector con el error de la funcion en y para cada punto
|
|
91 | 91 |
private double [] yError=null; |
92 | 92 |
|
93 |
// rms |
|
93 |
// rms vector con los rms para cada punto
|
|
94 | 94 |
private double rms[]=null; |
95 | 95 |
|
96 |
// rms total en las x |
|
97 |
private double rmsXTotal=0; |
|
98 |
|
|
99 |
// rms total en las y |
|
100 |
private double rmsYTotal=0; |
|
101 |
|
|
102 |
// rms total |
|
103 |
private double rmsTotal=0; |
|
104 |
|
|
105 |
|
|
106 |
|
|
96 | 107 |
/** Metodo que recoge los parametros del proceso de clasificacion de |
97 | 108 |
* m?xima probabilidad |
98 | 109 |
* <LI>geo_points: lista de puntos con coordenadas reales</LI> |
... | ... | |
133 | 144 |
getPolinomialCoefY(); |
134 | 145 |
// calculo de los resultados |
135 | 146 |
getRMSerror(); |
136 |
} |
|
137 |
|
|
138 |
|
|
139 |
/** |
|
140 |
* @return coeficientes para el polinomio de transformaci?n en x. |
|
141 |
**/ |
|
142 |
public double[] getPolinomyalCoefX(){ |
|
143 |
if(coefX==null) |
|
144 |
setDxGeneral(); |
|
145 |
return coefX; |
|
146 |
} |
|
147 |
System.out.print(evaluate(1382,2893.5)); |
|
147 | 148 |
|
148 | 149 |
|
149 |
/** |
|
150 |
* @return coeficientes para el polinomio de transformaci?n en y. |
|
151 |
* */ |
|
152 |
public double[] getPolinomialCoefY(){ |
|
153 |
if(coefY==null) |
|
154 |
setDyGeneral(); |
|
155 |
return coefY; |
|
156 | 150 |
} |
157 |
|
|
158 | 151 |
|
159 |
/////////!!!!!!! Obtiene matriz general a partir de los puntos de control y el orden del polinomio aproximador |
|
160 |
public void setDxGeneral(){ |
|
152 |
|
|
153 |
/** |
|
154 |
* Calculo de los coeficientes del polinimio aproximador. |
|
155 |
* @return array con los coeficientes para las x. |
|
156 |
* |
|
157 |
* */ |
|
158 |
public double [] getPolinomyalCoefX(){ |
|
161 | 159 |
double matrixDx[][]= new double [minGPC][minGPC]; |
162 | 160 |
double result[]= new double[minGPC]; |
163 | 161 |
int exp[][]=new int[minGPC][2]; |
164 |
int k=-1; |
|
165 |
// Obtencion de la primera fila de la matriz |
|
166 |
|
|
162 |
int k=-1; |
|
167 | 163 |
for (int filas=0; filas<minGPC;filas++) |
168 | 164 |
{ k=-1; |
169 | 165 |
for (int i=0; i<=orden; i++) |
... | ... | |
182 | 178 |
result[k]+=(Math.pow(geo_points[v][0],i-j)* Math.pow(geo_points[v][0],exp[filas][0])) |
183 | 179 |
* (Math.pow(geo_points[v][1],j)* Math.pow(geo_points[v][1],exp[filas][1]))*image_points[v][0]; |
184 | 180 |
} |
185 |
|
|
186 | 181 |
} |
187 | 182 |
} |
188 | 183 |
Matrix matrixResult= new Matrix(matrixDx); |
189 | 184 |
coefX=solveSistem(matrixResult,result); |
185 |
return coefX; |
|
190 | 186 |
} |
191 | 187 |
|
192 | 188 |
|
193 | 189 |
// TO DO: Ver la manera de unificar con setDxGeneral(Parametrizar un metodo general)..... Estudiar optimizaciones!!! |
194 | 190 |
// Cambios necesarios para el caolculo de coeficientes para coordenadas y |
195 |
public void setDyGeneral(){ |
|
191 |
/** |
|
192 |
* Calculo de los coeficientes del polinimio aproximador. |
|
193 |
* @return array con los coeficientes para las x. |
|
194 |
* |
|
195 |
* */ |
|
196 |
public double[] getPolinomialCoefY(){ |
|
196 | 197 |
double matrixDy[][]= new double [minGPC][minGPC]; |
197 | 198 |
double result[]= new double[minGPC]; |
198 | 199 |
int k=-1; |
199 | 200 |
// Obtencion de la primera fila de la matriz |
200 |
|
|
201 | 201 |
for (int filas=0; filas<minGPC;filas++) |
202 | 202 |
{ k=-1; |
203 | 203 |
for (int i=0; i<=orden; i++) |
... | ... | |
216 | 216 |
result[k]+=(Math.pow(geo_points[v][0],i-j)* Math.pow(geo_points[v][0],exp[filas][0])) |
217 | 217 |
* (Math.pow(geo_points[v][1],j)* Math.pow(geo_points[v][1],exp[filas][1]))*image_points[v][1]; |
218 | 218 |
} |
219 |
|
|
220 | 219 |
} |
221 | 220 |
} |
222 | 221 |
Matrix matrixResult= new Matrix(matrixDy); |
223 | 222 |
coefY=solveSistem(matrixResult,result); |
223 |
return coefY; |
|
224 | 224 |
} |
225 | 225 |
|
226 | 226 |
/** |
... | ... | |
248 | 248 |
rms = new double [image_points.length]; |
249 | 249 |
xError= new double [image_points.length]; |
250 | 250 |
yError= new double[image_points.length]; |
251 |
double rmsxTotal=0; |
|
252 |
double rmsyTotal=0; |
|
253 |
double rmsTotal=0; |
|
251 | 254 |
for(int im_point=0; im_point<image_points.length;im_point++){ |
252 | 255 |
|
253 | 256 |
for(int i=0; i<minGPC;i++) |
... | ... | |
258 | 261 |
} |
259 | 262 |
|
260 | 263 |
xError[im_point]= Math.pow(xEvaluate[im_point] -image_points[im_point][0], 2); |
264 |
rmsxTotal+= xError[im_point]; |
|
261 | 265 |
yError[im_point]= Math.pow(yEvaluate[im_point] -image_points[im_point][1], 2); |
266 |
rmsyTotal+= yError[im_point]; |
|
262 | 267 |
rms[im_point]=Math.sqrt |
263 | 268 |
( |
264 | 269 |
xError[im_point]+ yError[im_point] |
265 | 270 |
); |
266 |
|
|
271 |
rmsTotal+=rms[im_point]; |
|
267 | 272 |
} |
268 |
|
|
273 |
|
|
274 |
rmsTotal= rmsTotal/image_points.length; |
|
275 |
rmsxTotal= rmsTotal/image_points.length; |
|
276 |
rmsyTotal= rmsyTotal/image_points.length; |
|
277 |
|
|
269 | 278 |
System.out.print("Base X\t\t"); |
270 | 279 |
System.out.print("Base Y\t\t"); |
271 | 280 |
System.out.print("WarpX\t\t"); |
... | ... | |
313 | 322 |
} |
314 | 323 |
|
315 | 324 |
|
325 |
/** |
|
326 |
* @return error total para la coordenada X |
|
327 |
* */ |
|
328 |
public double getRMSx(){ |
|
329 |
return rmsXTotal; |
|
330 |
|
|
331 |
} |
|
316 | 332 |
|
333 |
|
|
317 | 334 |
/** |
335 |
* @return error total para la coordenada y |
|
336 |
* */ |
|
337 |
public double getRMSy(){ |
|
338 |
return rmsYTotal; |
|
339 |
|
|
340 |
} |
|
341 |
|
|
342 |
|
|
343 |
/** |
|
344 |
* @return error total para la coordenada y |
|
345 |
* */ |
|
346 |
public double getRMSTotal(){ |
|
347 |
return rmsTotal; |
|
348 |
|
|
349 |
} |
|
350 |
|
|
351 |
|
|
352 |
/** |
|
318 | 353 |
* Funci?n que evalua el polinomio de transformaci?n para un punto especifico |
319 | 354 |
* @param x coordenada x del punto |
320 | 355 |
* @param y coordenada y del punto |
Also available in: Unified diff