createLBPHFaceRecognizer arguments grid_x and grid_y

http://docs.opencv.org/trunk/modules/... What does the grid_x and grid_y means ? Suppose I use radius = 2. How can I calculate the neighbor, gird_x, and grid_y?

edit retag close merge delete

Sort by » oldest newest most voted

'radius' is the distance from the center pixel to the neighbours, 'neighbours' is their count, like here:

with lbph, the face region gets divided into seperate patches, like this:

grid_x and grid_y are the number of patches in x and y direction (8 in this case, like the default with opencv)

for each patch, a separate (2^neighbours bins)histogram is calculated, and later concatenated to a

grid_x * grid_y * (2^neighbours) element feature vector.

(you can already see, that increasing the neighbours count will be very expensive)

[images taken from : Face Recognition with Local Binary Patterns, Timo Ahonen, Abdenour Hadid, and Matti Pietikäinen - you might want to read this..]

more

Since my discussion is long. Comment box is not a good choice.

@berak Thank you for your explaination. I just got an article from Jayso. http://www.answers.opencv.org/questio...

Is your given picture is 7x7 not 8x8?

Let me confirm my understanding from your post. It means grid_x and grid_y are arbitrary value that we can put? But do not put patch size smaller than radius.

more

2

"Is your given picture is 7x7 not 8x8?" - hehe, right. i can't count ;)

hmm, yes, grid_x and grid_y are somewhat arbitrary. just remember, that you're filling a 256 bin histogram per patch, so if you have a lot of (small) patches, those histograms will get very sparse. for a 80x80 img, and a 8x8 grid, you got 10x10=100pixels per patch.

also, the more smaller the grid gets, the more patches, and the longer the resulting feature vector.

do your own experiments there !

( 2015-02-28 11:44:49 -0600 )edit

Thank you for your explanation ;} Did you know for the newbie like me. At first without article file. I guess 8 came from 3+2+3 in horizontal way and varieties way to calculate that 8 took me several hours with panic!

( 2015-02-28 12:11:23 -0600 )edit
1

oh, dear, no. just plain old sloppyness on my side ;)

( 2015-02-28 12:22:43 -0600 )edit