Added to CV_INIT_ALGORITHM a Ptr creation function, for convenience.

Also changed the static functions to inline, to stop GCC complaining
about unused functions.
pull/1281/head
Roman Donchenko 12 years ago
parent dadee3752c
commit 24dee16b12
  1. 2
      modules/contrib/src/facerec.cpp
  2. 9
      modules/core/include/opencv2/core/private.hpp
  3. 2
      modules/ml/src/ml_init.cpp
  4. 2
      modules/nonfree/src/nonfree_init.cpp
  5. 4
      modules/softcascade/src/softcascade_init.cpp

@ -894,7 +894,7 @@ CV_INIT_ALGORITHM(LBPH, "FaceRecognizer.LBPH",
bool initModule_contrib()
{
Ptr<Algorithm> efaces = createEigenfaces_hidden(), ffaces = createFisherfaces_hidden(), lbph = createLBPH_hidden();
Ptr<Algorithm> efaces = createEigenfaces_ptr_hidden(), ffaces = createFisherfaces_ptr_hidden(), lbph = createLBPH_ptr_hidden();
return efaces->info() != 0 && ffaces->info() != 0 && lbph->info() != 0;
}

@ -128,12 +128,17 @@ namespace cv
} //namespace cv
#define CV_INIT_ALGORITHM(classname, algname, memberinit) \
static ::cv::Algorithm* create##classname##_hidden() \
static inline ::cv::Algorithm* create##classname##_hidden() \
{ \
return new classname; \
} \
\
static ::cv::AlgorithmInfo& classname##_info() \
static inline ::cv::Ptr< ::cv::Algorithm> create##classname##_ptr_hidden() \
{ \
return ::cv::makePtr<classname>(); \
} \
\
static inline ::cv::AlgorithmInfo& classname##_info() \
{ \
static ::cv::AlgorithmInfo classname##_info_var(algname, create##classname##_hidden); \
return classname##_info_var; \

@ -56,7 +56,7 @@ CV_INIT_ALGORITHM(EM, "StatModel.EM",
bool initModule_ml(void)
{
Ptr<Algorithm> em = createEM_hidden();
Ptr<Algorithm> em = createEM_ptr_hidden();
return em->info() != 0;
}

@ -67,7 +67,7 @@ CV_INIT_ALGORITHM(SIFT, "Feature2D.SIFT",
bool initModule_nonfree(void)
{
Ptr<Algorithm> sift = createSIFT_hidden(), surf = createSURF_hidden();
Ptr<Algorithm> sift = createSIFT_ptr_hidden(), surf = createSURF_ptr_hidden();
return sift->info() != 0 && surf->info() != 0;
}

@ -58,8 +58,8 @@ CV_INIT_ALGORITHM(SCascade, "CascadeDetector.SCascade",
bool initModule_softcascade(void)
{
Ptr<Algorithm> sc = createSCascade_hidden();
Ptr<Algorithm> sc1 = createDetector_hidden();
Ptr<Algorithm> sc = createSCascade_ptr_hidden();
Ptr<Algorithm> sc1 = createDetector_ptr_hidden();
return (sc1->info() != 0) && (sc->info() != 0);
}

Loading…
Cancel
Save