00001 /******************************************************* 00002 * 00003 * Author: Takeshi Mita, Shinsaku Hiura, Hirokazu Kato 00004 * 00005 * tmita@inolab.sys.es.osaka-u.ac.jp 00006 * shinsaku@sys.es.osaka-u.ac.jp 00007 * kato@sys.im.hiroshima-cu.ac.jp 00008 * 00009 * Revision: 4.1 00010 * Date: 01/12/07 00011 * 00012 *******************************************************/ 00013 00014 #include <stdio.h> 00015 #include <math.h> 00016 #include <AR/param.h> 00017 00018 00019 int arParamChangeSize( ARParam *source, int xsize, int ysize, ARParam *newparam ) 00020 { 00021 double scale; 00022 int i; 00023 00024 newparam->xsize = xsize; 00025 newparam->ysize = ysize; 00026 00027 scale = (double)xsize / (double)(source->xsize); 00028 for( i = 0; i < 4; i++ ) { 00029 newparam->mat[0][i] = source->mat[0][i] * scale; 00030 newparam->mat[1][i] = source->mat[1][i] * scale; 00031 newparam->mat[2][i] = source->mat[2][i]; 00032 } 00033 00034 newparam->dist_factor[0] = source->dist_factor[0] * scale; 00035 newparam->dist_factor[1] = source->dist_factor[1] * scale; 00036 newparam->dist_factor[2] = source->dist_factor[2] / (scale*scale); 00037 newparam->dist_factor[3] = source->dist_factor[3]; 00038 00039 return 0; 00040 } 00041 00042 int arsParamChangeSize( ARSParam *source, int xsize, int ysize, ARSParam *newparam ) 00043 { 00044 double scale; 00045 int i; 00046 00047 newparam->xsize = xsize; 00048 newparam->ysize = ysize; 00049 00050 scale = (double)xsize / (double)(source->xsize); 00051 for( i = 0; i < 4; i++ ) { 00052 newparam->matL[0][i] = source->matL[0][i] * scale; 00053 newparam->matL[1][i] = source->matL[1][i] * scale; 00054 newparam->matL[2][i] = source->matL[2][i]; 00055 } 00056 for( i = 0; i < 4; i++ ) { 00057 newparam->matR[0][i] = source->matR[0][i] * scale; 00058 newparam->matR[1][i] = source->matR[1][i] * scale; 00059 newparam->matR[2][i] = source->matR[2][i]; 00060 } 00061 for( i = 0; i < 4; i++ ) { 00062 newparam->matL2R[0][i] = source->matL2R[0][i]; 00063 newparam->matL2R[1][i] = source->matL2R[1][i]; 00064 newparam->matL2R[2][i] = source->matL2R[2][i]; 00065 } 00066 00067 newparam->dist_factorL[0] = source->dist_factorL[0] * scale; 00068 newparam->dist_factorL[1] = source->dist_factorL[1] * scale; 00069 newparam->dist_factorL[2] = source->dist_factorL[2] / (scale*scale); 00070 newparam->dist_factorL[3] = source->dist_factorL[3]; 00071 00072 newparam->dist_factorR[0] = source->dist_factorR[0] * scale; 00073 newparam->dist_factorR[1] = source->dist_factorR[1] * scale; 00074 newparam->dist_factorR[2] = source->dist_factorR[2] / (scale*scale); 00075 newparam->dist_factorR[3] = source->dist_factorR[3]; 00076 00077 return 0; 00078 }