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

📄 filter.c

📁 本文档包括了几何矫正的主体内容
💻 C
字号:
/* *  <filter.c> *  this file include all functions in relation to filter  */#include <filter.h>
double sin_c(double x);/* *  cubicFunctionTable * *  compute cubic filter template */ voidcubicFunctionTable(cubicWidth,cubicHeight,tabNum,cubicTable)	long cubicWidth,cubicHeight;  /* width and height filter template */	long tabNum;                  /* discret dot num */	double *cubicTable;           /* filter template */{	long cw,ch,tx,ty;   /* index varaible */	double ival;     /* interval for template */	double startx,starty;	double tmpx,tmpy;	#if 0        long point_num = 0;	printf("filter width = %d height = %d tabnum = %d\n",			cubicWidth,cubicHeight,tabNum);#endif	if(!cubicTable) {		printf("Error: Memory Allocation for Filter Template\n");		exit(1);	}#if 0	for(tn=0;tn<tabNum * tabNum;tn++) {	     for( ch = 0;ch < cubicHeight;ch++ ) {	        	for ( cw = 0;cw < cubicWidth;cw++ ) {		        	*cubicTable = tn*cubicWidth*cubicHeight + ch*cubicWidth + cw;			        cubicTable++;		        }	     }	}#endif			ival = 1./tabNum;	startx =-1. +  cubicWidth/2.;	starty =-1. +  cubicHeight/2.;	for( ty = 0; ty <tabNum; ty++ ) {		  for( tx =0;tx <tabNum;tx++ ) {	     tmpx = startx;	     tmpy = starty;	     for( ch = 0; ch<cubicHeight;ch++ ) {	       for( cw=0;cw<cubicWidth;cw++ ) {		       *cubicTable = sin_c(tmpx)*sin_c(tmpy);		       /*printf("%f %f %f,%f\n",tmpx,tmpy,sin_c(tmpx),sin_c(tmpy));*/		       cubicTable++;		       tmpx -= 1.;	       }	       tmpy -= 1.;	       tmpx = startx;	     }             startx += ival;	  } /* for(tx.. */	  startx = -1. + cubicWidth/2.;	  starty += ival;	} /* for(ty.. */			}/* *  sin_c(x) *  *                    | 1-2x^2+|x|^3       |x| < 1 *  sin_c(x) =? s(x) = | 4-8|x|+5x^2-|x|^3  1<= |x| <2 *                    | 0                  |x|>= 2 */  double sin_c(x)	double x;{	if (x < 0) x = -x;	if (x < 1) {		return x*x*(x-2.)+1. ;	} else if (x >=2) {		return 0. ;	} else {		return  x*(x*(-x+5)-8)+4.;	}}

⌨️ 快捷键说明

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