-
大小: 2KB文件類型: .m金幣: 1下載: 0 次發(fā)布日期: 2021-06-08
- 語言: Matlab
- 標(biāo)簽: lbp??getmapping.m??
資源簡介
lbp matlab程序中的getmapping文件
代碼片段和文件信息
%GETMAPPING?returns?a?mapping?table?for?LBP?codes.
%??MAPPING?=?GETMAPPING(SAMPLESMAPPINGTYPE)?returns?a?mapping?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
%?Authors:?Marko?Heikkil?and?Timo?Ahonen
??
mapping?=?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?
????????????
評論
共有 條評論