term does not evaluate to a function急待解决#include #include #include #define DIM 1024void main(argc,argv)int argc;char **argv;{FILE *fr,*fw1,*fw2,*fw3;unsigned char buffer[DIM];int I_m,I_n,i,j;unsigned char buffer2[500][500];unsigned char buffe

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 20:02:37
termdoesnotevaluatetoafunction急待解决#include#include#include#defineDIM1024voidmain(argc,argv)intargc;c

term does not evaluate to a function急待解决#include #include #include #define DIM 1024void main(argc,argv)int argc;char **argv;{FILE *fr,*fw1,*fw2,*fw3;unsigned char buffer[DIM];int I_m,I_n,i,j;unsigned char buffer2[500][500];unsigned char buffe
term does not evaluate to a function急待解决
#include
#include
#include
#define DIM 1024
void main(argc,argv)
int argc;
char **argv;
{
FILE *fr,*fw1,*fw2,*fw3;
unsigned char buffer[DIM];
int I_m,I_n,i,j;
unsigned char buffer2[500][500];
unsigned char buffer3[500][500];
unsigned char buffer4[500][500];
unsigned char min = 255,max = 0,r1 = 0,r2 = 0;
char topc[20];
unsigned char colormap_one[256];
unsigned char colormap_two[256];
unsigned char colormap_three[256];
if(argc = 5){
printf("Sub:Image+OutImage\n");
exit(1);
}
if((fr= fopen(argv[1],"rb")) ==NULL){
printf("can't open %s\n",argv[1]);
exit(1);
}
if((fw1= fopen(argv[2],"wb1")) ==NULL){
printf("can't open %s\n",argv[2]);
exit(1);
}
if((fw2= fopen(argv[3],"wb2")) ==NULL){
printf("can't open %s\n",argv[3]);
exit(1);
}
if((fw3= fopen(argv[4],"wb3")) ==NULL){
printf("can't open %s\n",argv[4]);
exit(1);
}
fscanf(fr,"%s\n",topc);
fscanf(fr,"%d %d\n",&I_n,&I_m);
fscanf(fr,"%d",&i);
fprintf(fw1,"%s\n",topc);
fprintf(fw1,"%d %d\n",I_n,I_m);
fprintf(fw1,"%d\n",255);
fprintf(fw2,"%s\n",topc);
fprintf(fw2,"%d %d\n",I_n,I_m);
fprintf(fw2,"%d\n",255);
fprintf(fw3,"%s\n",topc);
fprintf(fw3,"%d %d\n",I_n,I_m);
fprintf(fw3,"%d\n",255);
for ( i = 0 ; i < 256; i++ ){
colormap_one[i] = (unsigned char)(105.8*log(1 + i));
colormap_two[i] = (unsigned char)(46.3*pow((i+40),0.3));
}
for ( i = 0 ; i < I_n; i++ ){
fread(buffer ,sizeof(unsigned char)*I_n,1,fr);
for ( j = 0; j < I_m; j++ )
{
buffer2[i][j] = buffer[j];
buffer3[i][j] = buffer[j];
buffer4[i][j] = buffer[j];
buffer2[i][j] = colormap_one[buffer2[i][j]];
buffer3[i][j] = colormap_two[buffer3[i][j]];
}
fwrite(buffer2[i] ,sizeof(unsigned char)*I_n,1,fw1);
fwrite(buffer3[i] ,sizeof(unsigned char)*I_n,1,fw2);
}
for ( i = 0 ; i < I_n ; i++ )
for ( j = 0 ; j < I_m ; j++ )
{
if ( buffer4[i][j] < min )
min = buffer4[i][j];
if ( buffer4[i][j] > max )
max = buffer4[i][j];
}
for ( i = 0 ; i < 256 ; i++ ){
if ( i < min ){
colormap_three[i] = (unsigned char)(i/4) ;
}
else if ( i < max )
colormap_three[i] = (unsigned char)(((max+255-min/4)/(max-min))(i-min)+min/4); //此行报错
else{
colormap_three[i] = (unsigned char)((i-255)/2+255);
}
}
for ( i = 0 ; i < I_n ; i++ ){
for ( j = 0 ; j < I_m ; j++ )
buffer4[i][j] = colormap_three[buffer4[i][j]];
fwrite(buffer4[i] ,sizeof(unsigned char)*I_n,1,fw3);
}
}
我的min max分别是指图象f1.pgm的最小象素值和最大象素值,通过设置了命令行参数f1.pgm f2.pgm f3.pgm后 读入f1.pgm 在得到min和max,照理说min和max都是可以得到的常量 为什么colormap_three[i] = (unsigned char)(((max+255-min/4)/(max-min))(i-min)+min/4); 会出现term does not evaluate to a function的错误?

term does not evaluate to a function急待解决#include #include #include #define DIM 1024void main(argc,argv)int argc;char **argv;{FILE *fr,*fw1,*fw2,*fw3;unsigned char buffer[DIM];int I_m,I_n,i,j;unsigned char buffer2[500][500];unsigned char buffe
1)头文件尽量不要定义变量.把变量放到cpp文件中.
2)如果要定义,可以定义成静态变量.