Revision 19139 trunk/extensions/extGeoreferencing/src-test/org/gvsig/georeferencing/TestGeoTransformProcess.java
TestGeoTransformProcess.java | ||
---|---|---|
52 | 52 |
|
53 | 53 |
/** |
54 | 54 |
* Test para el proceso de transformacion. |
55 |
* |
|
56 |
* El test prueba transformaciones de orden uno, dos y tres, calculadas a partir de una lista |
|
57 |
* de diez puntos.Los resultados de la transformacion para el caso de orden uno se comparan con |
|
58 |
* resultados precalculados en ENVI.Para el caso de las transformaciones de orden dos y tres se |
|
59 |
* comparan con los resultados efectuados de forma manual. |
|
60 |
* |
|
55 | 61 |
* @author Alejandro Mu?oz Sanchez |
56 | 62 |
* |
57 | 63 |
* */ |
... | ... | |
61 | 67 |
private GeoPoint gpcs[] = new GeoPoint[10]; |
62 | 68 |
private GeoTransformDataResult transformData; |
63 | 69 |
|
64 |
private double geoPoints[][] ={{ 1369.000000 , 2985.750000 }, |
|
70 |
private double geoPoints[][] ={ { 1369.000000 , 2985.750000 },
|
|
65 | 71 |
{ 1673.500000 , 2803.250000 }, |
66 | 72 |
{ 2092.500000 , 2933.250000 }, |
67 | 73 |
{ 2354.000000 , 3211.000000 }, |
... | ... | |
83 | 89 |
{ 2044.000000 , 2663.750000 }, |
84 | 90 |
{ 1955.750000 , 2705.500000 }, |
85 | 91 |
{ 1893.500000 , 2596.250000},}; |
86 |
|
|
87 |
// Coeficientes para la transformacion de primer orden obtenidos con ENVI |
|
88 |
double coefXEnviOrder1[]={ -955.3397167621,0.8233466477, 0.1357233256}; |
|
89 |
double coefYEnviOrder1[]={ 158.2720831501,-0.1364623550, 0.8223639261}; |
|
90 | 92 |
|
91 |
|
|
92 |
// Calculo manual coeficientes polinomio orden 2 |
|
93 |
double coefXOrder2[]={}; |
|
94 |
double coefYOrder2[]={}; |
|
95 |
|
|
96 |
|
|
97 |
// Calculo manual coeficientes polinomio orden 3 |
|
98 |
double coefXOrder3[]={}; |
|
99 |
double coefYOrder3[]={}; |
|
100 |
|
|
101 |
|
|
102 | 93 |
public void start() { |
103 | 94 |
this.setUp(); |
104 | 95 |
this.testStack(); |
... | ... | |
108 | 99 |
public void setUp(){ |
109 | 100 |
} |
110 | 101 |
|
111 |
|
|
112 | 102 |
public void testStack(){ |
113 | 103 |
for(int i=0;i<geoPoints.length;i++) |
114 | 104 |
{ |
... | ... | |
117 | 107 |
gpcs[i]= new GeoPoint(pP,pW); |
118 | 108 |
} |
119 | 109 |
|
120 |
GeoTransformProcess transform = new GeoTransformProcess(); |
|
121 |
transform.addParam("gpcs",gpcs ); |
|
122 |
transform.addParam("orden",new Integer(2)); |
|
123 |
transform.run(); |
|
124 |
transformData= (GeoTransformDataResult)transform.getResult(); |
|
125 |
|
|
126 |
/*for(int i=0; i<transformData.getMapToPixelCoefX().length; i++){ |
|
127 |
assertEquals(coefXEnviOrder1[i],transformData.getMapToPixelCoefX()[i],0.5); |
|
128 |
assertEquals(coefYEnviOrder1[i],transformData.getMapToPixelCoefY()[i],0.5); |
|
129 |
}*/ |
|
130 |
|
|
131 | 110 |
GeoTransformProcess order2Transform = new GeoTransformProcess(); |
132 | 111 |
order2Transform.addParam("gpcs",gpcs ); |
133 | 112 |
order2Transform.addParam("orden",new Integer(2)); |
... | ... | |
135 | 114 |
transformData= (GeoTransformDataResult)order2Transform.getResult(); |
136 | 115 |
|
137 | 116 |
|
138 |
// Resolucion del sistema calculado manualmente
|
|
117 |
// Resolucion del sistema calculado manualmente
|
|
139 | 118 |
double data[][]={ |
140 | 119 |
{10, 15544.5, 24607.25, 26758589.88, 38703411.06 , 60795805.19 }, |
141 | 120 |
{15544.5, 26758589.88, 38703411.06, 48625448159.44, 67148886519.52, 96748134874.2 }, |
... | ... | |
145 | 124 |
{60795805.19, 96748134874.2, 150805605253.3, 1.69145826718794E014, 2.42781993510560E014, 3.7555377732236494E14} |
146 | 125 |
}; |
147 | 126 |
double[][] result={{25178.75},{42119706.94}, {62445537.63}, {75433589688.61}, {105416642600.75}, {155494570974.03} }; |
148 |
|
|
127 |
double[][] result2={{32168.25},{5.10484513125E07}, {7.9534535625E07}, {8.899835767423438E10}, {1.276577668393125E11}, {1.9743243258296875E11} }; |
|
128 |
|
|
129 |
|
|
130 |
// Resolucion del sistema calculado manualmente |
|
131 |
double data2[][]={ |
|
132 |
{10, 25178.75, 32168.25, 6.68261699375E7, 8.2157005375E7 , 1.041305340625E8 }, |
|
133 |
{25178.75, 6.68261699375E7, 8.2157005375E7, 1.8389906361945312E11, 2.2036071049725E11, 2.69580937964375E11 }, |
|
134 |
{32168.25, 8.2157005375E7, 1.041305340625E8, 2.2036071049725E11, 2.69580937964375E11, 3.391527268821094E11}, |
|
135 |
{6.68261699375E7, 1.8389906361945312E11, 2.2036071049725E11, 5.185110007030175E14, 6.109291412182252E14, 7.302233191555645E14}, |
|
136 |
{8.2157005375E7, 2.2036071049725E11, 2.69580937964375E11, 6.109291412182252E14, 7.302233191555645E14, 8.893696706241302E14}, |
|
137 |
{1.041305340625E8, 2.69580937964375E11, 3.391527268821094E11, 7.302233191555645E14, 8.893696706241302E14, 1.1112299175456508E15} |
|
138 |
}; |
|
139 |
|
|
140 |
double[][] result3={{24607.25},{6.2445537625E7}, {7.9534535625E7}, {1.6674342953621875E11}, {2.0468178349823438E11}, {2.5867104246403125E11} }; |
|
141 |
double[][] result4={{15544.5},{4.21197069375E7}, {5.10484513125E7}, {1.1748417342507812E11}, {1.3954105605085938E11}, {1.6852035242098438E11} }; |
|
142 |
|
|
143 |
|
|
149 | 144 |
Matrix matrix= new Matrix(data); |
145 |
Matrix matrix2= new Matrix(data2); |
|
146 |
|
|
150 | 147 |
Matrix coef=matrix.solve(new Matrix(result)); |
148 |
Matrix coef2= matrix.solve(new Matrix(result2)); |
|
149 |
Matrix coef3= matrix2.solve(new Matrix(result3)); |
|
150 |
Matrix coef4= matrix2.solve(new Matrix(result4)); |
|
151 | 151 |
|
152 |
|
|
152 |
|
|
153 | 153 |
for(int i=0; i<transformData.getPixelToMapCoefX().length; i++){ |
154 | 154 |
assertEquals(coef.get(i,0),transformData.getPixelToMapCoefX()[i],0.2); |
155 |
assertEquals(coef2.get(i,0),transformData.getPixelToMapCoefY()[i],0.2); |
|
156 |
assertEquals(coef3.get(i,0),transformData.getMapToPixelCoefY()[i],0.2); |
|
157 |
assertEquals(coef4.get(i,0),transformData.getMapToPixelCoefX()[i],0.2); |
|
155 | 158 |
} |
156 | 159 |
|
157 | 160 |
|
Also available in: Unified diff