Repository: opencv
Issue: Public parameters of class not accessible
Labels: bug,auto-transferred,priority: normal,category: legacy,category: contrib,affected: 2.4

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

```
|| Steven Puttemans on 2014-08-07 13:33
|| Priority: Normal
|| Affected: 2.4.9 (latest release)
|| Category: legacy, contrib
|| Tracker: Bug
|| Difficulty: 
|| PR: 
|| Platform: x64 / Linux
```
## Public parameters of class not accessible

```
When looking at this Q&A topic (http://answers.opencv.org/question/38851/how-to-create-a-lbp-histogram-using-opencv/) I wondered if it couldnt be easier just to publicly expose the histograms of the LBPH Face detector which is in the contrib module.

I found out that in facerec.cpp there are the following commands in the declaration of the class

<pre>
    // Getter functions.
    int neighbors() const { return _neighbors; }
    int radius() const { return _radius; }
    int grid_x() const { return _grid_x; }
    int grid_y() const { return _grid_y; }
</pre>

What lead me to believe since they are declared public that they would be accesible and I could do the same for the histograms.
So changing this to:

<pre>
    // Getter functions.
    int neighbors() const { return _neighbors; }
    int radius() const { return _radius; }
    int grid_x() const { return _grid_x; }
    int grid_y() const { return _grid_y; }
    vector<Mat> histograms() const { return _histograms; }
</pre>

Worked perfectly for building, but then when using the function for a code snippet.
<pre>

#include "opencv2/opencv.hpp"

using namespace std;
using namespace cv;

int main()
{
    // holds images and labels
    vector<Mat> images;
    vector<int> labels;

    // images for first person
    images.push_back(imread("/data/temp/1.png", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
    images.push_back(imread("/data/temp/1b.png", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(0);
    // images for second person
    images.push_back(imread("/data/temp/2.png", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(1);
    images.push_back(imread("/data/temp/2b.png", CV_LOAD_IMAGE_GRAYSCALE)); labels.push_back(1);

    Ptr<FaceRecognizer> model =  createLBPHFaceRecognizer();
    model->train(images, labels);

    int grid_x = model->grid_x();
    vector<Mat> histograms = model->histograms();

    return 0;
}
</pre>

It seems that there is an error at compile time stating that both functions are no members of FaceRecognizer.

<pre>
||=== Build: Debug in test_LBP_hist (compiler: GNU GCC Compiler) ===|
/home/spu/Projects/code_blocks/test_LBP_hist/main.cpp||In function ‘int main()’:|
/home/spu/Projects/code_blocks/test_LBP_hist/main.cpp|22|error: ‘class cv::FaceRecognizer’ has no member named ‘grid_x’|
/home/spu/Projects/code_blocks/test_LBP_hist/main.cpp|23|error: ‘class cv::FaceRecognizer’ has no member named ‘histograms’|
/home/spu/Projects/code_blocks/test_LBP_hist/main.cpp|22|warning: unused variable ‘grid_x’ [-Wunused-variable]|
||=== Build failed: 2 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|
</pre>

This is wrong right? Since model should know that it is internally a LBPH element so those functions should be available?
```
## History