mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-18 17:24:28 +08:00
bioinspired: move all factories into corresponding classes
This commit is contained in:
@@ -422,33 +422,31 @@ public:
|
||||
Retina::getParvo methods
|
||||
*/
|
||||
CV_WRAP virtual void activateContoursProcessing(const bool activate)=0;
|
||||
|
||||
/** @overload */
|
||||
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
|
||||
@param colorMode the chosen processing mode : with or without color processing
|
||||
@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_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
|
||||
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
|
||||
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
|
||||
be used
|
||||
@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
|
||||
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_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);
|
||||
};
|
||||
|
||||
//! @relates bioinspired::Retina
|
||||
//! @{
|
||||
|
||||
/** @overload */
|
||||
CV_EXPORTS_W Ptr<Retina> createRetina(Size inputSize);
|
||||
/** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
|
||||
|
||||
@param inputSize the input frame size
|
||||
@param colorMode the chosen processing mode : with or without color processing
|
||||
@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_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
|
||||
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
|
||||
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
|
||||
be used
|
||||
@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
|
||||
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);
|
||||
|
||||
//! @}
|
||||
|
||||
//! @}
|
||||
|
||||
}
|
||||
|
@@ -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);
|
||||
|
||||
//! @}
|
||||
|
||||
|
@@ -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);
|
||||
/** @brief allocator
|
||||
@param inputSize : size of the images input to segment (output will be the same size)
|
||||
*/
|
||||
CV_WRAP static Ptr<TransientAreasSegmentationModule> create(Size inputSize);
|
||||
};
|
||||
|
||||
//! @}
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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");
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user