⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 faxpb.c

📁 image processing including fourier,wavelet,segmentation etc.
💻 C
字号:
/*--------------------------- Commande MegaWave -----------------------------*//* mwcommand   name = {faxpb};   version = {"1.1"};   author = {"Lionel Moisan"};   function = {"Gain/Offset correction to a Fimage (a x plus b)"};   usage = {                'a':a->a   "set a directly (default: 1.0)",    's':s->s   "set a indirectly by selecting the output standart deviation s",    'M':M->M   "set a indirectly (and b=0) by selecting total mass M",    'b':b->b   "set b directly (default: 0.0)",    'm':m->m   "set b indirectly by selecting the output mean m",    'k'->k     "set b indirectly by keeping input mean",    in->in     "input Fimage",    out<-out   "output Fimage"   };*//*---------------------------------------------------------------------- v1.1: added -M option (L.Moisan)----------------------------------------------------------------------*/#include <stdio.h>#include <math.h>#include "mw.h"extern float fmean(), fvar();/*** NB: Calling this module with out=in is possible ***/void faxpb(in,out,a,s,b,m,k,M)     Fimage in,out;     float *a,*s,*b,*m,*M;     char *k;{  float gain,ofs1,ofs2,*pin,*pout;  int   i;    if (M) {    if ((s?1:0) + (a?1:0) + (m?1:0) + (b?1:0) + (k?1:0) > 0)       mwerror(USAGE,1,"please use -M option alone");    ofs1 = ofs2 = 0.;    gain = *M/(fmean(in)*(float)in->ncol*(float)in->nrow);  } else {    if (s && a)       mwerror(USAGE,1,"-a and -s options cannot be used together");    if ((m?1:0) + (b?1:0) + (k?1:0) > 1)       mwerror(USAGE,1,"please select no more than one of -b -m -k options");        if (s)       gain = *s / (float)sqrt((double)fvar(in));    else gain = (a?*a:1.0);        if (m) {      ofs1 = fmean(in);      ofs2 = *m;    } else if (k) {      ofs1 = fmean(in);      ofs2 = ofs1;    } else {      ofs1 = 0.0;      ofs2 = (b?*b:0.0);    }  }  mwdebug("a = %f\n",gain);  mwdebug("b = %f\n",ofs2-gain*ofs1);  out = mw_change_fimage(out,in->nrow,in->ncol);  if (!out) mwerror(FATAL,1,"Not enough memory.");  for (i=in->nrow*in->ncol,pin=in->gray,pout=out->gray; i-- ; pin++,pout++)     *pout = gain * (*pin - ofs1) + ofs2;  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -