mkuan_fl.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 /* * XX = u1 | u2 | fl : executable filtre de Kuan.\\
00020 Moyenne ponderee entre la valeur de l'intensite du pixel et celle de la moyenne local en fonction 
00021 de la variance locale et de celle du bruit multiplicatif.\\
00022 ATTENTION : le filtrage est effectue sur les images ROS en intensite (module carre). 
00023 Les donnees lues sont supposees etre de l'amplitude (ex : PRI-ESA, fichiers .imw). 
00024 On commence donc par les elever au carre, on filtre et on reprend la racine carree.\\
00025 Entree : image de type XX = u1 | u2 | fl\\
00026 Sortie : image de meme type\\
00027 @name mkuan_XX
00028 @author E. Trouve
00029 @version 1.0 (21/03/2000)
00030 @see lkuan
00031 */
00032 
00033 #include <math.h>
00034 
00035 #include "image.h"
00036 #include "proto2D.h"
00037 #include "radar.h"
00038 
00039 int main(int argc, char *argv[]){
00040   /* images */ 
00041   imafl im0, moyint, moycarre;
00042 
00043   /* operateurs */
00044   read_ima_t  rea;
00045   moy2D_t     moy;
00046   moycarre2D_t  moycar;
00047   kuan_t      kuan;
00048   write_ima_t wri;
00049  
00050  /* main : variables et parametres propres au main*/
00051   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00052   int i, j;
00053  
00054 /* LECTURE PARAMETRES */
00055   param_debut(argc, argv, &par0); 
00056   ptp = &par0;
00057   ptp = read_ima_lect(&rea, ptp, ">> image initiale (fl) :");
00058   ptp = kuan_lect(&kuan, ptp, "Kuan :");
00059   moy.dimX = kuan.dimX; moycar.dimX = kuan.dimX;
00060   moy.dimY = kuan.dimY; moycar.dimY = kuan.dimY;
00061   ptp = write_ima_lect(&wri, ptp, ">> image resultat (fl) :");
00062   param_fin(argc, argv, &par0);
00063 
00064 /* INITIALISATION  */
00065   read_imafl_init(&rea, &im0);
00066   moy2Dfl_init(&moy, im0, &moyint);
00067   moycarre2Dfl_init(&moycar, im0, &moycarre);
00068   /* pas de kuanfl_init, calcul sur place */; 
00069   write_ima_init(&wri);
00070  
00071 /* CALCUL */
00072   /* passage en intensite */
00073   for(j=0; j<im0.nr; j++)
00074       for(i=0; i<im0.nc; i++)
00075           im0.p[j][i] = im0.p[j][i]*im0.p[j][i];
00076 
00077   moy2Dfl_calc(&moy, im0, &moyint);
00078   moycarre2Dfl_calc(&moycar, im0, &moycarre);
00079   kuanfl_calc(&kuan, im0, moyint, moycarre, &im0);
00080 
00081   /* retour en amplitude */
00082   for(j=0; j<im0.nr; j++)
00083       for(i=0; i<im0.nc; i++)
00084           im0.p[j][i] = (float)sqrt((double)im0.p[j][i]);
00085         
00086 /* FREMETURE */
00087   write_imafl_ferm(&wri, im0);
00088 }
00089 
00090 
00091 

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