createLBPHFaceRecognizer() radius parameter [closed]

asked 2014-01-20 01:26:46 -0500

Jyo gravatar image

updated 2020-10-27 05:40:25 -0500

I'm trying to implement the LBPH Algorithm for Facial Expression Recognition with OpenCV. I'm reading through the documentations, and I'm curious as of what the radius parameter represents because the sentence was broken in the documentation. Any idea what the full sentence was?

(Link) Parameters:
radius – The radius used for building the Circular Local Binary Pattern. The greater the radius, the

Also, I'm trying to retrieve back the confidence level of my results too, but it's returning too huge a value which I doubt represents the confidence. I've read from some articles that it actually returns the Euclidean Distance rather than the confidence level. Is there anyway to get the confidence?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-27 05:40:37.330314



Using circular neighbourhoods and bilinearly interpolating the pixel values allow any radius and number of pixels in the neighbourhood. For neighbourhoods we will use the notation (P, R) which means P sampling points on a circle of radius of R.

A small radius of the operator makes the information encoded in the histogram more local. THE GREATER THE RADIUS, the smoother the image but more spatial information you can get.

albertofernandez gravatar imagealbertofernandez ( 2014-01-20 01:55:18 -0500 )edit

@albertofernandez Thank you for the comment and article reference! It's detailed and well-written with figures and examples. I have tried with both (8,1) and (8,2) neighbourhood but both seems pretty shaky. Is there any idea how I can further increase the recognition rate? I'm using OpenCV's FaceRecognizer train and predict method with LBPH. I have around 70 subjects per facial expression class (7 classes) and they have all been cropped and aligned.

Jyo gravatar imageJyo ( 2014-01-20 20:47:05 -0500 )edit

I'll try:

  • Perform illumination normalization (see other opencv questions about it)
  • Increase the number of images per facial expression.

I'll start with two emotions (for example neutral/smiling). Finding smiling and neutral faces would be easy and see the performance of this approach.

albertofernandez gravatar imagealbertofernandez ( 2014-01-21 05:55:26 -0500 )edit

@albertofernandez I just applied illumination normalization like you said and it did work a lot better! It's detecting happy faces really well, but it doesn't seem to detect neutral faces at all. If I remove my threshold, it would be detected as happy. I'll increase my number of training images and see what I can do about it. Thank you so much for your help!

Jyo gravatar imageJyo ( 2014-01-21 21:38:18 -0500 )edit
Tiras gravatar imageTiras ( 2015-02-17 02:59:21 -0500 )edit

@Tiras This might be the same paper:

And here's the info in case the link dies in the future: Face Recognition with Local Binary Patterns Timo Ahonen, Abdenour Hadid, and Matti Pietik¨ainen Machine Vision Group, Infotech Oulu PO Box 4500, FIN-90014 University of Oulu, Finland, {tahonen,hadid,mkp},

JaySo gravatar imageJaySo ( 2015-02-27 17:00:10 -0500 )edit

@JaySo Thank you. I may ask forum again if I have any question.

Tiras gravatar imageTiras ( 2015-02-28 10:27:09 -0500 )edit

Sorry. I was on holidays. Yes, i think it is the same paper.

albertofernandez gravatar imagealbertofernandez ( 2015-03-03 05:59:50 -0500 )edit

@Jyo, I am trying to use a function and getting this error,would you tell me how can i correct this error,i am using python 3.6 and opencv 4.3.3.

 face_recognizer = cv2.face_LBPHFaceRecognizer.create()

AttributeError: module 'cv2' has no attribute 'face_LBPHFaceRecognizer

Paras Jain gravatar imageParas Jain ( 2018-11-12 22:19:15 -0500 )edit