Commit 53b82426 authored by Vladislav Sovrasov's avatar Vladislav Sovrasov

bioinspired: move all factories into corresponding classes

parent 6adf012e
...@@ -422,32 +422,30 @@ public: ...@@ -422,32 +422,30 @@ public:
Retina::getParvo methods Retina::getParvo methods
*/ */
CV_WRAP virtual void activateContoursProcessing(const bool activate)=0; CV_WRAP virtual void activateContoursProcessing(const bool activate)=0;
};
//! @relates bioinspired::Retina
//! @{
/** @overload */ /** @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 /** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
@param inputSize the input frame size @param inputSize the input frame size
@param colorMode the chosen processing mode : with or without color processing @param colorMode the chosen processing mode : with or without color processing
@param colorSamplingMethod specifies which kind of color sampling will be used : @param colorSamplingMethod specifies which kind of color sampling will be used :
- cv::bioinspired::RETINA_COLOR_RANDOM: each pixel position is either R, G or B in a random choice - cv::bioinspired::RETINA_COLOR_RANDOM: each pixel position is either R, G or B in a random choice
- cv::bioinspired::RETINA_COLOR_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR... - cv::bioinspired::RETINA_COLOR_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling - cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can @param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
be used be used
@param reductionFactor only usefull if param useRetinaLogSampling=true, specifies the reduction @param reductionFactor only usefull if param useRetinaLogSampling=true, specifies the reduction
factor of the output frame (as the center (fovea) is high resolution and corners can be factor of the output frame (as the center (fovea) is high resolution and corners can be
underscaled, then a reduction of the output is allowed without precision leak underscaled, then a reduction of the output is allowed without precision leak
@param samplingStrenght only usefull if param useRetinaLogSampling=true, specifies the strenght of @param samplingStrenght only usefull if param useRetinaLogSampling=true, specifies the strenght of
the log scale that is applied 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);
};
//! @} //! @}
......
...@@ -126,10 +126,10 @@ public: ...@@ -126,10 +126,10 @@ public:
(default is 1, see reference paper) (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 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);
//! @} //! @}
......
...@@ -187,13 +187,12 @@ public: ...@@ -187,13 +187,12 @@ public:
/** @brief cleans all the buffers of the instance /** @brief cleans all the buffers of the instance
*/ */
CV_WRAP virtual void clearAllBuffers()=0; CV_WRAP virtual void clearAllBuffers()=0;
};
/** @brief allocator /** @brief allocator
@param inputSize : size of the images input to segment (output will be the same size) @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);
};
//! @} //! @}
......
...@@ -29,7 +29,7 @@ OCL_PERF_TEST_P(RetinaFixture, Retina, ...@@ -29,7 +29,7 @@ OCL_PERF_TEST_P(RetinaFixture, Retina,
UMat ocl_parvo, ocl_magno; 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, input.size(), colorMode, colorSamplingMethod, useLogSampling,
reductionFactor, samplingStrength); reductionFactor, samplingStrength);
......
...@@ -220,10 +220,10 @@ int main(int argc, char* argv[]) ...@@ -220,10 +220,10 @@ int main(int argc, char* argv[])
*/ */
if (useLogSampling) 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 : 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) // create a fast retina tone mapper (Meyla&al algorithm)
std::cout<<"Allocating fast tone mapper..."<<std::endl; std::cout<<"Allocating fast tone mapper..."<<std::endl;
......
...@@ -84,10 +84,11 @@ int main(int argc, char* argv[]) ...@@ -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 the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision)
if (useLogSampling) 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 : 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" // 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"); myRetina->write("RetinaDefaultParameters.xml");
......
...@@ -306,12 +306,12 @@ private: ...@@ -306,12 +306,12 @@ private:
}; };
// smart pointers allocation : // smart pointers allocation :
Ptr<Retina> createRetina(Size inputSize) Ptr<Retina> Retina::create(Size inputSize)
{ {
return makePtr<RetinaImpl>(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); return makePtr<RetinaImpl>(inputSize, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
} }
......
...@@ -309,7 +309,7 @@ void _runRGBToneMapping(const std::valarray<float> &RGBimageInput, std::valarray ...@@ -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); return makePtr<RetinaFastToneMappingImpl>(inputSize);
} }
......
...@@ -247,7 +247,7 @@ private: ...@@ -247,7 +247,7 @@ private:
* allocator * allocator
* @param Size : size of the images input to segment (output will be the same size) * @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); return makePtr<TransientAreasSegmentationModuleImpl_>(inputSize);
} }
......
...@@ -76,7 +76,7 @@ OCL_TEST_P(Retina_OCL, Accuracy) ...@@ -76,7 +76,7 @@ OCL_TEST_P(Retina_OCL, Accuracy)
Mat input = imread(cvtest::TS::ptr()->get_data_path() + "shared/lena.png", colorMode); Mat input = imread(cvtest::TS::ptr()->get_data_path() + "shared/lena.png", colorMode);
CV_Assert(!input.empty()); CV_Assert(!input.empty());
Ptr<bioinspired::Retina> retina = bioinspired::createRetina( Ptr<bioinspired::Retina> retina = bioinspired::Retina::create(
input.size(), input.size(),
colorMode, colorMode,
colorSamplingMethod, colorSamplingMethod,
......
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