Repository: opencv
Issue: createLBPHFaceRecognizer function in Java
Labels: auto-transferred,priority: normal,feature,category: java bindings

Transferred from http://code.opencv.org/issues/2919

```
|| Anton Anikin on 2013-03-26 07:27
|| Priority: Normal
|| Affected: None
|| Category: java bindings
|| Tracker: Feature
|| Difficulty: None
|| PR: 
|| Platform: None / None
```
## createLBPHFaceRecognizer function in Java

```
Following functions are not mapped in java to native objects createEigenFaceRecognizer(), createFisherFaceRecognizer(), createLBPHFaceRecognizer()
I did it in following way, maybe it will be useful. I added few rows into modules/java/generator/gen_java.py file:

<pre>
    'Contrib' :                                                                                                                                                                                                                            
    {                                                                                                                                                                                                                                      
        "createLBPHFaceRecognizer"                     : {'j_code' :                                                                                                                                                                       
"""                                                                                                                                                                                                                                        
      public static FaceRecognizer createLBPHFaceRecognizer(){                                                                                                                                                                             
           return new FaceRecognizer(n_createLBPHFaceRecognizer());                                                                                                                                                                        
      }                                                                                                                                                                                                                                    
"""                                                                                                                                                                                                                                        
, 'jn_code' :                                                                                                                                                                                                                              

"""                                                                                                                                                                                                                                        
      private static native long n_createLBPHFaceRecognizer();\n                                                                                                                                                                           
"""                                                                                                                                                                                                                                        
, 'cpp_code' :                                                                                                                                                                                                                             
"""                                                                                                                                                                                                                                        
JNIEXPORT jlong JNICALL Java_org_opencv_contrib_Contrib_n_1createLBPHFaceRecognizer (JNIEnv *, jclass);                                                                                                                                    

JNIEXPORT jlong JNICALL Java_org_opencv_contrib_Contrib_n_1createLBPHFaceRecognizer (JNIEnv * jenv, jclass) {                                                                                                                              
        cv::Ptr<FaceRecognizer> model = cv::createLBPHFaceRecognizer();                                                                                                                                                                    
      model.addref();                                                                                                                                                                                                                      
        return (jlong)model.obj;                                                                                                                                                                                                           
}                                                                                                                                                                                                                                          
"""
    }, # createLBPHFaceRecognizer

    }, # Contrib
</pre>
```
## History
##### Anton Anikin on 2013-03-26 07:30

```
<pre>
    'Contrib' :
    {
        "createLBPHFaceRecognizer"                     : {'j_code' :
"""
        public static FaceRecognizer createLBPHFaceRecognizer(){
             return new FaceRecognizer(n_createLBPHFaceRecognizer());
        }
"""
, 'jn_code' :

"""    
        private static native long n_createLBPHFaceRecognizer();\n
"""
, 'cpp_code' :
"""
JNIEXPORT jlong JNICALL Java_org_opencv_contrib_Contrib_n_1createLBPHFaceRecognizer (JNIEnv *, jclass);

JNIEXPORT jlong JNICALL Java_org_opencv_contrib_Contrib_n_1createLBPHFaceRecognizer (JNIEnv * jenv, jclass) { 
        cv::Ptr<FaceRecognizer> model = cv::createLBPHFaceRecognizer(); 
        model.addref();
        return (jlong)model.obj; 
}
"""
    }, # createLBPHFaceRecognizer

    }, # Contrib
</pre>
```
##### Vladislav Vinogradov on 2013-04-01 09:11

```
-   Assignee set to Andrey Pavlenko
-   Category set to java bindings
```
##### Koray Gecici on 2013-04-24 06:58

```
We need createLBPHFaceRecognizer method from Java. Can i download from anywhere, including full version of Contrib java class?
```
##### Anna Kogan on 2013-05-07 09:19

```
-   Description changed from Following functions are not mapped in java
    to native objects createEigenFaceR... to Following functions are not
    mapped in java to native objects createEigenFaceR... More
```
##### Jay ZH on 2013-08-09 23:05

```
This is not correct.
createLBPHFaceRecognizer defined as
Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius, int neighbors,
                                             int grid_x, int grid_y, double threshold)

need a java binding match native definition.
```