Ask Your Question
1

createLBPHFaceRecognizer arguments grid_x and grid_y

asked 2015-02-17 04:08:48 -0600

Tiras gravatar image

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 flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
6

answered 2015-02-17 04:31:21 -0600

berak gravatar image

updated 2015-02-17 04:36:20 -0600

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

image description

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

image description

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..]

edit flag offensive delete link more
1

answered 2015-02-28 11:33:37 -0600

Tiras gravatar image

updated 2015-02-28 11:34:00 -0600

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.

edit flag offensive delete link more

Comments

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 !

good papers in the other answer, btw, - read them ;)

berak gravatar imageberak ( 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!

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

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

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

Question Tools

1 follower

Stats

Asked: 2015-02-17 04:08:48 -0600

Seen: 655 times

Last updated: Feb 28 '15