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

  • 大小: 0.27M
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2021-04-18
  • 語言: Matlab
  • 標簽: lbp??MATLAB??分類??

資源簡介

用lbp實現紋理特征提取,并分類說明: 一共有三個m文件,一個是lbp.m, 存放主要的lbp算法, 一個是getmapping,用以做算法的輔助函數, 一個是lbptest.m,存放測試代碼。 這三個文件需要放到同一個文件夾,并在文件夾中添加相應的圖片, 具體的圖片名字見lbptest.m的代碼,運行lbptest.m可以查看結果。代碼最后給出效果圖 。這三個文件是最傳統的LBP方法,有256種。

資源截圖

代碼片段和文件信息

%?GETMAPPING?returns?a?structure?containing?a?mapping?table?for?LBP?codes.
%??MAPPING?=?GETMAPPING(SAMPLESMAPPINGTYPE)?returns?a
%??structure?containing?a?mapping?table?for
%??LBP?codes?in?a?neighbourhood?of?SAMPLES?sampling
%??points.?Possible?values?for?MAPPINGTYPE?are
%???????‘u2‘???for?uniform?LBP
%???????‘ri‘???for?rotation-invariant?LBP
%???????‘riu2‘?for?uniform?rotation-invariant?LBP.
%
%??Example:
%???????I=imread(‘rice.tif‘);
%???????MAPPING=getmapping(16‘riu2‘);
%???????LBPHIST=lbp(I216MAPPING‘hist‘);
%??Now?LBPHIST?contains?a?rotation-invariant?uniform?LBP
%??histogram?in?a?(162)?neighbourhood.
%


function?mapping?=?getmapping(samplesmappingtype)
%?Version?0.1.1
%?Authors:?Marko?Heikkil?and?Timo?Ahonen


%?Changelog
%?0.1.1?Changed?output?to?be?a?structure
%?Fixed?a?bug?causing?out?of?memory?errors?when?generating?rotation
%?invariant?mappings?with?high?number?of?sampling?points.
%?Lauge?Sorensen?is?acknowledged?for?spotting?this?problem.


?


table?=?0:2^samples-1;
newMax??=?0;?%number?of?patterns?in?the?resulting?LBP?code
index???=?0;


if?strcmp(mappingtype‘u2‘)?%Uniform?2
??newMax?=?samples*(samples-1)?+?3;
??for?i?=?0:2^samples-1
????j?=?bitset(bitshift(i1samples)1bitget(isamples));?%rotate?left
????numt?=?sum(bitget(bitxor(ij)1:samples));?%number?of?1->0?and
???????????????????????????????????????????????%0->1?transitions
???????????????????????????????????????????????%in?binary?string
???????????????????????????????????????????????%x?is?equal?to?the
???????????????????????????????????????????????%number?of?1-bits?in
???????????????????????????????????????????????%XOR(xRotate?left(x))
????if?numt?<=?2
??????table(i+1)?=?index;
??????index?=?index?+?1;
????else
??????table(i+1)?=?newMax?-?1;
????end
??end
end


if?strcmp(mappingtype‘ri‘)?%Rotation?invariant
??tmpMap?=?zeros(2^samples1)?-?1;
??for?i?=?0:2^samples-1
????rm?=?i;
????r??=?i;
????for?j?=?1:samples-1
??????r?=?bitset(bitshift(r1samples)1bitget(rsamples));?%rotate
?????????????????????????????????????????????????????????????%left
??????if?r?????????rm?=?r;
??????end
????end
????if?tmpMap(rm+1)???????tmpMap(rm+1)?=?newMax;
??????newMax?=?newMax?+?1;
????end
????table(i+1)?=?tmpMap(rm+1);
??end
end


if?strcmp(mappingtype‘riu2‘)?%Uniform?&?Rotation?invariant
??newMax?=?samples?+?2;
??for?i?=?0:2^samples?-?1
????j?=?bitset(bitshift(i1samples)1bitget(isamples));?%rotate?left
????numt?=?sum(bitget(bitxor(ij)1:samples));
????if?numt?<=?2
??????table(i+1)?=?sum(bitget(i1:samples));
????else
??????table(i+1)?=?samples+1;
????end
??end
end


mapping.table=table;
mapping.samples=samples;
mapping.num=newMax;

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????108338??2013-10-21?17:02??LBP1\a.fig
?????文件???????41779??2013-10-21?17:02??LBP1\a.jpg
?????文件????????2759??2013-10-21?17:02??LBP1\getmapping.m
?????文件??????159094??2013-10-21?17:02??LBP1\lbp.docx
?????文件????????6076??2013-10-21?17:02??LBP1\lbp.m
?????文件????????2003??2013-10-21?17:02??LBP1\lbptest.m
?????文件?????????313??2013-10-21?17:02??LBP1\readme.txt
?????目錄???????????0??2013-10-21?17:02??LBP1\

評論

共有 條評論