Ask Your Question
0

LBPH uses uniform patterns approach?

asked 2017-11-05 09:34:46 -0500

Kelvin gravatar image

The LBPH implementation provided by OpenCV uses the uniform patterns approach (as described here) (e.g. 59 patterns) or it uses all patterns (e.g. 256)?

Thanks in advance

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-11-05 09:55:10 -0500

berak gravatar image

no, opencv's lbph face recognition implementation is NOT using uniform lookup, it's using the whole 0..256 range for the histograms.

(though implementing this is not very difficult. i.e. for 8 neighbours, you coud use a precalculated lookup table, and replace the lbp value from the image with it's lookup value here

static const int uniform[256] = { // uniform2 pattern lookup
    0,1,2,3,4,58,5,6,7,58,58,58,8,58,9,10,11,58,58,58,58,58,58,58,12,58,58,58,13,58,
    14,15,16,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,17,58,58,58,58,58,58,58,18,
    58,58,58,19,58,20,21,22,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
    58,58,58,58,58,58,58,58,58,58,58,58,23,58,58,58,58,58,58,58,58,58,58,58,58,58,
    58,58,24,58,58,58,58,58,58,58,25,58,58,58,26,58,27,28,29,30,58,31,58,58,58,32,58,
    58,58,58,58,58,58,33,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,34,58,58,58,58,
    58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,
    58,35,36,37,58,38,58,58,58,39,58,58,58,58,58,58,58,40,58,58,58,58,58,58,58,58,58,
    58,58,58,58,58,58,41,42,43,58,44,58,58,58,45,58,58,58,58,58,58,58,46,47,48,58,49,
    58,58,58,50,51,52,58,53,54,55,56,57
};

//dst.at<unsigned char>(i-1,j-1) = code; // [0..256]
dst.at<unsigned char>(i-1,j-1) = lookup[code]; // [0..59]
edit flag offensive delete link more

Comments

1

sidenote: you'll see a lot of '58' (aka "noise class") above. that's the idea of compressing the whole [0..256] range to 59 features only.

unfortunately, the assumption (statistics) behind it might or might not hold for your given data.

this method is good, if you have to restrict the data saved to some db (save less bytes), but for sure, it does not improve the quality. (lot's of noughts in the original feature, but still, absence of any of it is still information)

berak gravatar imageberak ( 2017-11-05 11:53:10 -0500 )edit

Yes, I understand that the '58' values are representing non-uniform patterns. It seems to make sense when we have a limited/restricted storage size, but sure, we lose some information. Thanks @berak.

Kelvin gravatar imageKelvin ( 2017-11-05 15:33:34 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-11-05 09:34:46 -0500

Seen: 106 times

Last updated: Nov 05 '17