Skip to content

Commit 53b8242

Browse files
committed
bioinspired: move all factories into corresponding classes
1 parent 6adf012 commit 53b8242

File tree

10 files changed

+41
-43
lines changed

10 files changed

+41
-43
lines changed

modules/bioinspired/include/opencv2/bioinspired/retina.hpp

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -422,32 +422,30 @@ class CV_EXPORTS_W Retina : public Algorithm {
422422
Retina::getParvo methods
423423
*/
424424
CV_WRAP virtual void activateContoursProcessing(const bool activate)=0;
425-
};
426-
427-
//! @relates bioinspired::Retina
428-
//! @{
429-
430-
/** @overload */
431-
CV_EXPORTS_W Ptr<Retina> createRetina(Size inputSize);
432-
/** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
433-
434-
@param inputSize the input frame size
435-
@param colorMode the chosen processing mode : with or without color processing
436-
@param colorSamplingMethod specifies which kind of color sampling will be used :
437-
- cv::bioinspired::RETINA_COLOR_RANDOM: each pixel position is either R, G or B in a random choice
438-
- cv::bioinspired::RETINA_COLOR_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
439-
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
440-
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
441-
be used
442-
@param reductionFactor only usefull if param useRetinaLogSampling=true, specifies the reduction
443-
factor of the output frame (as the center (fovea) is high resolution and corners can be
444-
underscaled, then a reduction of the output is allowed without precision leak
445-
@param samplingStrenght only usefull if param useRetinaLogSampling=true, specifies the strenght of
446-
the log scale that is applied
447-
*/
448-
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);
449425

450-
//! @}
426+
/** @overload */
427+
CV_WRAP static Ptr<Retina> create(Size inputSize);
428+
/** @brief Constructors from standardized interfaces : retreive a smart pointer to a Retina instance
429+
430+
@param inputSize the input frame size
431+
@param colorMode the chosen processing mode : with or without color processing
432+
@param colorSamplingMethod specifies which kind of color sampling will be used :
433+
- cv::bioinspired::RETINA_COLOR_RANDOM: each pixel position is either R, G or B in a random choice
434+
- cv::bioinspired::RETINA_COLOR_DIAGONAL: color sampling is RGBRGBRGB..., line 2 BRGBRGBRG..., line 3, GBRGBRGBR...
435+
- cv::bioinspired::RETINA_COLOR_BAYER: standard bayer sampling
436+
@param useRetinaLogSampling activate retina log sampling, if true, the 2 following parameters can
437+
be used
438+
@param reductionFactor only usefull if param useRetinaLogSampling=true, specifies the reduction
439+
factor of the output frame (as the center (fovea) is high resolution and corners can be
440+
underscaled, then a reduction of the output is allowed without precision leak
441+
@param samplingStrenght only usefull if param useRetinaLogSampling=true, specifies the strenght of
442+
the log scale that is applied
443+
*/
444+
CV_WRAP static Ptr<Retina> create(Size inputSize, const bool colorMode,
445+
int colorSamplingMethod=RETINA_COLOR_BAYER,
446+
const bool useRetinaLogSampling=false,
447+
const float reductionFactor=1.0f, const float samplingStrenght=10.0f);
448+
};
451449

452450
//! @}
453451

modules/bioinspired/include/opencv2/bioinspired/retinafasttonemapping.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ class CV_EXPORTS_W RetinaFastToneMapping : public Algorithm
126126
(default is 1, see reference paper)
127127
*/
128128
CV_WRAP virtual void setup(const float photoreceptorsNeighborhoodRadius=3.f, const float ganglioncellsNeighborhoodRadius=1.f, const float meanLuminanceModulatorK=1.f)=0;
129+
130+
CV_WRAP static Ptr<RetinaFastToneMapping> create(Size inputSize);
129131
};
130132

131-
//! @relates bioinspired::RetinaFastToneMapping
132-
CV_EXPORTS_W Ptr<RetinaFastToneMapping> createRetinaFastToneMapping(Size inputSize);
133133

134134
//! @}
135135

modules/bioinspired/include/opencv2/bioinspired/transientareassegmentationmodule.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,12 @@ class CV_EXPORTS_W TransientAreasSegmentationModule: public Algorithm
187187
/** @brief cleans all the buffers of the instance
188188
*/
189189
CV_WRAP virtual void clearAllBuffers()=0;
190-
};
191190

192-
/** @brief allocator
193-
@param inputSize : size of the images input to segment (output will be the same size)
194-
@relates bioinspired::TransientAreasSegmentationModule
195-
*/
196-
CV_EXPORTS_W Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize);
191+
/** @brief allocator
192+
@param inputSize : size of the images input to segment (output will be the same size)
193+
*/
194+
CV_WRAP static Ptr<TransientAreasSegmentationModule> create(Size inputSize);
195+
};
197196

