示例#1
0
void saveimage_pgm(char *file_name,int **image,int h,int w,int scale)
{
	unsigned char *image_u; int counter,y,x;
	counter=0;
	image_u= new unsigned char [h*w];
	for (y=0;y<h;y++) for(x=0;x<w;x++)
		image_u[counter++]= (unsigned char)(image[y][x]*scale+0.5f);
	write_binary_pgm(file_name,image_u,h,w);
	delete image_u;
}
示例#2
0
void saveimage_pgm(char *file_name,unsigned char *image,int h,int w,bool is_binary)
{
	if(is_binary==true) write_binary_pgm(file_name,image,h,w);
	else write_ascii_pgm(file_name,image,h,w);
}