| 116 | | #if 0 |
| 117 | | /* This function is no longer requires -- to be removed */ |
| 118 | | |
| 119 | | static MagickBooleanType SolveAffineDistortion( |
| 120 | | const unsigned long number_points,const PointInfo *points,double **matrix, |
| 121 | | double *vector) |
| 122 | | { |
| 123 | | /* |
| 124 | | Given the transformations of the coordinates for two triangles |
| 125 | | u0,v0, x0,y0, u1,v1, x1,y1, u2,v2, x2,y2, ... |
| 126 | | |
| 127 | | Solve for the 6 cofficients c0..c6 for a affine distortion: |
| 128 | | u = c0*x + c2*y + c4 |
| 129 | | v = c1*x + c3*y + c5 |
| 130 | | */ |
| 131 | | register int |
| 132 | | i; |
| 133 | | double |
| 134 | | x,y,u,v; |
| 135 | | if (number_points < 6) |
| 136 | | return(MagickFalse); |
| 137 | | for( i = 0; i < 6; ) { |
| 138 | | u = points[i].x; |
| 139 | | v = points[i].y; |
| 140 | | x = points[i+1].x; |
| 141 | | y = points[i+1].y; |
| 142 | | |
| 143 | | vector[i]=u; |
| 144 | | matrix[i][0]=x; |
| 145 | | matrix[i][2]=y; |
| 146 | | matrix[i][4]=1.0; |
| 147 | | i++; |
| 148 | | |
| 149 | | vector[i]=v; |
| 150 | | matrix[i][1]=x; |
| 151 | | matrix[i][3]=y; |
| 152 | | matrix[i][5]=1.0; |
| 153 | | i++; |
| 154 | | } |
| 155 | | return(GaussJordanElimination(matrix,&vector,6UL,1UL)); |
| 156 | | } |
| 157 | | #endif |
| 158 | | |
| 172 | | #if 0 |
| 173 | | /* This function is no longer requires -- to be removed */ |
| 174 | | |
| 175 | | static MagickBooleanType SolveBilinearDistortion( |
| 176 | | const unsigned long number_points,const PointInfo *points,double **matrix, |
| 177 | | double *vector) |
| 178 | | { |
| 179 | | /* |
| 180 | | Given the transformations of the coordinates of two quadrilaterals: |
| 181 | | u0,v0, x0,y0, u1,v1, x1,y1, u2,v2, x2,y2, ... |
| 182 | | |
| 183 | | Solve for the 8 coeffecients c0..c7 for a bilinear distortion: |
| 184 | | u = c0*x + c1*y + c2*x*y + c3 |
| 185 | | v = c4*x + c5*y + c6*x*y + c7 |
| 186 | | */ |
| 187 | | register int |
| 188 | | i; |
| 189 | | double |
| 190 | | x,y,u,v; |
| 191 | | if (number_points < 8) |
| 192 | | return(MagickFalse); |
| 193 | | for( i = 0; i < 8; ) { |
| 194 | | u = points[i].x; |
| 195 | | v = points[i].y; |
| 196 | | x = points[i+1].x; |
| 197 | | y = points[i+1].y; |
| 198 | | |
| 199 | | vector[i]=u; |
| 200 | | matrix[i][0]=x; |
| 201 | | matrix[i][1]=y; |
| 202 | | matrix[i][2]=x*y; |
| 203 | | matrix[i][3]=1.0; |
| 204 | | i++; |
| 205 | | |
| 206 | | vector[i]=v; |
| 207 | | matrix[i][4]=x; |
| 208 | | matrix[i][5]=y; |
| 209 | | matrix[i][6]=x*y; |
| 210 | | matrix[i][7]=1.0; |
| 211 | | i++; |
| 212 | | } |
| 213 | | return(GaussJordanElimination(matrix,&vector,8UL,1UL)); |
| 214 | | } |
| 215 | | |
| 216 | | static MagickBooleanType SolvePerspectiveDistortion( |
| 217 | | const unsigned long number_points,const PointInfo *points,double **matrix, |
| 218 | | double *vector) |
| 219 | | { |
| 220 | | /* |
| 221 | | Given the coordinates of two quadrilaterals: |
| 222 | | u0,v0, x0,y0, u1,v1, x1,y1, u2,v2, x2,y2, ... |
| 223 | | |
| 224 | | Solve for the 8 coefficients c0..c7 for a perspective distortion: |
| 225 | | u = ( c0*x + c1*y + c2 ) / ( c6*x + c7*y + 1 ) |
| 226 | | v = ( c3*x + c4*y + c5 ) / ( c6*x + c7*y + 1 ) |
| 227 | | */ |
| 228 | | register int |
| 229 | | i; |
| 230 | | double |
| 231 | | x,y,u,v; |
| 232 | | if (number_points < 8) |
| 233 | | return(MagickFalse); |
| 234 | | for( i = 0; i < 8; ) { |
| 235 | | u = points[i].x; |
| 236 | | v = points[i].y; |
| 237 | | x = points[i+1].x; |
| 238 | | y = points[i+1].y; |
| 239 | | |
| 240 | | vector[i]=u; |
| 241 | | matrix[i][0]=x; |
| 242 | | matrix[i][1]=y; |
| 243 | | matrix[i][2]=1.0; |
| 244 | | matrix[i][6]=-x*u; |
| 245 | | matrix[i][7]=-y*u; |
| 246 | | i++; |
| 247 | | |
| 248 | | vector[i]=v; |
| 249 | | matrix[i][3]=x; |
| 250 | | matrix[i][4]=y; |
| 251 | | matrix[i][5]=1.0; |
| 252 | | matrix[i][6]=-x*v; |
| 253 | | matrix[i][7]=-y*v; |
| 254 | | i++; |
| 255 | | } |
| 256 | | return(GaussJordanElimination(matrix,&vector,8UL,1UL)); |
| 257 | | } |
| 258 | | #endif |