00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <math.h>
00027 #include <limits.h>
00028 #include "image.h"
00029 #include "proto2D.h"
00030 #include "radar.h"
00031
00032
00050 int main(int argc, char *argv[]){
00051
00052
00053 select_ima_t *pt_sel;
00054 save_ima_t *pt_sav;
00055 logdct_t ld;
00056
00057
00058 param par0, *ptp;
00059 int n, N, n0, j, lectOK;
00060
00061
00062 imau2 *pt_im0;
00063 imafl *pt_imres;
00064
00065
00066
00067 param_debut(argc, argv, &par0);
00068 ptp = &par0;
00069
00070 ptp = logdct_lect(&ld, ptp, "Passage en additif (log) et frequentiel (DCT) : ");
00071 N = ld.N;
00072
00073
00074 if( (pt_sel = (select_ima_t *)malloc(N*sizeof(select_ima_t))) == NULL ){
00075 printf("\n>>mlogdct_u2: ERREUR allocation tableau descripteurs impossible\n");
00076 exit(1);
00077 }
00078 if( (pt_sav = (save_ima_t *)malloc(N*sizeof(save_ima_t))) == NULL ){
00079 printf("\n>>mlogdct_u2: ERREUR allocation tableau descripteurs impossible\n");
00080 exit(1);
00081 }
00082
00083 ptp = select_ima_lect(pt_sel, ptp, "premiere image initiale (u2) :");
00084 ptp = save_ima_lect(pt_sav, ptp, "premiere image resultat (fl) :");
00085
00086 param_fin(argc, argv, &par0);
00087
00088 for(n=1; n<N; n++){
00089 pt_sel[n] = pt_sel[0];
00090 nom_image_suivante( pt_sel[n-1].nom, pt_sel[n].nom);
00091 pt_sav[n] = pt_sav[0];
00092 nom_image_suivante( pt_sav[n-1].nom, pt_sav[n].nom);
00093 }
00094
00095
00096
00097
00098 if( (pt_im0 = (imau2 *)malloc(N*sizeof(imau2))) == NULL ){
00099 printf ("\n>>mlogdct_u2: ERREUR allocation tableau image impossible\n");
00100 exit(1);
00101 }
00102 if( (pt_imres = (imafl *)malloc(N*sizeof(imafl))) == NULL ){
00103 printf ("\n>>mlogdct_u2: ERREUR allocation tableau image impossible\n");
00104 exit(1);
00105 }
00106
00107
00108 for(n=0; n<N; n++){
00109 select_imau2_init(pt_sel+n , pt_im0+n);
00110 save_ima_init(pt_sav+n);
00111 }
00112 logdct_u2_init(&ld, pt_im0, pt_imres);
00113
00114
00115
00116 lectOK = 1;
00117 while( (select_imau2_calc(pt_sel, pt_im0)==0) && (lectOK==1)){
00118 for(n=1; n<N; n++)
00119 if(select_imau2_calc(pt_sel+n, pt_im0+n)){
00120 lectOK = 0;
00121 break;
00122 }
00123 if( lectOK == 0 ){
00124 printf("\n Pb lecture image %s : fin prematuree\n", pt_sel[n].nom);
00125 break;
00126 }
00127 logdct_u2_calc(&ld, pt_im0, pt_imres);
00128 for(n=0; n<N; n++)
00129 save_imafl_calc(pt_sav+n, pt_imres[n]);
00130 }
00131
00132
00133
00134
00135 for(n=0; n<N; n++)
00136 save_ima_ferm(pt_sel[N-1], pt_sav[n]);
00137
00138 }
00139
00140
00141