frthre.c

来自「image processing including fourier,wavel」· C语言 代码 · 共 43 行

C
43
字号
/*--------------------------- MegaWave2 module -----------------------------*//* mwcommand name = {frthre}; author = {"Jacques Froment"}; version = {"1.0"}; function = {"Thresold the pixel's gray-levels of a noisy fimage for optimal recovery"}; usage = { 'l':[noise=20.0]->noise    "Absolute value of the additive noise", fimage->A    "Input fimage",  result<-B    "Output image"};*//*--------------------------------------------------------------------------*/#include <stdio.h>#include <math.h>#include  "mw.h"void frthre(A,B,noise)Fimage	A,B;float *noise;{  register float *ptrA,*ptrB;  register int i;    if ((B = mw_change_fimage(B,A->nrow,A->ncol)) == NULL)    mwerror(FATAL, 1, "Not enough memory !\n");      for (ptrA=A->gray, ptrB=B->gray, i=0;  i < A->nrow*A->ncol;        ptrA++, ptrB++, i++)     {      if (*ptrA > *noise) 	  *ptrB = *ptrA - *noise;      else 	if (*ptrA < - *noise)	  *ptrB = *ptrA + *noise;	else	  *ptrB = 0.0;    }}

⌨️ 快捷键说明

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