00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef __OPENCV_CONTRIB_HPP__
00044 #define __OPENCV_CONTRIB_HPP__
00045
00046 #include "opencv2/core/core.hpp"
00047 #include "opencv2/imgproc/imgproc.hpp"
00048 #include "opencv2/features2d/features2d.hpp"
00049 #include "opencv2/objdetect/objdetect.hpp"
00050
00051 #ifdef __cplusplus
00052
00053
00054
00055
00056
00057 class CV_EXPORTS CvAdaptiveSkinDetector
00058 {
00059 private:
00060 enum {
00061 GSD_HUE_LT = 3,
00062 GSD_HUE_UT = 33,
00063 GSD_INTENSITY_LT = 15,
00064 GSD_INTENSITY_UT = 250
00065 };
00066
00067 class CV_EXPORTS Histogram
00068 {
00069 private:
00070 enum {
00071 HistogramSize = (GSD_HUE_UT - GSD_HUE_LT + 1)
00072 };
00073
00074 protected:
00075 int findCoverageIndex(double surfaceToCover, int defaultValue = 0);
00076
00077 public:
00078 CvHistogram *fHistogram;
00079 Histogram();
00080 virtual ~Histogram();
00081
00082 void findCurveThresholds(int &x1, int &x2, double percent = 0.05);
00083 void mergeWith(Histogram *source, double weight);
00084 };
00085
00086 int nStartCounter, nFrameCount, nSkinHueLowerBound, nSkinHueUpperBound, nMorphingMethod, nSamplingDivider;
00087 double fHistogramMergeFactor, fHuePercentCovered;
00088 Histogram histogramHueMotion, skinHueHistogram;
00089 IplImage *imgHueFrame, *imgSaturationFrame, *imgLastGrayFrame, *imgMotionFrame, *imgFilteredFrame;
00090 IplImage *imgShrinked, *imgTemp, *imgGrayFrame, *imgHSVFrame;
00091
00092 protected:
00093 void initData(IplImage *src, int widthDivider, int heightDivider);
00094 void adaptiveFilter();
00095
00096 public:
00097
00098 enum {
00099 MORPHING_METHOD_NONE = 0,
00100 MORPHING_METHOD_ERODE = 1,
00101 MORPHING_METHOD_ERODE_ERODE = 2,
00102 MORPHING_METHOD_ERODE_DILATE = 3
00103 };
00104
00105 CvAdaptiveSkinDetector(int samplingDivider = 1, int morphingMethod = MORPHING_METHOD_NONE);
00106 virtual ~CvAdaptiveSkinDetector();
00107
00108 virtual void process(IplImage *inputBGRImage, IplImage *outputHueMask);
00109 };
00110
00111
00112
00113
00114
00115
00116 class CV_EXPORTS CvFuzzyPoint {
00117 public:
00118 double x, y, value;
00119
00120 CvFuzzyPoint(double _x, double _y);
00121 };
00122
00123 class CV_EXPORTS CvFuzzyCurve {
00124 private:
00125 std::vector<CvFuzzyPoint> points;
00126 double value, centre;
00127
00128 bool between(double x, double x1, double x2);
00129
00130 public:
00131 CvFuzzyCurve();
00132 ~CvFuzzyCurve();
00133
00134 void setCentre(double _centre);
00135 double getCentre();
00136 void clear();
00137 void addPoint(double x, double y);
00138 double calcValue(double param);
00139 double getValue();
00140 void setValue(double _value);
00141 };
00142
00143 class CV_EXPORTS CvFuzzyFunction {
00144 public:
00145 std::vector<CvFuzzyCurve> curves;
00146
00147 CvFuzzyFunction();
00148 ~CvFuzzyFunction();
00149 void addCurve(CvFuzzyCurve *curve, double value = 0);
00150 void resetValues();
00151 double calcValue();
00152 CvFuzzyCurve *newCurve();
00153 };
00154
00155 class CV_EXPORTS CvFuzzyRule {
00156 private:
00157 CvFuzzyCurve *fuzzyInput1, *fuzzyInput2;
00158 CvFuzzyCurve *fuzzyOutput;
00159 public:
00160 CvFuzzyRule();
00161 ~CvFuzzyRule();
00162 void setRule(CvFuzzyCurve *c1, CvFuzzyCurve *c2, CvFuzzyCurve *o1);
00163 double calcValue(double param1, double param2);
00164 CvFuzzyCurve *getOutputCurve();
00165 };
00166
00167 class CV_EXPORTS CvFuzzyController {
00168 private:
00169 std::vector<CvFuzzyRule*> rules;
00170 public:
00171 CvFuzzyController();
00172 ~CvFuzzyController();
00173 void addRule(CvFuzzyCurve *c1, CvFuzzyCurve *c2, CvFuzzyCurve *o1);
00174 double calcOutput(double param1, double param2);
00175 };
00176
00177 class CV_EXPORTS CvFuzzyMeanShiftTracker
00178 {
00179 private:
00180 class FuzzyResizer
00181 {
00182 private:
00183 CvFuzzyFunction iInput, iOutput;
00184 CvFuzzyController fuzzyController;
00185 public:
00186 FuzzyResizer();
00187 int calcOutput(double edgeDensity, double density);
00188 };
00189
00190 class SearchWindow
00191 {
00192 public:
00193 FuzzyResizer *fuzzyResizer;
00194 int x, y;
00195 int width, height, maxWidth, maxHeight, ellipseHeight, ellipseWidth;
00196 int ldx, ldy, ldw, ldh, numShifts, numIters;
00197 int xGc, yGc;
00198 long m00, m01, m10, m11, m02, m20;
00199 double ellipseAngle;
00200 double density;
00201 unsigned int depthLow, depthHigh;
00202 int verticalEdgeLeft, verticalEdgeRight, horizontalEdgeTop, horizontalEdgeBottom;
00203
00204 SearchWindow();
00205 ~SearchWindow();
00206 void setSize(int _x, int _y, int _width, int _height);
00207 void initDepthValues(IplImage *maskImage, IplImage *depthMap);
00208 bool shift();
00209 void extractInfo(IplImage *maskImage, IplImage *depthMap, bool initDepth);
00210 void getResizeAttribsEdgeDensityLinear(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
00211 void getResizeAttribsInnerDensity(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
00212 void getResizeAttribsEdgeDensityFuzzy(int &resizeDx, int &resizeDy, int &resizeDw, int &resizeDh);
00213 bool meanShift(IplImage *maskImage, IplImage *depthMap, int maxIteration, bool initDepth);
00214 };
00215
00216 public:
00217 enum TrackingState
00218 {
00219 tsNone = 0,
00220 tsSearching = 1,
00221 tsTracking = 2,
00222 tsSetWindow = 3,
00223 tsDisabled = 10
00224 };
00225
00226 enum ResizeMethod {
00227 rmEdgeDensityLinear = 0,
00228 rmEdgeDensityFuzzy = 1,
00229 rmInnerDensity = 2
00230 };
00231
00232 enum {
00233 MinKernelMass = 1000
00234 };
00235
00236 SearchWindow kernel;
00237 int searchMode;
00238
00239 private:
00240 enum
00241 {
00242 MaxMeanShiftIteration = 5,
00243 MaxSetSizeIteration = 5
00244 };
00245
00246 void findOptimumSearchWindow(SearchWindow &searchWindow, IplImage *maskImage, IplImage *depthMap, int maxIteration, int resizeMethod, bool initDepth);
00247
00248 public:
00249 CvFuzzyMeanShiftTracker();
00250 ~CvFuzzyMeanShiftTracker();
00251
00252 void track(IplImage *maskImage, IplImage *depthMap, int resizeMethod, bool resetSearch, int minKernelMass = MinKernelMass);
00253 };
00254
00255
00256 namespace cv
00257 {
00258
00259 class CV_EXPORTS Octree
00260 {
00261 public:
00262 struct Node
00263 {
00264 Node() {}
00265 int begin, end;
00266 float x_min, x_max, y_min, y_max, z_min, z_max;
00267 int maxLevels;
00268 bool isLeaf;
00269 int children[8];
00270 };
00271
00272 Octree();
00273 Octree( const vector<Point3f>& points, int maxLevels = 10, int minPoints = 20 );
00274 virtual ~Octree();
00275
00276 virtual void buildTree( const vector<Point3f>& points, int maxLevels = 10, int minPoints = 20 );
00277 virtual void getPointsWithinSphere( const Point3f& center, float radius,
00278 vector<Point3f>& points ) const;
00279 const vector<Node>& getNodes() const { return nodes; }
00280 private:
00281 int minPoints;
00282 vector<Point3f> points;
00283 vector<Node> nodes;
00284
00285 virtual void buildNext(size_t node_ind);
00286 };
00287
00288
00289 class CV_EXPORTS Mesh3D
00290 {
00291 public:
00292 struct EmptyMeshException {};
00293
00294 Mesh3D();
00295 Mesh3D(const vector<Point3f>& vtx);
00296 ~Mesh3D();
00297
00298 void buildOctree();
00299 void clearOctree();
00300 float estimateResolution(float tryRatio = 0.1f);
00301 void computeNormals(float normalRadius, int minNeighbors = 20);
00302 void computeNormals(const vector<int>& subset, float normalRadius, int minNeighbors = 20);
00303
00304 void writeAsVrml(const String& file, const vector<Scalar>& colors = vector<Scalar>()) const;
00305
00306 vector<Point3f> vtx;
00307 vector<Point3f> normals;
00308 float resolution;
00309 Octree octree;
00310
00311 const static Point3f allzero;
00312 };
00313
00314 class CV_EXPORTS SpinImageModel
00315 {
00316 public:
00317
00318
00319 float normalRadius;
00320 int minNeighbors;
00321
00322 float binSize;
00323 int imageWidth;
00324
00325 float lambda;
00326 float gamma;
00327
00328 float T_GeometriccConsistency;
00329 float T_GroupingCorespondances;
00330
00331
00332 SpinImageModel();
00333 explicit SpinImageModel(const Mesh3D& mesh);
00334 ~SpinImageModel();
00335
00336 void setLogger(std::ostream* log);
00337 void selectRandomSubset(float ratio);
00338 void setSubset(const vector<int>& subset);
00339 void compute();
00340
00341 void match(const SpinImageModel& scene, vector< vector<Vec2i> >& result);
00342
00343 Mat packRandomScaledSpins(bool separateScale = false, size_t xCount = 10, size_t yCount = 10) const;
00344
00345 size_t getSpinCount() const { return spinImages.rows; }
00346 Mat getSpinImage(size_t index) const { return spinImages.row((int)index); }
00347 const Point3f& getSpinVertex(size_t index) const { return mesh.vtx[subset[index]]; }
00348 const Point3f& getSpinNormal(size_t index) const { return mesh.normals[subset[index]]; }
00349
00350 const Mesh3D& getMesh() const { return mesh; }
00351 Mesh3D& getMesh() { return mesh; }
00352
00353
00354 static bool spinCorrelation(const Mat& spin1, const Mat& spin2, float lambda, float& result);
00355
00356 static Point2f calcSpinMapCoo(const Point3f& point, const Point3f& vertex, const Point3f& normal);
00357
00358 static float geometricConsistency(const Point3f& pointScene1, const Point3f& normalScene1,
00359 const Point3f& pointModel1, const Point3f& normalModel1,
00360 const Point3f& pointScene2, const Point3f& normalScene2,
00361 const Point3f& pointModel2, const Point3f& normalModel2);
00362
00363 static float groupingCreteria(const Point3f& pointScene1, const Point3f& normalScene1,
00364 const Point3f& pointModel1, const Point3f& normalModel1,
00365 const Point3f& pointScene2, const Point3f& normalScene2,
00366 const Point3f& pointModel2, const Point3f& normalModel2,
00367 float gamma);
00368 protected:
00369 void defaultParams();
00370
00371 void matchSpinToModel(const Mat& spin, vector<int>& indeces,
00372 vector<float>& corrCoeffs, bool useExtremeOutliers = true) const;
00373
00374 void repackSpinImages(const vector<uchar>& mask, Mat& spinImages, bool reAlloc = true) const;
00375
00376 vector<int> subset;
00377 Mesh3D mesh;
00378 Mat spinImages;
00379 std::ostream* out;
00380 };
00381
00382 class CV_EXPORTS TickMeter
00383 {
00384 public:
00385 TickMeter();
00386 void start();
00387 void stop();
00388
00389 int64 getTimeTicks() const;
00390 double getTimeMicro() const;
00391 double getTimeMilli() const;
00392 double getTimeSec() const;
00393 int64 getCounter() const;
00394
00395 void reset();
00396 private:
00397 int64 counter;
00398 int64 sumTime;
00399 int64 startTime;
00400 };
00401
00402 CV_EXPORTS std::ostream& operator<<(std::ostream& out, const TickMeter& tm);
00403
00404 class CV_EXPORTS SelfSimDescriptor
00405 {
00406 public:
00407 SelfSimDescriptor();
00408 SelfSimDescriptor(int _ssize, int _lsize,
00409 int _startDistanceBucket=DEFAULT_START_DISTANCE_BUCKET,
00410 int _numberOfDistanceBuckets=DEFAULT_NUM_DISTANCE_BUCKETS,
00411 int _nangles=DEFAULT_NUM_ANGLES);
00412 SelfSimDescriptor(const SelfSimDescriptor& ss);
00413 virtual ~SelfSimDescriptor();
00414 SelfSimDescriptor& operator = (const SelfSimDescriptor& ss);
00415
00416 size_t getDescriptorSize() const;
00417 Size getGridSize( Size imgsize, Size winStride ) const;
00418
00419 virtual void compute(const Mat& img, vector<float>& descriptors, Size winStride=Size(),
00420 const vector<Point>& locations=vector<Point>()) const;
00421 virtual void computeLogPolarMapping(Mat& mappingMask) const;
00422 virtual void SSD(const Mat& img, Point pt, Mat& ssd) const;
00423
00424 int smallSize;
00425 int largeSize;
00426 int startDistanceBucket;
00427 int numberOfDistanceBuckets;
00428 int numberOfAngles;
00429
00430 enum { DEFAULT_SMALL_SIZE = 5, DEFAULT_LARGE_SIZE = 41,
00431 DEFAULT_NUM_ANGLES = 20, DEFAULT_START_DISTANCE_BUCKET = 3,
00432 DEFAULT_NUM_DISTANCE_BUCKETS = 7 };
00433 };
00434
00435
00436 typedef bool (*BundleAdjustCallback)(int iteration, double norm_error, void* user_data);
00437
00438 class LevMarqSparse {
00439 public:
00440 LevMarqSparse();
00441 LevMarqSparse(int npoints,
00442 int ncameras,
00443 int nPointParams,
00444 int nCameraParams,
00445 int nErrParams,
00446
00447 Mat& visibility,
00448
00449 Mat& P0,
00450 Mat& X,
00451 TermCriteria criteria,
00452
00453
00454 void (CV_CDECL * fjac)(int i, int j, Mat& point_params,
00455 Mat& cam_params, Mat& A, Mat& B, void* data),
00456
00457 void (CV_CDECL * func)(int i, int j, Mat& point_params,
00458 Mat& cam_params, Mat& estim, void* data),
00459 void* data,
00460 BundleAdjustCallback cb, void* user_data
00461 );
00462
00463 virtual ~LevMarqSparse();
00464
00465 virtual void run( int npoints,
00466 int ncameras,
00467 int nPointParams,
00468 int nCameraParams,
00469 int nErrParams,
00470
00471 Mat& visibility,
00472
00473 Mat& P0,
00474 Mat& X,
00475 TermCriteria criteria,
00476
00477
00478 void (CV_CDECL * fjac)(int i, int j, Mat& point_params,
00479 Mat& cam_params, Mat& A, Mat& B, void* data),
00480
00481 void (CV_CDECL * func)(int i, int j, Mat& point_params,
00482 Mat& cam_params, Mat& estim, void* data),
00483 void* data
00484 );
00485
00486 virtual void clear();
00487
00488
00489 static void bundleAdjust(vector<Point3d>& points,
00490 const vector<vector<Point2d> >& imagePoints,
00491 const vector<vector<int> >& visibility,
00492 vector<Mat>& cameraMatrix,
00493 vector<Mat>& R,
00494 vector<Mat>& T,
00495 vector<Mat>& distCoeffs,
00496 const TermCriteria& criteria=
00497 TermCriteria(TermCriteria::COUNT+TermCriteria::EPS, 30, DBL_EPSILON),
00498 BundleAdjustCallback cb = 0, void* user_data = 0);
00499
00500 public:
00501 virtual void optimize(CvMat &_vis);
00502
00503
00504 void ask_for_proj(CvMat &_vis,bool once=false);
00505
00506 void ask_for_projac(CvMat &_vis);
00507
00508 CvMat* err;
00509 double prevErrNorm, errNorm;
00510 double lambda;
00511 CvTermCriteria criteria;
00512 int iters;
00513
00514 CvMat** U;
00515 CvMat** V;
00516 CvMat** inv_V_star;
00517
00518 CvMat** A;
00519 CvMat** B;
00520 CvMat** W;
00521
00522 CvMat* X;
00523 CvMat* hX;
00524
00525 CvMat* prevP;
00526 CvMat* P;
00527
00528
00529 CvMat* deltaP;
00530
00531 CvMat** ea;
00532
00533 CvMat** eb;
00534
00535
00536 CvMat** Yj;
00537
00538 CvMat* S;
00539
00540 CvMat* JtJ_diag;
00541
00542 CvMat* Vis_index;
00543
00544 int num_cams;
00545 int num_points;
00546 int num_err_param;
00547 int num_cam_param;
00548 int num_point_param;
00549
00550
00551 void (*fjac)(int i, int j, Mat& point_params, Mat& cam_params, Mat& A, Mat& B, void* data);
00552 void (*func)(int i, int j, Mat& point_params, Mat& cam_params, Mat& estim, void* data);
00553
00554 void* data;
00555
00556 BundleAdjustCallback cb;
00557 void* user_data;
00558 };
00559
00560 CV_EXPORTS_W int chamerMatching( Mat& img, Mat& templ,
00561 CV_OUT vector<vector<Point> >& results, CV_OUT vector<float>& cost,
00562 double templScale=1, int maxMatches = 20,
00563 double minMatchDistance = 1.0, int padX = 3,
00564 int padY = 3, int scales = 5, double minScale = 0.6, double maxScale = 1.6,
00565 double orientationWeight = 0.5, double truncate = 20);
00566
00567
00568 class CV_EXPORTS_W StereoVar
00569 {
00570 public:
00571
00572 enum {USE_INITIAL_DISPARITY = 1, USE_EQUALIZE_HIST = 2, USE_SMART_ID = 4, USE_AUTO_PARAMS = 8, USE_MEDIAN_FILTERING = 16};
00573 enum {CYCLE_O, CYCLE_V};
00574 enum {PENALIZATION_TICHONOV, PENALIZATION_CHARBONNIER, PENALIZATION_PERONA_MALIK};
00575
00577 CV_WRAP StereoVar();
00578
00580 CV_WRAP StereoVar(int levels, double pyrScale, int nIt, int minDisp, int maxDisp, int poly_n, double poly_sigma, float fi, float lambda, int penalization, int cycle, int flags);
00581
00583 virtual ~StereoVar();
00584
00586 CV_WRAP_AS(compute) virtual void operator()(const Mat& left, const Mat& right, Mat& disp);
00587
00588 CV_PROP_RW int levels;
00589 CV_PROP_RW double pyrScale;
00590 CV_PROP_RW int nIt;
00591 CV_PROP_RW int minDisp;
00592 CV_PROP_RW int maxDisp;
00593 CV_PROP_RW int poly_n;
00594 CV_PROP_RW double poly_sigma;
00595 CV_PROP_RW float fi;
00596 CV_PROP_RW float lambda;
00597 CV_PROP_RW int penalization;
00598 CV_PROP_RW int cycle;
00599 CV_PROP_RW int flags;
00600
00601 private:
00602 void autoParams();
00603 void FMG(Mat &I1, Mat &I2, Mat &I2x, Mat &u, int level);
00604 void VCycle_MyFAS(Mat &I1_h, Mat &I2_h, Mat &I2x_h, Mat &u_h, int level);
00605 void VariationalSolver(Mat &I1_h, Mat &I2_h, Mat &I2x_h, Mat &u_h, int level);
00606 };
00607
00608 CV_EXPORTS void polyfit(const Mat& srcx, const Mat& srcy, Mat& dst, int order);
00609
00610 class CV_EXPORTS Directory
00611 {
00612 public:
00613 static std::vector<std::string> GetListFiles ( const std::string& path, const std::string & exten = "*", bool addPath = true );
00614 static std::vector<std::string> GetListFilesR ( const std::string& path, const std::string & exten = "*", bool addPath = true );
00615 static std::vector<std::string> GetListFolders( const std::string& path, const std::string & exten = "*", bool addPath = true );
00616 };
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626 CV_EXPORTS void generateColors( std::vector<Scalar>& colors, size_t count, size_t factor=100 );
00627
00628
00629
00630
00631
00632
00633 enum { ROTATION = 1,
00634 TRANSLATION = 2,
00635 RIGID_BODY_MOTION = 4
00636 };
00637 CV_EXPORTS bool RGBDOdometry( Mat& Rt, const Mat& initRt,
00638 const Mat& image0, const Mat& depth0, const Mat& mask0,
00639 const Mat& image1, const Mat& depth1, const Mat& mask1,
00640 const Mat& cameraMatrix, float minDepth=0.f, float maxDepth=4.f, float maxDepthDiff=0.07f,
00641 const std::vector<int>& iterCounts=std::vector<int>(),
00642 const std::vector<float>& minGradientMagnitudes=std::vector<float>(),
00643 int transformType=RIGID_BODY_MOTION );
00644
00654 class CV_EXPORTS LogPolar_Interp
00655 {
00656 public:
00657
00658 LogPolar_Interp() {}
00659
00674 LogPolar_Interp(int w, int h, Point2i center, int R=70, double ro0=3.0,
00675 int interp=INTER_LINEAR, int full=1, int S=117, int sp=1);
00681 const Mat to_cortical(const Mat &source);
00687 const Mat to_cartesian(const Mat &source);
00691 ~LogPolar_Interp();
00692
00693 protected:
00694
00695 Mat Rsri;
00696 Mat Csri;
00697
00698 int S, R, M, N;
00699 int top, bottom,left,right;
00700 double ro0, romax, a, q;
00701 int interp;
00702
00703 Mat ETAyx;
00704 Mat CSIyx;
00705
00706 void create_map(int M, int N, int R, int S, double ro0);
00707 };
00708
00718 class CV_EXPORTS LogPolar_Overlapping
00719 {
00720 public:
00721 LogPolar_Overlapping() {}
00722
00737 LogPolar_Overlapping(int w, int h, Point2i center, int R=70,
00738 double ro0=3.0, int full=1, int S=117, int sp=1);
00744 const Mat to_cortical(const Mat &source);
00750 const Mat to_cartesian(const Mat &source);
00754 ~LogPolar_Overlapping();
00755
00756 protected:
00757
00758 Mat Rsri;
00759 Mat Csri;
00760 vector<int> Rsr;
00761 vector<int> Csr;
00762 vector<double> Wsr;
00763
00764 int S, R, M, N, ind1;
00765 int top, bottom,left,right;
00766 double ro0, romax, a, q;
00767
00768 struct kernel
00769 {
00770 kernel() { w = 0; }
00771 vector<double> weights;
00772 int w;
00773 };
00774
00775 Mat ETAyx;
00776 Mat CSIyx;
00777 vector<kernel> w_ker_2D;
00778
00779 void create_map(int M, int N, int R, int S, double ro0);
00780 };
00781
00792 class CV_EXPORTS LogPolar_Adjacent
00793 {
00794 public:
00795 LogPolar_Adjacent() {}
00796
00812 LogPolar_Adjacent(int w, int h, Point2i center, int R=70, double ro0=3.0, double smin=0.25, int full=1, int S=117, int sp=1);
00818 const Mat to_cortical(const Mat &source);
00824 const Mat to_cartesian(const Mat &source);
00828 ~LogPolar_Adjacent();
00829
00830 protected:
00831 struct pixel
00832 {
00833 pixel() { u = v = 0; a = 0.; }
00834 int u;
00835 int v;
00836 double a;
00837 };
00838 int S, R, M, N;
00839 int top, bottom,left,right;
00840 double ro0, romax, a, q;
00841 vector<vector<pixel> > L;
00842 vector<double> A;
00843
00844 void subdivide_recursively(double x, double y, int i, int j, double length, double smin);
00845 bool get_uv(double x, double y, int&u, int&v);
00846 void create_map(int M, int N, int R, int S, double ro0, double smin);
00847 };
00848
00849 CV_EXPORTS Mat subspaceProject(InputArray W, InputArray mean, InputArray src);
00850 CV_EXPORTS Mat subspaceReconstruct(InputArray W, InputArray mean, InputArray src);
00851
00852 class CV_EXPORTS LDA
00853 {
00854 public:
00855
00856
00857 LDA(int num_components = 0) :
00858 _num_components(num_components) {};
00859
00860
00861
00862
00863
00864 LDA(const Mat& src, vector<int> labels,
00865 int num_components = 0) :
00866 _num_components(num_components)
00867 {
00868 this->compute(src, labels);
00869 }
00870
00871
00872
00873
00874
00875 LDA(InputArrayOfArrays src, InputArray labels,
00876 int num_components = 0) :
00877 _num_components(num_components)
00878 {
00879 this->compute(src, labels);
00880 }
00881
00882
00883 void save(const string& filename) const;
00884
00885
00886 void load(const string& filename);
00887
00888
00889 void save(FileStorage& fs) const;
00890
00891
00892 void load(const FileStorage& node);
00893
00894
00895 ~LDA() {}
00896
00898 void compute(InputArrayOfArrays src, InputArray labels);
00899
00900
00901 Mat project(InputArray src);
00902
00903
00904 Mat reconstruct(InputArray src);
00905
00906
00907 Mat eigenvectors() const { return _eigenvectors; };
00908
00909
00910 Mat eigenvalues() const { return _eigenvalues; }
00911
00912 protected:
00913 bool _dataAsRow;
00914 int _num_components;
00915 Mat _eigenvectors;
00916 Mat _eigenvalues;
00917
00918 void lda(InputArrayOfArrays src, InputArray labels);
00919 };
00920
00921 class CV_EXPORTS_W FaceRecognizer : public Algorithm
00922 {
00923 public:
00925 virtual ~FaceRecognizer() {}
00926
00927
00928 CV_WRAP virtual void train(InputArrayOfArrays src, InputArray labels) = 0;
00929
00930
00931 CV_WRAP void update(InputArrayOfArrays src, InputArray labels);
00932
00933
00934 virtual int predict(InputArray src) const = 0;
00935
00936
00937 CV_WRAP virtual void predict(InputArray src, CV_OUT int &label, CV_OUT double &confidence) const = 0;
00938
00939
00940 CV_WRAP virtual void save(const string& filename) const;
00941
00942
00943 CV_WRAP virtual void load(const string& filename);
00944
00945
00946 virtual void save(FileStorage& fs) const = 0;
00947
00948
00949 virtual void load(const FileStorage& fs) = 0;
00950
00951 };
00952
00953 CV_EXPORTS_W Ptr<FaceRecognizer> createEigenFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
00954 CV_EXPORTS_W Ptr<FaceRecognizer> createFisherFaceRecognizer(int num_components = 0, double threshold = DBL_MAX);
00955 CV_EXPORTS_W Ptr<FaceRecognizer> createLBPHFaceRecognizer(int radius=1, int neighbors=8,
00956 int grid_x=8, int grid_y=8, double threshold = DBL_MAX);
00957
00958 enum
00959 {
00960 COLORMAP_AUTUMN = 0,
00961 COLORMAP_BONE = 1,
00962 COLORMAP_JET = 2,
00963 COLORMAP_WINTER = 3,
00964 COLORMAP_RAINBOW = 4,
00965 COLORMAP_OCEAN = 5,
00966 COLORMAP_SUMMER = 6,
00967 COLORMAP_SPRING = 7,
00968 COLORMAP_COOL = 8,
00969 COLORMAP_HSV = 9,
00970 COLORMAP_PINK = 10,
00971 COLORMAP_HOT = 11
00972 };
00973
00974 CV_EXPORTS_W void applyColorMap(InputArray src, OutputArray dst, int colormap);
00975
00976 CV_EXPORTS bool initModule_contrib();
00977 }
00978
00979 #include "opencv2/contrib/retina.hpp"
00980
00981 #include "opencv2/contrib/openfabmap.hpp"
00982
00983 #endif
00984
00985 #endif
00986