1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-19 02:16:34 +08:00

bioinspired: move all factories into corresponding classes

This commit is contained in:
Vladislav Sovrasov
2017-08-17 14:59:41 +03:00
parent 6adf012e9a
commit 53b82426e8
10 changed files with 41 additions and 43 deletions

View File

@@ -422,13 +422,9 @@ public:
Retina::getParvo methods
*/
CV_WRAP virtual void activateContoursProcessing(const bool activate)=0;
};
//! @relates bioinspired::Retina
//! @{
/** @overload */
CV_EXPORTS_W Ptr<Retina> createRetina(Size inputSize);
CV_WRAP static Ptr<Retina> create(Size inputSize);
/** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
@param inputSize the input frame size
@@ -445,9 +441,11 @@ underscaled, then a reduction of the output is allowed without precision leak
@param samplingStrenght only usefull if param useRetinaLogSampling=true, specifies the strenght of
the log scale that is applied
*/
CV_EXPORTS_W Ptr<Retina> createRetina(Size inputSize, const bool colorMode, int colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const float reductionFactor=1.0f, const float samplingStrenght=10.0f);
//! @}
CV_WRAP static Ptr<Retina> create(Size inputSize, const bool colorMode,
int colorSamplingMethod=RETINA_COLOR_BAYER,
const bool useRetinaLogSampling=false,
const float reductionFactor=1.0f, const float samplingStrenght=10.0f);
};
//! @}

View File

@@ -126,10 +126,10 @@ public:
(default is 1, see reference paper)
*/
CV_WRAP virtual void setup(const float photoreceptorsNeighborhoodRadius=3.f, const float ganglioncellsNeighborhoodRadius=1.f, const float meanLuminanceModulatorK=1.f)=0;
CV_WRAP static Ptr<RetinaFastToneMapping> create(Size inputSize);
};
//! @relates bioinspired::RetinaFastToneMapping
CV_EXPORTS_W Ptr<RetinaFastToneMapping> createRetinaFastToneMapping(Size inputSize);
//! @}

View File

@@ -187,13 +187,12 @@ public:
/** @brief cleans all the buffers of the instance
*/
CV_WRAP virtual void clearAllBuffers()=0;
};
/** @brief allocator
@param inputSize : size of the images input to segment (output will be the same size)
@relates bioinspired::TransientAreasSegmentationModule
*/
CV_EXPORTS_W Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize);
CV_WRAP static Ptr<TransientAreasSegmentationModule> create(Size inputSize);
};
//! @}

View File

@@ -29,7 +29,7 @@ OCL_PERF_TEST_P(RetinaFixture, Retina,
UMat ocl_parvo, ocl_magno;
{
Ptr<cv::bioinspired::Retina> retina = cv::bioinspired::createRetina(
Ptr<cv::bioinspired::Retina> retina = cv::bioinspired::Retina::create(
input.size(), colorMode, colorSamplingMethod, useLogSampling,
reductionFactor, samplingStrength);

View File

@@ -220,10 +220,10 @@ int main(int argc, char* argv[])
*/
if (useLogSampling)
{
retina = cv::bioinspired::createRetina(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
retina = cv::bioinspired::Retina::create(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
}
else// -> else allocate "classical" retina :
retina = cv::bioinspired::createRetina(inputImage.size());
retina = cv::bioinspired::Retina::create(inputImage.size());
// create a fast retina tone mapper (Meyla&al algorithm)
std::cout<<"Allocating fast tone mapper..."<<std::endl;

View File

@@ -84,10 +84,11 @@ int main(int argc, char* argv[])
// if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision)
if (useLogSampling)
{
myRetina = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
myRetina = cv::bioinspired::Retina::create(inputFrame.size(),
true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
}
else// -> else allocate "classical" retina :
myRetina = cv::bioinspired::createRetina(inputFrame.size());
myRetina = cv::bioinspired::Retina::create(inputFrame.size());
// save default retina parameters file in order to let you see this and maybe modify it and reload using method "setup"
myRetina->write("RetinaDefaultParameters.xml");

View File

@@ -306,12 +306,12 @@ private:
};
// smart pointers allocation :
Ptr<Retina> createRetina(Size inputSize)
Ptr<Retina> Retina::create(Size inputSize)
{
return makePtr<RetinaImpl>(inputSize);
}
Ptr<Retina> createRetina(Size inputSize, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght)
Ptr<Retina> Retina::create(Size inputSize, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght)
{
return makePtr<RetinaImpl>(inputSize, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
}

View File

@@ -309,7 +309,7 @@ void _runRGBToneMapping(const std::valarray<float> &RGBimageInput, std::valarray
};
CV_EXPORTS Ptr<RetinaFastToneMapping> createRetinaFastToneMapping(Size inputSize)
Ptr<RetinaFastToneMapping> RetinaFastToneMapping::create(Size inputSize)
{
return makePtr<RetinaFastToneMappingImpl>(inputSize);
}

View File

@@ -247,7 +247,7 @@ private:
* allocator
* @param Size : size of the images input to segment (output will be the same size)
*/
Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize){
Ptr<TransientAreasSegmentationModule> TransientAreasSegmentationModule::create(Size inputSize){
return makePtr<TransientAreasSegmentationModuleImpl_>(inputSize);
}

View File

@@ -76,7 +76,7 @@ OCL_TEST_P(Retina_OCL, Accuracy)
Mat input = imread(cvtest::TS::ptr()->get_data_path() + "shared/lena.png", colorMode);
CV_Assert(!input.empty());
Ptr<bioinspired::Retina> retina = bioinspired::createRetina(
Ptr<bioinspired::Retina> retina = bioinspired::Retina::create(
input.size(),
colorMode,
colorSamplingMethod,