資源簡(jiǎn)介
在ORL人臉庫(kù)上實(shí)現(xiàn)基于LBP(local binary pattern)的人臉識(shí)別,分類(lèi)方法選用的是卡方檢驗(yàn)

代碼片段和文件信息
function?mapping?=?getmapping(samplesmappingtype)
table?=?0:2^samples-1;
newMax??=?0;??%?number?of?patterns?in?the?resulting?LBP?code
index???=?0;
if?strcmp(mappingtype‘u2‘)??%?等價(jià)模式
??newMax?=?samples*(samples-1)?+?3;?
??
??for?i?=?0:2^samples-1
????%?bitshift(Akassumedtype)k大于零時(shí)左移
????%?bitget(Abit)得到A中bit位的值
????%?bitset(AbitV)?returns?A?with?position?bit?set?to?the?value?of?V.?
????j?=?bitset(bitshift(i1‘uint8‘)1bitget(isamples));??%?循環(huán)左移
????numt?=?sum(bitget(bitxor(ij)1:samples));??%?統(tǒng)計(jì)0-1變化次數(shù)
????if?numt?<=?2
??????table(i+1)?=?index;
??????index?=?index?+?1;
????else
??????table(i+1)?=?newMax?-?1;
????end
??end
end
if?strcmp(mappingtype‘ri‘)??%?旋轉(zhuǎn)不變性
??tmpMap?=?zeros(2^samples1)?-?1;
??for?i?=?0:2^samples-1
????rm?=?i;
????r??=?i;
????for?j?=?1:samples-1
??????r?=?bitset(bitshift(r1‘uint8‘)1bitget(rsamples));??????
??????if?r?????????rm?=?r;??%?循環(huán)左移之后取最小值
??????end
????end
????if?tmpMap(rm+1)?0
??????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(i1‘uint8‘)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;
end
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????1604??2016-05-16?20:51??卡方檢驗(yàn)LBP\getmapping.m
?????文件???????2518??2016-05-26?16:30??卡方檢驗(yàn)LBP\lbp.m
?????文件???????1508??2016-05-23?20:38??卡方檢驗(yàn)LBP\main.m
?????文件???????2039??2016-05-16?18:56??卡方檢驗(yàn)LBP\main_single.m
?????文件??????11384??2010-03-24?19:05??卡方檢驗(yàn)LBP\ORL\s1\1.bmp
?????文件??????10318??1994-04-18?21:17??卡方檢驗(yàn)LBP\ORL\s1\1.pgm
?????文件??????11384??2010-03-24?19:43??卡方檢驗(yàn)LBP\ORL\s1\10.bmp
?????文件??????10318??1994-04-18?21:07??卡方檢驗(yàn)LBP\ORL\s1\10.pgm
?????文件??????11384??2010-03-24?19:42??卡方檢驗(yàn)LBP\ORL\s1\2.bmp
?????文件??????10318??1994-04-18?21:17??卡方檢驗(yàn)LBP\ORL\s1\2.pgm
?????文件??????11384??2010-03-24?19:44??卡方檢驗(yàn)LBP\ORL\s1\3.bmp
?????文件??????10318??1994-04-18?21:17??卡方檢驗(yàn)LBP\ORL\s1\3.pgm
?????文件??????11384??2010-03-24?19:44??卡方檢驗(yàn)LBP\ORL\s1\4.bmp
?????文件??????10318??1994-04-18?21:17??卡方檢驗(yàn)LBP\ORL\s1\4.pgm
?????文件??????11384??2010-03-24?19:44??卡方檢驗(yàn)LBP\ORL\s1\5.bmp
?????文件??????10318??1994-04-18?21:17??卡方檢驗(yàn)LBP\ORL\s1\5.pgm
?????文件??????11384??2010-03-24?19:45??卡方檢驗(yàn)LBP\ORL\s1\6.bmp
?????文件??????10318??1994-04-18?21:07??卡方檢驗(yàn)LBP\ORL\s1\6.pgm
?????文件??????11384??2010-03-24?19:45??卡方檢驗(yàn)LBP\ORL\s1\7.bmp
?????文件??????10318??1994-04-18?21:07??卡方檢驗(yàn)LBP\ORL\s1\7.pgm
?????文件??????11384??2010-03-24?19:45??卡方檢驗(yàn)LBP\ORL\s1\8.bmp
?????文件??????10318??1994-04-18?21:07??卡方檢驗(yàn)LBP\ORL\s1\8.pgm
?????文件??????11384??2010-03-24?19:45??卡方檢驗(yàn)LBP\ORL\s1\9.bmp
?????文件??????10318??1994-04-18?21:07??卡方檢驗(yàn)LBP\ORL\s1\9.pgm
?????文件??????11384??2010-03-25?19:23??卡方檢驗(yàn)LBP\ORL\s10\1.bmp
?????文件??????10318??1994-04-18?14:18??卡方檢驗(yàn)LBP\ORL\s10\1.pgm
?????文件??????11384??2010-03-25?19:23??卡方檢驗(yàn)LBP\ORL\s10\10.bmp
?????文件??????10318??1994-04-18?14:07??卡方檢驗(yàn)LBP\ORL\s10\10.pgm
?????文件??????11384??2010-03-25?19:23??卡方檢驗(yàn)LBP\ORL\s10\2.bmp
?????文件??????10318??1994-04-18?14:18??卡方檢驗(yàn)LBP\ORL\s10\2.pgm
............此處省略821個(gè)文件信息
評(píng)論
共有 條評(píng)論