Commit acec6955 authored by Alexander Alekhin's avatar Alexander Alekhin

face: apply CV_OVERRIDE/CV_FINAL

parent 14341291
...@@ -333,13 +333,13 @@ public: ...@@ -333,13 +333,13 @@ public:
Saves this model to a given FileStorage. Saves this model to a given FileStorage.
@param fs The FileStorage to store this FaceRecognizer to. @param fs The FileStorage to store this FaceRecognizer to.
*/ */
virtual void write(FileStorage& fs) const = 0; virtual void write(FileStorage& fs) const CV_OVERRIDE = 0;
/** @overload */ /** @overload */
virtual void read(const FileNode& fn) = 0; virtual void read(const FileNode& fn) CV_OVERRIDE = 0;
/** @overload */ /** @overload */
virtual bool empty() const = 0; virtual bool empty() const CV_OVERRIDE = 0;
/** @brief Sets string info for the specified model's label. /** @brief Sets string info for the specified model's label.
......
...@@ -265,8 +265,8 @@ class CV_EXPORTS_W Facemark : public virtual Algorithm ...@@ -265,8 +265,8 @@ class CV_EXPORTS_W Facemark : public virtual Algorithm
{ {
public: public:
virtual void read( const FileNode& fn )=0; virtual void read( const FileNode& fn ) CV_OVERRIDE = 0;
virtual void write( FileStorage& fs ) const=0; virtual void write( FileStorage& fs ) const CV_OVERRIDE = 0;
/** @brief Add one training sample to the trainer. /** @brief Add one training sample to the trainer.
......
...@@ -25,18 +25,18 @@ public: ...@@ -25,18 +25,18 @@ public:
/** @copybrief getNumComponents @see getNumComponents */ /** @copybrief getNumComponents @see getNumComponents */
CV_WRAP void setNumComponents(int val); CV_WRAP void setNumComponents(int val);
/** @see setThreshold */ /** @see setThreshold */
CV_WRAP double getThreshold() const; CV_WRAP double getThreshold() const CV_OVERRIDE;
/** @copybrief getThreshold @see getThreshold */ /** @copybrief getThreshold @see getThreshold */
CV_WRAP void setThreshold(double val); CV_WRAP void setThreshold(double val) CV_OVERRIDE;
CV_WRAP std::vector<cv::Mat> getProjections() const; CV_WRAP std::vector<cv::Mat> getProjections() const;
CV_WRAP cv::Mat getLabels() const; CV_WRAP cv::Mat getLabels() const;
CV_WRAP cv::Mat getEigenValues() const; CV_WRAP cv::Mat getEigenValues() const;
CV_WRAP cv::Mat getEigenVectors() const; CV_WRAP cv::Mat getEigenVectors() const;
CV_WRAP cv::Mat getMean() const; CV_WRAP cv::Mat getMean() const;
virtual void read(const FileNode& fn); virtual void read(const FileNode& fn) CV_OVERRIDE;
virtual void write(FileStorage& fs) const; virtual void write(FileStorage& fs) const CV_OVERRIDE;
virtual bool empty() const; virtual bool empty() const CV_OVERRIDE;
using FaceRecognizer::read; using FaceRecognizer::read;
using FaceRecognizer::write; using FaceRecognizer::write;
...@@ -143,9 +143,9 @@ public: ...@@ -143,9 +143,9 @@ public:
/** @copybrief getNeighbors @see getNeighbors */ /** @copybrief getNeighbors @see getNeighbors */
CV_WRAP virtual void setNeighbors(int val) = 0; CV_WRAP virtual void setNeighbors(int val) = 0;
/** @see setThreshold */ /** @see setThreshold */
CV_WRAP virtual double getThreshold() const = 0; CV_WRAP virtual double getThreshold() const CV_OVERRIDE = 0;
/** @copybrief getThreshold @see getThreshold */ /** @copybrief getThreshold @see getThreshold */
CV_WRAP virtual void setThreshold(double val) = 0; CV_WRAP virtual void setThreshold(double val) CV_OVERRIDE = 0;
CV_WRAP virtual std::vector<cv::Mat> getHistograms() const = 0; CV_WRAP virtual std::vector<cv::Mat> getHistograms() const = 0;
CV_WRAP virtual cv::Mat getLabels() const = 0; CV_WRAP virtual cv::Mat getLabels() const = 0;
......
...@@ -98,9 +98,9 @@ public: ...@@ -98,9 +98,9 @@ public:
*/ */
StandardCollector(double threshold_ = DBL_MAX); StandardCollector(double threshold_ = DBL_MAX);
/** @brief overloaded interface method */ /** @brief overloaded interface method */
void init(size_t size); void init(size_t size) CV_OVERRIDE;
/** @brief overloaded interface method */ /** @brief overloaded interface method */
bool collect(int label, double dist); bool collect(int label, double dist) CV_OVERRIDE;
/** @brief Returns label with minimal distance */ /** @brief Returns label with minimal distance */
CV_WRAP int getMinLabel() const; CV_WRAP int getMinLabel() const;
/** @brief Returns minimal distance value */ /** @brief Returns minimal distance value */
......
...@@ -91,18 +91,18 @@ const double kGaborWavelens[kNumBandsMax][2] = { ...@@ -91,18 +91,18 @@ const double kGaborWavelens[kNumBandsMax][2] = {
{11.5, 12.7}, {14.1, 15.4}, {16.8, 18.2}, {19.7, 21.2} {11.5, 12.7}, {14.1, 15.4}, {16.8, 18.2}, {19.7, 21.2}
}; };
class BIFImpl : public cv::face::BIF { class BIFImpl CV_FINAL : public cv::face::BIF {
public: public:
BIFImpl(int num_bands, int num_rotations) { BIFImpl(int num_bands, int num_rotations) {
initUnits(num_bands, num_rotations); initUnits(num_bands, num_rotations);
} }
virtual int getNumBands() const { return num_bands_; } virtual int getNumBands() const CV_OVERRIDE { return num_bands_; }
virtual int getNumRotations() const { return num_rotations_; } virtual int getNumRotations() const CV_OVERRIDE { return num_rotations_; }
virtual void compute(cv::InputArray image, virtual void compute(cv::InputArray image,
cv::OutputArray features) const; cv::OutputArray features) const CV_OVERRIDE;
private: private:
struct UnitParams { struct UnitParams {
......
...@@ -43,11 +43,11 @@ public: ...@@ -43,11 +43,11 @@ public:
// Computes an Eigenfaces model with images in src and corresponding labels // Computes an Eigenfaces model with images in src and corresponding labels
// in labels. // in labels.
void train(InputArrayOfArrays src, InputArray labels); void train(InputArrayOfArrays src, InputArray labels) CV_OVERRIDE;
// Send all predict results to caller side for custom result handling // Send all predict results to caller side for custom result handling
void predict(InputArray src, Ptr<PredictCollector> collector) const; void predict(InputArray src, Ptr<PredictCollector> collector) const CV_OVERRIDE;
String getDefaultName() const String getDefaultName() const CV_OVERRIDE
{ {
return "opencv_eigenfaces"; return "opencv_eigenfaces";
} }
......
...@@ -70,12 +70,12 @@ class FacemarkKazemiImpl : public FacemarkKazemi{ ...@@ -70,12 +70,12 @@ class FacemarkKazemiImpl : public FacemarkKazemi{
public: public:
FacemarkKazemiImpl(const FacemarkKazemi::Params& parameters); FacemarkKazemiImpl(const FacemarkKazemi::Params& parameters);
void loadModel(String fs); void loadModel(String fs) CV_OVERRIDE;
bool setFaceDetector(FN_FaceDetector f, void* userdata); bool setFaceDetector(FN_FaceDetector f, void* userdata) CV_OVERRIDE;
bool getFaces(InputArray image, OutputArray faces); bool getFaces(InputArray image, OutputArray faces) CV_OVERRIDE;
bool fit(InputArray image, InputArray faces, InputOutputArray landmarks ); bool fit(InputArray image, InputArray faces, InputOutputArray landmarks) CV_OVERRIDE;
void training(String imageList, String groundTruth); void training(String imageList, String groundTruth) CV_OVERRIDE;
bool training(vector<Mat>& images, vector< vector<Point2f> >& landmarks,string filename,Size scale,string modelFilename); bool training(vector<Mat>& images, vector< vector<Point2f> >& landmarks,string filename,Size scale,string modelFilename) CV_OVERRIDE;
// Destructor for the class. // Destructor for the class.
virtual ~FacemarkKazemiImpl(); virtual ~FacemarkKazemiImpl();
...@@ -171,4 +171,4 @@ protected: ...@@ -171,4 +171,4 @@ protected:
}; };
}//face }//face
}//cv }//cv
#endif #endif
\ No newline at end of file
...@@ -92,24 +92,24 @@ void FacemarkAAM::Params::write( cv::FileStorage& fs ) const{ ...@@ -92,24 +92,24 @@ void FacemarkAAM::Params::write( cv::FileStorage& fs ) const{
class FacemarkAAMImpl : public FacemarkAAM { class FacemarkAAMImpl : public FacemarkAAM {
public: public:
FacemarkAAMImpl( const FacemarkAAM::Params &parameters = FacemarkAAM::Params() ); FacemarkAAMImpl( const FacemarkAAM::Params &parameters = FacemarkAAM::Params() );
void read( const FileNode& /*fn*/ ); void read( const FileNode& /*fn*/ ) CV_OVERRIDE;
void write( FileStorage& /*fs*/ ) const; void write( FileStorage& /*fs*/ ) const CV_OVERRIDE;
void saveModel(String fs); void saveModel(String fs);
void loadModel(String fs); void loadModel(String fs) CV_OVERRIDE;
bool setFaceDetector(bool(*f)(InputArray , OutputArray, void * ), void* userData); bool setFaceDetector(bool(*f)(InputArray , OutputArray, void * ), void* userData) CV_OVERRIDE;
bool getFaces(InputArray image, OutputArray faces); bool getFaces(InputArray image, OutputArray faces) CV_OVERRIDE;
bool getData(void * items); bool getData(void * items) CV_OVERRIDE;
protected: protected:
bool fit( InputArray image, InputArray faces, InputOutputArray landmarks, void * runtime_params);//!< from many ROIs bool fit( InputArray image, InputArray faces, InputOutputArray landmarks, void * runtime_params) CV_OVERRIDE;//!< from many ROIs
bool fitImpl( const Mat image, std::vector<Point2f>& landmarks,const Mat R,const Point2f T,const float scale, const int sclIdx=0 ); bool fitImpl( const Mat image, std::vector<Point2f>& landmarks,const Mat R,const Point2f T,const float scale, const int sclIdx=0 );
bool addTrainingSample(InputArray image, InputArray landmarks); bool addTrainingSample(InputArray image, InputArray landmarks) CV_OVERRIDE;
void training(void* parameters); void training(void* parameters) CV_OVERRIDE;
Mat procrustes(std::vector<Point2f> , std::vector<Point2f> , Mat & , Scalar & , float & ); Mat procrustes(std::vector<Point2f> , std::vector<Point2f> , Mat & , Scalar & , float & );
void calcMeanShape(std::vector<std::vector<Point2f> > ,std::vector<Point2f> & ); void calcMeanShape(std::vector<std::vector<Point2f> > ,std::vector<Point2f> & );
......
...@@ -102,24 +102,24 @@ class FacemarkLBFImpl : public FacemarkLBF { ...@@ -102,24 +102,24 @@ class FacemarkLBFImpl : public FacemarkLBF {
public: public:
FacemarkLBFImpl( const FacemarkLBF::Params &parameters = FacemarkLBF::Params() ); FacemarkLBFImpl( const FacemarkLBF::Params &parameters = FacemarkLBF::Params() );
void read( const FileNode& /*fn*/ ); void read( const FileNode& /*fn*/ ) CV_OVERRIDE;
void write( FileStorage& /*fs*/ ) const; void write( FileStorage& /*fs*/ ) const CV_OVERRIDE;
void loadModel(String fs); void loadModel(String fs) CV_OVERRIDE;
bool setFaceDetector(bool(*f)(InputArray , OutputArray, void * extra_params ), void* userData); bool setFaceDetector(bool(*f)(InputArray , OutputArray, void * extra_params ), void* userData) CV_OVERRIDE;
bool getFaces(InputArray image, OutputArray faces); bool getFaces(InputArray image, OutputArray faces) CV_OVERRIDE;
bool getData(void * items); bool getData(void * items) CV_OVERRIDE;
Params params; Params params;
protected: protected:
bool fit( InputArray image, InputArray faces, InputOutputArray landmarks, void * runtime_params );//!< from many ROIs bool fit( InputArray image, InputArray faces, InputOutputArray landmarks, void * runtime_params ) CV_OVERRIDE;//!< from many ROIs
bool fitImpl( const Mat image, std::vector<Point2f> & landmarks );//!< from a face bool fitImpl( const Mat image, std::vector<Point2f> & landmarks );//!< from a face
bool addTrainingSample(InputArray image, InputArray landmarks); bool addTrainingSample(InputArray image, InputArray landmarks) CV_OVERRIDE;
void training(void* parameters); void training(void* parameters) CV_OVERRIDE;
Rect getBBox(Mat &img, const Mat_<double> shape); Rect getBBox(Mat &img, const Mat_<double> shape);
void prepareTrainingData(Mat img, std::vector<Point2f> facePoints, void prepareTrainingData(Mat img, std::vector<Point2f> facePoints,
......
...@@ -38,11 +38,11 @@ public: ...@@ -38,11 +38,11 @@ public:
// Computes a Fisherfaces model with images in src and corresponding labels // Computes a Fisherfaces model with images in src and corresponding labels
// in labels. // in labels.
void train(InputArrayOfArrays src, InputArray labels); void train(InputArrayOfArrays src, InputArray labels) CV_OVERRIDE;
// Send all predict results to caller side for custom result handling // Send all predict results to caller side for custom result handling
void predict(InputArray src, Ptr<PredictCollector> collector) const; void predict(InputArray src, Ptr<PredictCollector> collector) const CV_OVERRIDE;
String getDefaultName() const String getDefaultName() const CV_OVERRIDE
{ {
return "opencv_fisherfaces"; return "opencv_fisherfaces";
} }
......
...@@ -81,40 +81,45 @@ public: ...@@ -81,40 +81,45 @@ public:
train(src, labels); train(src, labels);
} }
~LBPH() { } ~LBPH() CV_OVERRIDE { }
// Computes a LBPH model with images in src and // Computes a LBPH model with images in src and
// corresponding labels in labels. // corresponding labels in labels.
void train(InputArrayOfArrays src, InputArray labels); void train(InputArrayOfArrays src, InputArray labels) CV_OVERRIDE;
// Updates this LBPH model with images in src and // Updates this LBPH model with images in src and
// corresponding labels in labels. // corresponding labels in labels.
void update(InputArrayOfArrays src, InputArray labels); void update(InputArrayOfArrays src, InputArray labels) CV_OVERRIDE;
// Send all predict results to caller side for custom result handling // Send all predict results to caller side for custom result handling
void predict(InputArray src, Ptr<PredictCollector> collector) const; void predict(InputArray src, Ptr<PredictCollector> collector) const CV_OVERRIDE;
// See FaceRecognizer::write. // See FaceRecognizer::write.
void read(const FileNode& fn); void read(const FileNode& fn) CV_OVERRIDE;
// See FaceRecognizer::save. // See FaceRecognizer::save.
void write(FileStorage& fs) const; void write(FileStorage& fs) const CV_OVERRIDE;
bool empty() const { bool empty() const CV_OVERRIDE {
return (_labels.empty()); return (_labels.empty());
} }
String getDefaultName() const String getDefaultName() const CV_OVERRIDE
{ {
return "opencv_lbphfaces"; return "opencv_lbphfaces";
} }
CV_IMPL_PROPERTY(int, GridX, _grid_x) inline int getGridX() const CV_OVERRIDE { return _grid_x; }
CV_IMPL_PROPERTY(int, GridY, _grid_y) inline void setGridX(int val) CV_OVERRIDE { _grid_x = val; }
CV_IMPL_PROPERTY(int, Radius, _radius) inline int getGridY() const CV_OVERRIDE { return _grid_y; }
CV_IMPL_PROPERTY(int, Neighbors, _neighbors) inline void setGridY(int val) CV_OVERRIDE { _grid_y = val; }
CV_IMPL_PROPERTY(double, Threshold, _threshold) inline int getRadius() const CV_OVERRIDE { return _radius; }
CV_IMPL_PROPERTY_RO(std::vector<cv::Mat>, Histograms, _histograms) inline void setRadius(int val) CV_OVERRIDE { _radius = val; }
CV_IMPL_PROPERTY_RO(cv::Mat, Labels, _labels) inline int getNeighbors() const CV_OVERRIDE { return _neighbors; }
inline void setNeighbors(int val) CV_OVERRIDE { _neighbors = val; }
inline double getThreshold() const CV_OVERRIDE { return _threshold; }
inline void setThreshold(double val) CV_OVERRIDE { _threshold = val; }
inline std::vector<cv::Mat> getHistograms() const CV_OVERRIDE { return _histograms; }
inline cv::Mat getLabels() const CV_OVERRIDE { return _labels; }
}; };
......
...@@ -72,7 +72,7 @@ static uint64 crc64( const uchar* data, size_t size, uint64 crc0=0 ) ...@@ -72,7 +72,7 @@ static uint64 crc64( const uchar* data, size_t size, uint64 crc0=0 )
return ~crc; return ~crc;
} }
struct MACEImpl : MACE { struct MACEImpl CV_FINAL : MACE {
Mat_<Vec2d> maceFilter; // filled from compute() Mat_<Vec2d> maceFilter; // filled from compute()
Mat convFilter; // optional random convolution (cancellable) Mat convFilter; // optional random convolution (cancellable)
int IMGSIZE; // images will get resized to this int IMGSIZE; // images will get resized to this
...@@ -81,7 +81,7 @@ struct MACEImpl : MACE { ...@@ -81,7 +81,7 @@ struct MACEImpl : MACE {
MACEImpl(int siz) : IMGSIZE(siz), threshold(DBL_MAX) {} MACEImpl(int siz) : IMGSIZE(siz), threshold(DBL_MAX) {}
void salt(const String &passphrase) { void salt(const String &passphrase) CV_OVERRIDE {
theRNG().state = ((int64)crc64((uchar*)passphrase.c_str(), passphrase.size())); theRNG().state = ((int64)crc64((uchar*)passphrase.c_str(), passphrase.size()));
convFilter.create(IMGSIZE, IMGSIZE, CV_64F); convFilter.create(IMGSIZE, IMGSIZE, CV_64F);
randn(convFilter, 0, 1.0/(IMGSIZE*IMGSIZE)); randn(convFilter, 0, 1.0/(IMGSIZE*IMGSIZE));
...@@ -257,7 +257,7 @@ struct MACEImpl : MACE { ...@@ -257,7 +257,7 @@ struct MACEImpl : MACE {
} }
// MACE interface // MACE interface
void train(InputArrayOfArrays input) { void train(InputArrayOfArrays input) CV_OVERRIDE {
std::vector<Mat> images, dftImg; std::vector<Mat> images, dftImg;
input.getMatVector(images); input.getMatVector(images);
for (size_t i=0; i<images.size(); i++) { // cache dft images for (size_t i=0; i<images.size(); i++) { // cache dft images
...@@ -266,27 +266,27 @@ struct MACEImpl : MACE { ...@@ -266,27 +266,27 @@ struct MACEImpl : MACE {
compute(dftImg, true); compute(dftImg, true);
threshold = computeThreshold(dftImg, true); threshold = computeThreshold(dftImg, true);
} }
bool same(InputArray img) const { bool same(InputArray img) const CV_OVERRIDE {
return correlate(img.getMat()) >= threshold; return correlate(img.getMat()) >= threshold;
} }
// cv::Algorithm: // cv::Algorithm:
bool empty() const { bool empty() const CV_OVERRIDE {
return maceFilter.empty() || IMGSIZE == 0; return maceFilter.empty() || IMGSIZE == 0;
} }
String getDefaultName () const { String getDefaultName () const CV_OVERRIDE {
return String("MACE"); return String("MACE");
} }
void clear() { void clear() CV_OVERRIDE {
maceFilter.release(); maceFilter.release();
convFilter.release(); convFilter.release();
} }
void write(cv::FileStorage &fs) const { void write(cv::FileStorage &fs) const CV_OVERRIDE {
fs << "mace" << maceFilter; fs << "mace" << maceFilter;
fs << "conv" << convFilter; fs << "conv" << convFilter;
fs << "threshold" << threshold; fs << "threshold" << threshold;
} }
void read(const cv::FileNode &fn) { void read(const cv::FileNode &fn) CV_OVERRIDE {
fn["mace"] >> maceFilter; fn["mace"] >> maceFilter;
fn["conv"] >> convFilter; fn["conv"] >> convFilter;
fn["threshold"] >> threshold; fn["threshold"] >> threshold;
......
...@@ -18,7 +18,7 @@ class doSum : public ParallelLoopBody ...@@ -18,7 +18,7 @@ class doSum : public ParallelLoopBody
sum(sum_) sum(sum_)
{ {
} }
virtual void operator()( const Range& range) const virtual void operator()( const Range& range) const CV_OVERRIDE
{ {
for (int j = range.start; j < range.end; ++j){ for (int j = range.start; j < range.end; ++j){
for(unsigned long k=0;k<(*samples)[j].shapeResiduals.size();k++){ for(unsigned long k=0;k<(*samples)[j].shapeResiduals.size();k++){
...@@ -38,7 +38,7 @@ class modifySamples : public ParallelLoopBody ...@@ -38,7 +38,7 @@ class modifySamples : public ParallelLoopBody
temp(temp_) temp(temp_)
{ {
} }
virtual void operator()( const Range& range) const virtual void operator()( const Range& range) const CV_OVERRIDE
{ {
for (int j = range.start; j < range.end; ++j){ for (int j = range.start; j < range.end; ++j){
for(unsigned long k=0;k<(*samples)[j].shapeResiduals.size();k++){ for(unsigned long k=0;k<(*samples)[j].shapeResiduals.size();k++){
...@@ -62,7 +62,7 @@ class splitSamples : public ParallelLoopBody ...@@ -62,7 +62,7 @@ class splitSamples : public ParallelLoopBody
feats(feats_) feats(feats_)
{ {
} }
virtual void operator()( const Range& range) const virtual void operator()( const Range& range) const CV_OVERRIDE
{ {
for (int i = range.start; i < range.end; ++i){ for (int i = range.start; i < range.end; ++i){
for(unsigned long j=0;j<*(num_test_splits);j++){ for(unsigned long j=0;j<*(num_test_splits);j++){
...@@ -310,4 +310,4 @@ unsigned long FacemarkKazemiImpl::divideSamples (splitr split,vector<training_sa ...@@ -310,4 +310,4 @@ unsigned long FacemarkKazemiImpl::divideSamples (splitr split,vector<training_sa
return i; return i;
} }
}//cv }//cv
}//face }//face
\ No newline at end of file
...@@ -18,7 +18,7 @@ class getDiffShape : public ParallelLoopBody ...@@ -18,7 +18,7 @@ class getDiffShape : public ParallelLoopBody
samples(samples_) samples(samples_)
{ {
} }
virtual void operator()( const cv::Range& range) const virtual void operator()( const cv::Range& range) const CV_OVERRIDE
{ {
for(size_t j = (size_t)range.start; j < (size_t)range.end; ++j){ for(size_t j = (size_t)range.start; j < (size_t)range.end; ++j){
(*samples)[j].shapeResiduals.resize((*samples)[j].current_shape.size()); (*samples)[j].shapeResiduals.resize((*samples)[j].current_shape.size());
...@@ -37,7 +37,7 @@ class getRelPixels : public ParallelLoopBody ...@@ -37,7 +37,7 @@ class getRelPixels : public ParallelLoopBody
object(object_) object(object_)
{ {
} }
virtual void operator()( const cv::Range& range) const virtual void operator()( const cv::Range& range) const CV_OVERRIDE
{ {
for (size_t j = (size_t)range.start; j < (size_t)range.end; ++j){ for (size_t j = (size_t)range.start; j < (size_t)range.end; ++j){
object.getRelativePixels(((*samples)[j]).current_shape,((*samples)[j]).pixel_coordinates); object.getRelativePixels(((*samples)[j]).current_shape,((*samples)[j]).pixel_coordinates);
...@@ -345,4 +345,4 @@ bool FacemarkKazemiImpl::training(vector<Mat>& images, vector< vector<Point2f> > ...@@ -345,4 +345,4 @@ bool FacemarkKazemiImpl::training(vector<Mat>& images, vector< vector<Point2f> >
return true; return true;
} }
}//cv }//cv
}//face }//face
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment