06.08.2013 Views

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

内容简介作者简介 - 科学与工程计算系

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.6.3 8 位和 16 位图象<br />

【例 6.6.3.1-1】变址图象两种数据类型的转换。本例演示:(A)由位深度(BitDepth)可知<br />

存放图象数据的类型;(B)存放同一图象的 unit8 类数据和 double 类数据间的等价转换;(C)<br />

利用 imwrite 生成图象格式文件时默认地采用 unit8 类型存放图象数据。<br />

(1)<br />

imageinf=imfinfo('forest.tif')<br />

imageinf =<br />

Filename: 'E:\MATLAB6P1\toolbox\images\imdemos\forest.tif'<br />

FileModDate: '26-Oct-1996 06:11:14'<br />

FileSize: 124888<br />

Format: 'tif'<br />

…………<br />

BitDepth: 8<br />

…………<br />

Colormap: [256x3 double]<br />

…………<br />

(2)<br />

[X8,cmap]=imread('forest.tif');<br />

subplot(1,2,1);<br />

image(X);colormap(cmap);axis image off<br />

X64=double(X8)+1;subplot(1,2,2);<br />

image(X64);colormap(cmap);axis image off<br />

图 6.6-4<br />

(3)<br />

whos<br />

Name Size Bytes Class<br />

X8 301x447 134547 uint8 array<br />

X64 301x447 1076376 double array<br />

cmap 256x3 6144 double array<br />

imageinf 1x1 11250 struct array<br />

Grand total is 271910 elements using 1239567 bytes<br />

(4)<br />

imwrite(X64,cmap,'myforest.jpg')<br />

imfinfo('myforest.jpg')<br />

ans =<br />

Filename: 'myforest.jpg'<br />

FileModDate: '03-Mar-2002 19:38:26'<br />

FileSize: 27716<br />

Format: 'jpg'<br />

FormatVersion: ''<br />

35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!