/*! Train the classifier on a region of the entire image. The region is a rectangle. The parameters of this rectangle must be given in pixel. It also includes the training of the fern classifier. \param _I : The image use to train the classifier. \param _rectangle : The rectangle defining the region of interest (ROI). \return The number of reference points. */ unsigned int vpPlanarObjectDetector::buildReference(const vpImage<unsigned char> &_I, const vpRect _rectangle) { unsigned int res = fern.buildReference(_I, _rectangle); vpImagePoint iP = _rectangle.getTopLeft(); modelROI.x = (int)iP.get_u(); modelROI.y = (int)iP.get_v(); modelROI.width = (int)_rectangle.getWidth(); modelROI.height = (int)_rectangle.getHeight(); initialiseRefCorners(modelROI); return res; }