最好有噪声公式和源码
下边是一个反色的源程序,麻烦改几个函数,加入高斯噪声和椒盐噪声
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Width 256
#define Height 256
main()
{
FILE *FileOpen(),*in,*out;
unsigned char *image0,*image1;
unsigned char head[1078];
int i,j,nLen;
image0=(unsigned char *)malloc(Width*Height);
image1=(unsigned char *)malloc(Width*Height);
in=FileOpen("pgirl.bmp","rb");
out=FileOpen("pgirlr.bmp","wb");
fread(head,1078,1,in);
fwrite(head,1078,1,out);
fread(image0,Width*Height,1,in);
for(i=0;i<Width;i++)
for(j=0;j<Height;j++)
{
nLen=i*Width+j;
image1[nLen]=255-image0[nLen];
}/*反色,或者在这里进行自己的处理*/
fwrite(image1,Width*Height,1,out);
fclose(in);
fclose(out);
/*Display the result*/
free(image0);
free(image1);
return 0;
}