title: opencv face recognition tutorial code not working with opencv 3.0
body: <p>i am trying to use the code given in the tutorial but it is not working. i am sure all the dependencies are there and the program is compiling but it giving me some errors related that some functions can not be found.</p>
  
  <p>here is the code:</p>
  
  <pre><code>#include "opencv2/core/core.hpp"
  #include "opencv2/highgui/highgui.hpp"
  #include "opencv2/face.hpp"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  
  using namespace cv;
  using namespace std;
  
  static Mat norm_0_255(InputArray _src){
  
      Mat src = _src.getMat();
      Mat dst;
      switch(src.channels()){
      case 1:
          cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC1);
          break;
      case 3:
          cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC3);
          break;
      default:
          src.copyTo(dst);
          break;
      }
      return dst;
  }
  
  static void read_csv(const string&amp; filename, vector&lt;Mat&gt;&amp; images, vector&lt;int&gt;&amp; labels, char separator = ';'){
      std::ifstream file(filename.c_str(), ifstream::in);
      if(!file){
          string error_message = "No valid input file was given, please check the given filename.";
          CV_Error(CV_StsBadArg, error_message);
      }
      string line, path, classlabel;
      while(getline(file, line)){
          stringstream liness(line);
          getline(liness, path, separator);
          getline(liness, classlabel);
          if(!path.empty() &amp;&amp; !classlabel.empty()){
              images.push_back(imread(path, 0));
              labels.push_back(atoi(classlabel.c_str()));
          }
      }
  }
  
  int main(int argc, const char *argv[]){
  
      if(argc &lt; 2){
          cout &lt;&lt; "usage: " &lt;&lt; argv[0] &lt;&lt; " &lt;csv.ext&gt; &lt;output_folder&gt; " &lt;&lt; endl;
          exit(0);
      }
  
      string output_folder = ".";
      if(argc == 3){
          output_folder = string(argv[2]);
      }
  
      string fn_csv = string(argv[1]);
  
      vector&lt;Mat&gt; images;
      vector&lt;int&gt; labels;
  
      try{
          read_csv(fn_csv, images, labels);
      }catch(cv::Exception&amp; e){
          cerr &lt;&lt; "Error opening file \"" &lt;&lt; fn_csv &lt;&lt; "\". Reason: " &lt;&lt; e.msg &lt;&lt; endl;
          exit(1);
      }
      if(images.size() &lt;= 1){
          string error_message = "This demo needs at least 2 images to work. please add more images to your data set!";
          CV_Error(CV_StsError, error_message);
      }
  
      int height = images[0].rows;
  
      Mat testSample = images[images.size() - 1];
      int testLabel = labels[labels.size() - 1];
      images.pop_back();
      labels.pop_back();
  
      Ptr&lt;cv::face::FaceRecognizer&gt; model = cv::face::createEigenFaceRecognizer();
      model-&gt;train(images, labels);
  
      int predictedLabel = model-&gt;predict(testSample);
  
      string result_message = format("Predicted class = %d / Actual class = %d ", predictedLabel, testLabel);
      cout &lt;&lt; result_message &lt;&lt; endl;
  
      Mat eigenvalues = model-&gt;getMat("eigenvalues");
      Mat W = model-&gt;getMat("eigenvectors");
      Mat mean = model-&gt;getMat("mean");
  
      if(argc == 2){
          imshow("mean", norm_0_255(mean.reshape(1, images[0].rows)));
      }else{
          imwrite(format("%s/mean.png", output_folder.c_str()), norm_0_255(mean.reshape(1, images[0].rows)));
      }
  
        // Display or save the Eigenfaces:
      for (int i = 0; i &lt; min(10, W.cols); i++) {
          string msg = format("Eigenvalue #%d = %.5f", i, eigenvalues.at&lt;double&gt;(i));
          cout &lt;&lt; msg &lt;&lt; endl;
          // get eigenvector #i
          Mat ev = W.col(i).clone();
          // Reshape to original size &amp; normalize to [0...255] for imshow.
          Mat grayscale = norm_0_255(ev.reshape(1, height));
          // Show the image &amp; apply a Jet colormap for better sensing.
          Mat cgrayscale;
          applyColorMap(grayscale, cgrayscale, COLORMAP_JET);
          // Display or save:
          if(argc == 2) {
              imshow(format("eigenface_%d", i), cgrayscale);
          } else {
              imwrite(format("%s/eigenface_%d.png", output_folder.c_str(), i), norm_0_255(cgrayscale));
          }
      }
  
      // Display or save the image reconstruction at some predefined steps:
      for(int num_components = min(W.cols, 10); num_components &lt; min(W.cols, 300); num_components+=15) {
          // slice the eigenvectors from the model
          Mat evs = Mat(W, Range::all(), Range(0, num_components));
          Mat projection = subspaceProject(evs, mean, images[0].reshape(1,1));
          Mat reconstruction = subspaceReconstruct(evs, mean, projection);
          // Normalize the result:
          reconstruction = norm_0_255(reconstruction.reshape(1, images[0].rows));
          // Display or save:
          if(argc == 2) {
              imshow(format("eigenface_reconstruction_%d", num_components), reconstruction);
          } else {
              imwrite(format("%s/eigenface_reconstruction_%d.png", output_folder.c_str(), num_components), reconstruction);
          }
      }
      // Display if we are not writing to an output folder:
      if(argc == 2) {
          waitKey(0);
      }
      return 0;
  }
  </code></pre>
  
  <p>CMakeLists.txt file:</p>
  
  <pre><code>cmake_minimum_required(VERSION 2.8)
  project(faceReco)
  find_package(OpenCV REQUIRED)
  add_executable(faceReco faceReco.cpp)
  target_link_libraries(faceReco ${OpenCV_LIBS})
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>/home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp: In function ‘int main(int, const char**)’:
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:110:27: error: ‘class cv::face::FaceRecognizer’ has no member named ‘getMat’
    Mat eigenvalues = model-&gt;getMat("eigenvalues");
                             ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:111:17: error: ‘class cv::face::FaceRecognizer’ has no member named ‘getMat’
    Mat W = model-&gt;getMat("eigenvectors");
                   ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:112:20: error: ‘class cv::face::FaceRecognizer’ has no member named ‘getMat’
    Mat mean = model-&gt;getMat("mean");
                      ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:130:46: error: ‘COLORMAP_JET’ was not declared in this scope
           applyColorMap(grayscale, cgrayscale, COLORMAP_JET);
                                                ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:130:58: error: ‘applyColorMap’ was not declared in this scope
           applyColorMap(grayscale, cgrayscale, COLORMAP_JET);
                                                            ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:143:75: error: ‘subspaceProject’ was not declared in this scope
           Mat projection = subspaceProject(evs, mean, images[0].reshape(1,1));
                                                                             ^
  /home/abdulaziz/workspace/OpenCV_Projects/FaceReco/faceReco.cpp:144:71: error: ‘subspaceReconstruct’ was not declared in this scope
           Mat reconstruction = subspaceReconstruct(evs, mean, projection);
                                                                         ^
  </code></pre>