198197
//! @}
199198

modules/bioinspired/perf/opencl/perf_retina.ocl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ OCL_PERF_TEST_P(RetinaFixture, Retina,
2929
UMat ocl_parvo, ocl_magno;
3030

3131
{
32-
Ptr<cv::bioinspired::Retina> retina = cv::bioinspired::createRetina(
32+
Ptr<cv::bioinspired::Retina> retina = cv::bioinspired::Retina::create(
3333
input.size(), colorMode, colorSamplingMethod, useLogSampling,
3434
reductionFactor, samplingStrength);
3535

modules/bioinspired/samples/OpenEXRimages_HDR_Retina_toneMapping.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@ int main(int argc, char* argv[])
220220
*/
221221
if (useLogSampling)
222222
{
223-
retina = cv::bioinspired::createRetina(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
223+
retina = cv::bioinspired::Retina::create(inputImage.size(),true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
224224
}
225225
else// -> else allocate "classical" retina :
226-
retina = cv::bioinspired::createRetina(inputImage.size());
226+
retina = cv::bioinspired::Retina::create(inputImage.size());
227227

228228
// create a fast retina tone mapper (Meyla&al algorithm)
229229
std::cout<<"Allocating fast tone mapper..."<<std::endl;

modules/bioinspired/samples/retinaDemo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ int main(int argc, char* argv[])
8484
// if the last parameter is 'log', then activate log sampling (favour foveal vision and subsamples peripheral vision)
8585
if (useLogSampling)
8686
{
87-
myRetina = cv::bioinspired::createRetina(inputFrame.size(), true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
87+
myRetina = cv::bioinspired::Retina::create(inputFrame.size(),
88+
true, cv::bioinspired::RETINA_COLOR_BAYER, true, 2.0, 10.0);
8889
}
8990
else// -> else allocate "classical" retina :
90-
myRetina = cv::bioinspired::createRetina(inputFrame.size());
91+
myRetina = cv::bioinspired::Retina::create(inputFrame.size());
9192

9293
// save default retina parameters file in order to let you see this and maybe modify it and reload using method "setup"
9394
myRetina->write("RetinaDefaultParameters.xml");

modules/bioinspired/src/retina.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ class RetinaImpl : public Retina
306306
};
307307

308308
// smart pointers allocation :
309-
Ptr<Retina> createRetina(Size inputSize)
309+
Ptr<Retina> Retina::create(Size inputSize)
310310
{
311311
return makePtr<RetinaImpl>(inputSize);
312312
}
313313

314-
Ptr<Retina> createRetina(Size inputSize, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght)
314+
Ptr<Retina> Retina::create(Size inputSize, const bool colorMode, int colorSamplingMethod, const bool useRetinaLogSampling, const float reductionFactor, const float samplingStrenght)
315315
{
316316
return makePtr<RetinaImpl>(inputSize, colorMode, colorSamplingMethod, useRetinaLogSampling, reductionFactor, samplingStrenght);
317317
}

modules/bioinspired/src/retinafasttonemapping.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void _runRGBToneMapping(const std::valarray<float> &RGBimageInput, std::valarray
309309

310310
};
311311

312-
CV_EXPORTS Ptr<RetinaFastToneMapping> createRetinaFastToneMapping(Size inputSize)
312+
Ptr<RetinaFastToneMapping> RetinaFastToneMapping::create(Size inputSize)
313313
{
314314
return makePtr<RetinaFastToneMappingImpl>(inputSize);
315315
}

modules/bioinspired/src/transientareassegmentationmodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class TransientAreasSegmentationModuleImpl_: public TransientAreasSegmentationM
247247
* allocator
248248
* @param Size : size of the images input to segment (output will be the same size)
249249
*/
250-
Ptr<TransientAreasSegmentationModule> createTransientAreasSegmentationModule(Size inputSize){
250+
Ptr<TransientAreasSegmentationModule> TransientAreasSegmentationModule::create(Size inputSize){
251251
return makePtr<TransientAreasSegmentationModuleImpl_>(inputSize);
252252
}
253253

modules/bioinspired/test/test_retina_ocl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ OCL_TEST_P(Retina_OCL, Accuracy)
7676
Mat input = imread(cvtest::TS::ptr()->get_data_path() + "shared/lena.png", colorMode);
7777
CV_Assert(!input.empty());
7878

79-
Ptr<bioinspired::Retina> retina = bioinspired::createRetina(
79+
Ptr<bioinspired::Retina> retina = bioinspired::Retina::create(
8080
input.size(),
8181
colorMode,
8282
colorSamplingMethod,

0 commit comments

Comments
 (0)