怎么用C++处理pgm格式的图片?
我开始学习图像处理,一开始老师让我用pgm格式的图像,我在课堂上学到的是读取文件的方式然后用各种循环处理,现在老师让我实现高斯模糊双边滤波器什么的,但是我开始迷糊了因为上网找资料的时候都是些用了什么Cmap啊什么的,需要用到么?那么我一开始用VC6.0做的处理,现在要用Visual Studio2008,还会有什么格式之类的转化么?
急需回答!牛人们帮帮我吧。。。
这是当时读入的代码
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define DIM 1024
void main(argc,argv)
int argc;
char **argv;
{
FILE *fr,*fw;
unsigned char **get_matrix_space(),**image,**tempt;
unsigned char buffer[DIM];
int i,I_m,I_n,j,aver=0,aver2=0,var=0,var2=0;
double fvar=0;
char topc[20];
if(argc != 3){
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((fw= fopen(argv[2],"wb")) ==NULL){
printf("can't open %s\n",argv[2]);
exit(1);
}
fscanf(fr,"%s\n",topc);
fscanf(fr,"%d %d\n",&I_n,&I_m);
fscanf(fr,"%d",&i);
fprintf(fw,"%s\n",topc);
fprintf(fw,"%d %d\n",I_n,I_m);
fprintf(fw,"%d\n",255);
后面有一个构造的二维容器来装各种值。
get_matrix_space()
这样可以么?再深入处理还需要什么呢?
帮帮我啊。。我实在是。。啊。。。