mlogdct_u2.c

00001 /*
00002 *    Copyright (c) 2007. The BATI team. All right reserved.
00003 *
00004 *    This file is part of BATI library.
00005 *
00006 *    BATI library is free software: you can redistribute it and/or modify
00007 *    it under the terms of the GNU General Public License as published by
00008 *    the Free Software Foundation, either version 3 of the License, or
00009 *    (at your option) any later version.
00010 *
00011 *    BATI library  is distributed in the hope that it will be useful,
00012 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 *    GNU General Public License for more details.
00015 *
00016 *    You should have received a copy of the GNU General Public License
00017 *    along with BATI library.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 /* ************************** mlogdct_u2.c ********************************/
00020 /*                                                                        */
00021 /*       FILTRAGE MULTIDATE - PREMIERE ETAPE DU FILTRE DE DANIELA         */
00022 /*                   LOG PUIS DCT SUR AXE TEMPOREL                        */
00023 /*                                                                        */
00024 /*  Derniere modif : E. TROUVE, 10/09/2000                                */
00025 /* ************************************************************************/
00026 #include <math.h>
00027 #include <limits.h>
00028 #include "image.h"
00029 #include "proto2D.h"
00030 #include "radar.h"
00031 /* #include "radar_comp.h" */
00032 
00050 int main(int argc, char *argv[]){
00051 
00052   /* operateurs  */
00053   select_ima_t *pt_sel;
00054   save_ima_t *pt_sav;
00055   logdct_t ld;
00056 
00057   /* main  */
00058   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00059   int n, N, n0, j, lectOK;
00060   
00061   /* images */
00062   imau2 *pt_im0;   /* bloc images initiales */ 
00063   imafl *pt_imres; /* bloc images des coef de DCT */
00064 
00065 
00066 /* LECTURE PARAMETRES */
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   /* allocation des  tableaux de descripteurs */
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 /* INITIALISATION  */
00097   /* allocation des tableaux de bloc images  */
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   /* init lecture/ecriture */
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 /* CALCUL */
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 /* FREMETURE */
00135   for(n=0; n<N; n++)
00136       save_ima_ferm(pt_sel[N-1], pt_sav[n]);
00137 
00138 }
00139 
00140 
00141 

Generated on Tue Apr 22 13:31:04 2008 for ima2D by  doxygen 1.5.3