matlab中图像灰度拉伸的问题

今天看到了matlab中关于imshow这个函数。开始加入一张图片后,进行灰度拉伸,失败。图像始终是原来的图像未进行处理。怀疑命令存在问题。

但是按照帮助文档中命令,依然不对。

imshow(I,[low high])

displays I as a grayscale intensity image, specifying the data range for I. The value low (and any value less than low) displays as black, the value high (and any value greater than high) displays as white, and values in between display as intermediate shades of gray. imshow uses the default number of gray levels. If you use an empty matrix ([]) for [low high], imshow uses [min(I(:)) max(I(:))]; the minimum value in I displays as black, and the maximum value displays as white.

按照文档中所说。必须设置low 和high就可以了,但是遇到的问题。无解。

前去Google,无解。

看到imfinfo这个函数,读取函数类型。其格式为:infinfo 图像文件名

对图片读取后,发现格式为turecolor,为真彩色。怀疑这里有问题,故进行灰度处理。

灰度处理的命令行是:bw=rgb2gray(f);

再用imshow即可。

读取完成后,再用imwrite(f,'文件名.扩展名','quality',q);

f是写入数据的数组。后面是文件名和类型,对于jpg文件,可是设置文件的质量,q由1-100.

posted on 2011-03-20 13:35  面朝终南山  阅读(6511)  评论(0编辑  收藏  举报

导航