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

  • 大小: 2.6MB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2023-11-07
  • 語言: Matlab
  • 標簽: pbm/pgm/ppm??Matlab??

資源簡介

pbm/pgm/ppm圖片的讀寫函數和測試程序(Matlab)

資源截圖

代碼片段和文件信息

function?[?IMG?]?=?imread_pxm(?filename?)
%??filename?:?the?name?of?.ppm/.pgm/.pbm?file?(in?ASCII/Binary?mode)
%??This?function?read?.ppm/.pgm/.pbm?file?and?store?the?image?data?into?variable?IMG

????fid?=?fopen(filename?‘rb‘);????%?open?.ppm?file?in?binary?mode
????p?=?fread(fid?1?‘*char‘);?????%?read?the?char?‘p‘
????pinfo?=?fgetl(fid);?????????????%?read?the?head?information?of?the?image
????info?=?str2num(pinfo);??????????%?convert?the?info?of?image?into?number
????[ptype?m?n]?=?deal(info(1)info(2)info(3));
????????????????????????????????????%?ptype?:?the?type?of?the?image?(p1..p6)
????????????????????????????????????%?n?m?:?the?display?resolution
????if?(ptype?~=?1)&&(ptype?~=?4)????%?range?:?the?range?of?pixels‘?value
????????range?=?info(4);
????else?range?=?1;
????end
????
????if?info(1)?<=?3?????????????????%?the?image?is?stored?in?ASCII?mode
????????if?ptype?==?3???????????????%?.ppm(RGB)?&?ASCII?
????????????for?i?=?1:n
????????????????for?j?=?1:m
????????????????????for?k?=?1:3
????????????????????????num?=?0;
????????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????????while?(~feof(fid))&&(ch?~=?32)&&(ch?~=?10)??????%?read?the?value?of?image?in?ASCII?mode
????????????????????????????num?=?num?*?10?+?ch?-?48;
????????????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????????end
????????????????????????IMG(i?j?k)?=?uint8(num);?????%?update?the?value?of?return?var
????????????????????end
????????????????end
????????????end
????????else????????????????????????%?.pbm/.pgm?&?ASCII
????????????for?i?=?1:n
????????????????for?j?=?1:m
????????????????????num?=?0;
????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????while?(~feof(fid))&&(ch?~=?32)&&(ch?~=?10)??????%?read?the?value?of?image?in?ASCII?mode
????????????????????????num?=?num?*?10?+?ch?-?48;
????????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????end
????????????????????if?ptype?==?2???????????????????????%?process?.pgm?file
????????????????????????IMG(i?j)?=??uint8(num);????????%?update?the?value?of?return?var
????????????????????elseif?ptype?==?1
????????????????????????IMG(ij)?=?logical(1?-?num);????%?process?.pbm?file
????????????????????end
????????????????end
????????????end
????????end
????else????????????????????????????%?the?image?is?stored?in?binary?mode
????????if?ptype?==?6???????????????%?.ppm(RGB)?&?binary
????????????for?i?=?1:n
????????????????for?j?=?1:m
????????????????????for?k?=?1:3
????????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????????IMG(i?j?k)?=?uint8(ch);???%?update?the?value?of?return?var
????????????????????end
????????????????end
????????????end
????????elseif?ptype?==?5????????????????????????%?.pgm?&?binary
????????????for?i?=?1:n
????????????????for?j?=?1:m
????????????????????ch?=?fread(fid?1?‘uint8‘);
????????????????????IMG(i?j)?=??uint8(ch);??????%?update?the?value?of?return?var
?????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-03-04?23:21??程序\
?????文件???????74948??2016-03-02?16:18??程序\greens.jpg
?????文件???????18911??2016-03-03?10:27??程序\greens.pbm
?????文件??????150015??2016-03-03?10:27??程序\greens.pgm
?????文件??????450015??2016-03-02?23:54??程序\greens.ppm
?????文件??????300010??2016-03-03?10:27??程序\greens1.pbm
?????文件??????470765??2016-03-03?10:27??程序\greens1.pgm
?????文件?????1392328??2016-03-02?23:53??程序\greens1.ppm
?????文件????????4495??2016-03-04?00:04??程序\imread_pxm.m
?????文件????????4327??2016-03-04?23:07??程序\imwrite_pxm.m
?????文件?????????244??2016-03-02?23:54??程序\jpg2ppm.m
?????文件??????300011??2016-03-04?23:18??程序\p1.pbm
?????文件??????150015??2016-03-04?23:18??程序\p1.pgm
?????文件??????470766??2016-03-04?23:18??程序\p2.pgm
?????文件?????1392329??2016-03-04?23:18??程序\p3.ppm
?????文件???????18911??2016-03-04?23:18??程序\p4.pbm
?????文件??????150015??2016-03-04?23:18??程序\p5.pgm
?????文件??????450015??2016-03-04?23:18??程序\p6.ppm
?????文件?????????903??2016-03-04?23:25??程序\Readme.txt
?????文件????????1442??2016-03-04?00:11??程序\test_imread_pxm.m
?????文件????????1500??2016-03-04?23:18??程序\test_imwrite_pxm.m
?????文件???????45668??2016-03-04?23:21??程序\tmp.jpg

評論

共有 條評論