Chinaunix首页 | 论坛 | 博客
  • 博客访问: 89419
  • 博文数量: 22
  • 博客积分: 2000
  • 博客等级: 大尉
  • 技术积分: 505
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-21 17:13
文章分类

全部博文(22)

文章存档

2011年(1)

2008年(21)

我的朋友

分类: C/C++

2008-06-11 13:05:15

程序输入的参数中有一个是图片的文件名,因此输入….tif,却提示找不到文件,debug之后发现,默认的文件格式是pgm。因此用matlabimreadimwritetif转成pgm的,但还是有问题,后发现程序中要求的pgm图片的开头是:

P2

n1,n2

255

而我转成的pgm的开头是P5的。原来,The first line, P2, is a magic number! P2 just means that the file is an ASCII PGM file. The only other valid value here is P5 which is a binary PGM file.  第二行的两个数字代表图片的宽和高。第三行的255代表intensity的个数,8bit的图像是255intensity

然而matlab默认的转成了P5,查看了matlabhelp之后知可在imwrite中把Encoding这个参数中设置为ASCII,默认为rawbitsASCII (plain) encoded with arbitrary color depth; raw (binary) encoded with up to 16 bits per gray value

 

阅读(7382) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~