mlee_add.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 */
00034 #include "image.h"
00035 #include "proto2D.h"
00036 #include "radar.h"
00037 /* #include "radar_comp.h" */
00038 
00039 int main(int argc, char *argv[]){
00040   /* images */ 
00041   imau1 im0u1, moyampu1;
00042   imau2 im0u2, moyampu2;
00043   imafl im0fl, moyampfl, moycarre;
00044           
00045   /* operateurs */
00046   read_ima_t  rea;
00047   moy2D_t     moy;
00048   moycarre2D_t  moycar;
00049   lee_add_t      lee_add;
00050   write_ima_t wri;
00051 
00052  /* main : variables et parametres propres au main*/
00053   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00054   int t0;
00055 
00056 
00057 /* LECTURE PARAMETRES */
00058   param_debut(argc, argv, &par0); 
00059   ptp = &par0;
00060   ptp = read_ima_lect(&rea, ptp, "Image initiale (u1|u2|fl) :");
00061   ptp = write_ima_lect(&wri, ptp, "Image resultat (meme type) :");
00062   ptp = lee_add_lect(&lee_add, ptp, "Filtre spatial, bruit additif (Lee_Add) :");
00063   moy.dimX = lee_add.dimX; moy.dimY = lee_add.dimY;       /* operateur moy2D      */
00064   moycar.dimX = lee_add.dimX; moycar.dimY = lee_add.dimY; /* operateur moycarre2D */
00065 
00066   param_fin(argc, argv, &par0);
00067 
00068 
00069 /* INITIALISATION  */
00070   if( !strcmp(rea.ext, "ima") || !strcmp(rea.ext, "ras")){
00071       t0 = 1;
00072       read_imau1_init(&rea, &im0u1);  
00073       moy2Du1_init(&moy, im0u1, &moyampu1);
00074       moycarre2Du1_init(&moycar, im0u1, &moycarre);
00075   }
00076   else if(!strcmp(rea.ext, "imw")){
00077       t0 = 2;
00078       read_imau2_init(&rea, &im0u2);
00079       moy2Du2_init(&moy, im0u2, &moyampu2);
00080       moycarre2Du2_init(&moycar, im0u2, &moycarre);
00081   }
00082   else if(!strcmp(rea.ext, "imf")){
00083       t0 = 4;
00084       read_imafl_init(&rea, &im0fl);
00085       moy2Dfl_init(&moy, im0fl, &moyampfl);
00086       moycarre2Dfl_init(&moycar, im0fl, &moycarre);
00087   }
00088   else{
00089       printf("\nextension %s inconnue\n", rea.ext);
00090       exit(0);
00091   }      
00092   /*   lee_addfl_init(&lee_add, im0, &imres);  inutil, resultat dans image initiale */
00093   write_ima_init(&wri);
00094 
00095 
00096 /* CALCUL */
00097   switch(t0){
00098   case 1 :      
00099       moy2Du1_calc(&moy, im0u1, &moyampu1);
00100       moycarre2Du1_calc(&moycar, im0u1, &moycarre);
00101       lee_addu1_calc(&lee_add, im0u1, moyampu1, moycarre, &im0u1);
00102       break;
00103   case 2 :
00104       moy2Du2_calc(&moy, im0u2, &moyampu2);
00105       moycarre2Du2_calc(&moycar, im0u2, &moycarre);
00106       lee_addu2_calc(&lee_add, im0u2, moyampu2, moycarre, &im0u2);
00107       break;
00108   case 4 :
00109       moy2Dfl_calc(&moy, im0fl, &moyampfl);
00110       moycarre2Dfl_calc(&moycar, im0fl, &moycarre);
00111       lee_addfl_calc(&lee_add, im0fl, moyampfl, moycarre, &im0fl);
00112       break;
00113   }
00114 
00115 
00116 /* FREMETURE */
00117   switch(t0){
00118   case 1 :      
00119       write_imau1_ferm(&wri, im0u1);
00120       break;
00121   case 2 :      
00122       write_imau2_ferm(&wri, im0u2);
00123       break;
00124   case 4 :      
00125       write_imafl_ferm(&wri, im0fl);
00126       break;
00127   }
00128 }
00129 
00130 
00131 

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