mkuan_u1.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 */
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   imau1 im0;
00042   imau2 im2, moyint;
00043   imafl moycarre;
00044   pixu2 tab2[256];
00045 
00046   /* operateurs */
00047   read_ima_t  rea;
00048   moy2D_t     moy;
00049   moycarre2D_t  moycar;
00050   kuan_t      kuan;
00051   write_ima_t wri;
00052  
00053  /* main : variables et parametres propres au main*/
00054   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00055   int i, j;
00056   double tmpdb;
00057  
00058 /* LECTURE PARAMETRES */
00059   param_debut(argc, argv, &par0); 
00060   ptp = &par0;
00061   ptp = read_ima_lect(&rea, ptp, ">> image initiale (u1) :");
00062   ptp = kuan_lect(&kuan, ptp, "Kuan :");
00063   moy.dimX = kuan.dimX; moycar.dimX = kuan.dimX;
00064   moy.dimY = kuan.dimY; moycar.dimY = kuan.dimY;
00065   ptp = write_ima_lect(&wri, ptp, ">> image resultat (u1) :");
00066   param_fin(argc, argv, &par0);
00067 
00068 /* INITIALISATION  */
00069   read_imau1_init(&rea, &im0);
00070   /* passage en intensite */
00071   im2.nc = im0.nc;
00072   im2.nr = im0.nr;
00073   alloc_imau2(&im2);
00074   for(j=0; j<256; j++)
00075       tab2[j] = (pixu2)j*(pixu2)j;
00076   for(j=0; j<im0.nr; j++)
00077       for(i=0; i<im0.nc; i++)
00078           im2.p[j][i] = tab2[im0.p[j][i]];
00079   moy2Du2_init(&moy, im2, &moyint);
00080   moycarre2Du2_init(&moycar, im2, &moycarre);
00081   /* pas de kuanu2_init, calcul sur place */; 
00082   write_ima_init(&wri);
00083  
00084 /* CALCUL */
00085   moy2Du2_calc(&moy, im2, &moyint);
00086   moycarre2Du2_calc(&moycar, im2, &moycarre);
00087   kuanu2_calc(&kuan, im2, moyint, moycarre, &im2);
00088   /* retour en amplitude */
00089   for(j=0; j<im0.nr; j++)
00090       for(i=0; i<im0.nc; i++){
00091           tmpdb = sqrt((double)im2.p[j][i]) +0.5;
00092           if( tmpdb < 256. )
00093               im0.p[j][i] = (pixu1)tmpdb;
00094           else
00095               im0.p[j][i] = 255;
00096       }
00097 /* FREMETURE */
00098   write_imau1_ferm(&wri, im0);
00099 }
00100 
00101 
00102 

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