91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 53KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-09
  • 語言: Matlab
  • 標(biāo)簽: BMP??MATLAB??

資源簡(jiǎn)介

用來正確讀取BMP文件信息:文件頭:大小,長(zhǎng)寬,顏色數(shù)目,關(guān)鍵顏色數(shù)目,每像素所用bit數(shù),水平和垂直分辨率,壓縮方式等

資源截圖

代碼片段和文件信息

clc;clear?all;close?all;
fid=fopen(?‘t_2.bmp‘‘rb‘);%此處為想要讀取的文件名
bfType=fread(fid2);
[s?errmsg]?=?sprintf(‘the?file?type:%s‘char(bfType));
disp(s);

bfSize=fread(fid4);
fsize=bfSize(4)*256^3+bfSize(3)*256^2+bfSize(2)*256+bfSize(1);
[s?errmsg]?=?sprintf(‘the?file?size:%d?byte‘fsize);
disp(s);

bfOffbits=fread(fid8);
foffset=bfOffbits(8)*256^3+bfOffbits(7)*256^2+bfOffbits(6)*256+bfOffbits(5);
[s?errmsg]?=?sprintf(‘offset?to?start?of?pixel?data:%d?byte‘foffset);
disp(s);

biSize=fread(fid4);
isize=biSize(4)*256^3+biSize(3)*256^2+biSize(2)*256+biSize(1);
[s?errmsg]?=?sprintf(‘the?size?of?infoheader:%d?byte‘isize);
disp(s);

infoRead=fread(fid8);
biWidth=infoRead(4)*256^3+infoRead(3)*256^2+infoRead(2)*256+infoRead(1);
biHeight=infoRead(8)*256^3+infoRead(7)*256^2+infoRead(6)*256+infoRead(5);
[s?errmsg]?=?sprintf(‘width:?%d?\nheight:%d?‘biWidthbiHeight);
disp(s);

infoRead=fread(fid28);
biBitCount=infoRead(4)*256+infoRead(3);
biCompression=infoRead(8)*256^3+infoRead(7)*256^2+infoRead(6)*256+infoRead(5);
biSizeImage=infoRead(12)*256^3+infoRead(11)*256^2+infoRead(10)*256+infoRead(9);
biXPelsPerMeter=infoRead(16)*256^3+infoRead(15)*256^2+infoRead(14)*256+infoRead(13);
biYPelsPerMeter=infoRead(20)*256^3+infoRead(19)*256^2+infoRead(18)*256+infoRead(17);
biCirUsed=infoRead(24)*256^3+infoRead(23)*256^2+infoRead(22)*256+infoRead(21);
biCirImportant=infoRead(28)*256^3+infoRead(27)*256^2+infoRead(26)*256+infoRead(25);

[s?errmsg]?=?sprintf(‘the?bit?count:?%d?color?count:?%d‘...
????biBitCount2^biBitCount);
disp(s);
if?biCompression==0
????disp(‘no?compression‘);
else?if?biCompression==1
????????disp(‘RLE8?compression‘);
????else?if?biCompression==2
????????????disp(‘RLE4?compression‘);
????????else?disp(‘bit?fields?compression‘);
????????end
????end
end
if?biXPelsPerMeter~=0
????[s?errmsg]?=?sprintf(‘horizontal?resolution:%d?pixels?per?meter‘biXPelsPerMeter);
????disp(s);
else?disp(‘default?horizontal?resulution‘);
end
if?biYPelsPerMeter~=0
?????[s?errmsg]?=?sprintf(‘verticular?resolution:%d?pixels?per?meter‘biYPelsPerMeter);
?????disp(s);
else?disp(‘default?verticular?resulution‘);
end
if?biSizeImage~=0
?????[s?errmsg]?=?sprintf(‘image?size:?%d‘biSizeImage);
?????disp(s);
else?disp(‘No?compression‘);
end
if?biCirUsed~=0
?????[s?errmsg]?=?sprintf(‘%d?color?actually?used‘biCirUsed);
?????disp(s);
else?disp(‘a(chǎn)ll?colors?are?used‘);
end
if?biCirImportant~=0
??????[s?errmsg]?=?sprintf(‘count?of?significant?colors:%d‘biCirImportant);
?????disp(s);
else?disp(‘a(chǎn)ll?colors?are?significant‘);
end
skip=mod((4-mod(((biWidth?*?biBitCount)/8)4))4);
if?((biBitCount==24)&&(foffset==54))
????for?i=1:biHeight
????????????if?biHeight>0
????????????????indHeight=biHeight+1-i;
????????????else?indHeight=i;
????????????end
????????for?j=1:biWidth
????????????colorRead=fread(fid3);
????????????I(indHeightj1)=colorRead(3);
????????????I(indHeightj2)=colorRead(2);
???

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????4011??2009-12-15?21:25??bmpdisplay.m

?????文件?????238134??2001-12-10?15:24??t_2.bmp

-----------?---------??----------?-----??----

???????????????242145????????????????????2


評(píng)論

共有 條評(píng)論