// Trains a FaceRecognizer.
virtual void train(InputArray src, InputArray labels) = 0;
-
+
// Updates a FaceRecognizer.
virtual void update(InputArrayOfArrays src, InputArray labels);
-
+
// Gets a prediction from a FaceRecognizer.
virtual int predict(InputArray src) const = 0;
-
+
// Predicts the label and confidence for a given sample.
virtual void predict(InputArray src, int &label, double &confidence) const = 0;
// Serializes this object to a given filename.
virtual void save(const string& filename) const;
-
+
// Deserializes this object from a given filename.
virtual void load(const string& filename);
Moreover every :ocv:class:`FaceRecognizer` supports the:
-* **Training** of a :ocv:class:`FaceRecognizer` with :ocv:func:`FaceRecognizer::train` on a given set of images (your face database!).
+* **Training** of a :ocv:class:`FaceRecognizer` with :ocv:func:`FaceRecognizer::train` on a given set of images (your face database!).
* **Prediction** of a given sample image, that means a face. The image is given as a :ocv:class:`Mat`.
.. code-block:: cpp
// Create a FaceRecognizer:
- Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
+ Ptr<FaceRecognizer> model = createEigenFaceRecognizer();
// And here's how to get its name:
std::string name = model->name();
Trains a FaceRecognizer with given data and associated labels.
-.. ocv:function:: void FaceRecognizer::train(InputArray src, InputArray labels)
+.. ocv:function:: void FaceRecognizer::train( InputArrayOfArrays src, InputArray labels ) = 0
:param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``.
Updates a FaceRecognizer with given data and associated labels.
-.. ocv:function:: void FaceRecognizer::update(InputArray src, InputArray labels)
+.. ocv:function:: void FaceRecognizer::update( InputArrayOfArrays src, InputArray labels )
:param src: The training images, that means the faces you want to learn. The data has to be given as a ``vector<Mat>``.
//
// Now updating the model is as easy as calling:
model->update(newImages,newLabels);
- // This will preserve the old model data and extend the existing model
+ // This will preserve the old model data and extend the existing model
// with the new features extracted from newImages!
Calling update on an Eigenfaces model (see :ocv:func:`createEigenFaceRecognizer`), which doesn't support updating, will throw an error similar to:
OpenCV Error: The function/feature is not implemented (This FaceRecognizer (FaceRecognizer.Eigenfaces) does not support updating, you have to use FaceRecognizer::train to update it.) in update, file /home/philipp/git/opencv/modules/contrib/src/facerec.cpp, line 305
terminate called after throwing an instance of 'cv::Exception'
-Please note: The :ocv:class:`FaceRecognizer` does not store your training images, because this would be very memory intense and it's not the responsibility of te :ocv:class:`FaceRecognizer` to do so. The caller is responsible for maintaining the dataset, he want to work with.
-
+Please note: The :ocv:class:`FaceRecognizer` does not store your training images, because this would be very memory intense and it's not the responsibility of te :ocv:class:`FaceRecognizer` to do so. The caller is responsible for maintaining the dataset, he want to work with.
+
FaceRecognizer::predict
-----------------------
* periphearal vision for sensitive transient signals detection (motion and events) : the magnocellular pathway.
-The retina can be settled up with various parameters, by default, the retina cancels mean luminance and enforces all details of the visual scene. In order to use your own parameters, you can use at least one time the *write(std::string fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(std::string fs)*. These methods update a *cv::Retina::RetinaParameters* member structure that is described hereafter. ::
+The retina can be settled up with various parameters, by default, the retina cancels mean luminance and enforces all details of the visual scene. In order to use your own parameters, you can use at least one time the *write(std::string fs)* method which will write a proper XML file with all default parameters. Then, tweak it on your own and reload them at any time using method *setup(std::string fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
class Retina
{
// constructors
Retina (Size inputSize);
Retina (Size inputSize, const bool colorMode, RETINA_COLORSAMPLINGMETHOD colorSamplingMethod=RETINA_COLOR_BAYER, const bool useRetinaLogSampling=false, const double reductionFactor=1.0, const double samplingStrenght=10.0);
-
+
// main method for input frame processing
void run (const Mat &inputImage);
void getMagno (Mat &retinaOutput_magno);
void getMagno (std::valarray< float > &retinaOutput_magno);
const std::valarray< float > & getMagno () const;
-
+
// reset retina buffers... equivalent to closing your eyes for some seconds
void clearBuffers ();
-
+
// retreive input and output buffers sizes
Size inputSize ();
Size outputSize ();
-
+
// setup methods with specific parameters specification of global xml config file loading/write
void setup (std::string retinaParameterFile="", const bool applyDefaultSetupOnFailure=true);
- void setup (cv::FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
+ void setup (FileStorage &fs, const bool applyDefaultSetupOnFailure=true);
void setup (RetinaParameters newParameters);
struct Retina::RetinaParameters getParameters ();
const std::string printSetup ();
virtual void write (std::string fs) const;
- virtual void write (FileStorage &fs) const;
+ virtual void write (FileStorage &fs) const;
void setupOPLandIPLParvoChannel (const bool colorMode=true, const bool normaliseOutput=true, const float photoreceptorsLocalAdaptationSensitivity=0.7, const float photoreceptorsTemporalConstant=0.5, const float photoreceptorsSpatialConstant=0.53, const float horizontalCellsGain=0, const float HcellsTemporalConstant=1, const float HcellsSpatialConstant=7, const float ganglionCellsSensitivity=0.7);
void setupIPLMagnoChannel (const bool normaliseOutput=true, const float parasolCells_beta=0, const float parasolCells_tau=0, const float parasolCells_k=7, const float amacrinCellsTemporalCutFrequency=1.2, const float V0CompressionParameter=0.95, const float localAdaptintegration_tau=0, const float localAdaptintegration_k=7);
void setColorSaturation (const bool saturateColors=true, const float colorSaturationValue=4.0);
* local logarithmic luminance compression allows details to be enhanced even in low light conditions
-Use : this model can be used basically for spatio-temporal video effects but also in the aim of :
+Use : this model can be used basically for spatio-temporal video effects but also in the aim of :
* performing texture analysis with enhanced signal to noise ratio and enhanced details robust against input images luminance ranges (check out the parvocellular retina channel output, by using the provided **getParvo** methods)
* performing motion analysis also taking benefit of the previously cited properties (check out the magnocellular retina channel output, by using the provided **getMagno** methods)
-For more information, refer to the following papers :
+For more information, refer to the following papers :
* Benoit A., Caplier A., Durette B., Herault, J., "Using Human Visual System Modeling For Bio-Inspired Low Level Image Processing", Elsevier, Computer Vision and Image Understanding 114 (2010), pp. 758-773. DOI <http://dx.doi.org/10.1016/j.cviu.2010.01.011>
Take a look at the C++ examples provided with OpenCV :
-* **samples/cpp/retinademo.cpp** shows how to use the retina module for details enhancement (Parvo channel output) and transient maps observation (Magno channel output). You can play with images, video sequences and webcam video.
+* **samples/cpp/retinademo.cpp** shows how to use the retina module for details enhancement (Parvo channel output) and transient maps observation (Magno channel output). You can play with images, video sequences and webcam video.
Typical uses are (provided your OpenCV installation is situated in folder *OpenCVReleaseFolder*)
* image processing : **OpenCVReleaseFolder/bin/retinademo -image myPicture.jpg**
* webcam processing: **OpenCVReleaseFolder/bin/retinademo -video**
**Note :** This demo generates the file *RetinaDefaultParameters.xml* which contains the default parameters of the retina. Then, rename this as *RetinaSpecificParameters.xml*, adjust the parameters the way you want and reload the program to check the effect.
-
+
* **samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp** shows how to use the retina to perform High Dynamic Range (HDR) luminance compression
Typical use, supposing that you have the OpenEXR image *memorial.exr* (present in the samples/cpp/ folder)
**OpenCVReleaseFolder/bin/OpenEXRimages_HighDynamicRange_Retina_toneMapping memorial.exr**
-
+
Note that some sliders are made available to allow you to play with luminance compression.
Methods description
===================
-Here are detailled the main methods to control the retina model
+Here are detailled the main methods to control the retina model
Retina::Retina
++++++++++++++
Retina::activateContoursProcessing
++++++++++++++++++++++++++++++++++
-.. ocv:function:: void cv::Retina::activateContoursProcessing(const bool activate)
+.. ocv:function:: void Retina::activateContoursProcessing(const bool activate)
Activate/desactivate the Parvocellular pathway processing (contours information extraction), by default, it is activated
Retina::activateMovingContoursProcessing
++++++++++++++++++++++++++++++++++++++++
-.. ocv:function:: void cv::Retina::activateMovingContoursProcessing(const bool activate)
+.. ocv:function:: void Retina::activateMovingContoursProcessing(const bool activate)
Activate/desactivate the Magnocellular pathway processing (motion information extraction), by default, it is activated
Retina::clearBuffers
++++++++++++++++++++
-.. ocv:function:: void cv::Retina::clearBuffers()
+.. ocv:function:: void Retina::clearBuffers()
Clears all retina buffers (equivalent to opening the eyes after a long period of eye close ;o) whatchout the temporal transition occuring just after this method call.
Retina::getParvo
++++++++++++++++
-.. ocv:function:: void cv::Retina::getParvo(Mat & retinaOutput_parvo)
-.. ocv:function:: void cv::Retina::getParvo(std::valarray< float > & retinaOutput_parvo )
+.. ocv:function:: void Retina::getParvo( Mat & retinaOutput_parvo )
+.. ocv:function:: void Retina::getParvo( std::valarray<float> & retinaOutput_parvo )
+.. ocv:function:: const std::valarray<float> & Retina::getParvo() const
Accessor of the details channel of the retina (models foveal vision)
:param retinaOutput_parvo: the output buffer (reallocated if necessary), format can be :
-
- * a cv::Mat, this output is rescaled for standard 8bits image processing use in OpenCV
-
+
+ * a Mat, this output is rescaled for standard 8bits image processing use in OpenCV
+
* a 1D std::valarray Buffer (encoding is R1, R2, ... Rn), this output is the original retina filter model output, without any quantification or rescaling
Retina::getMagno
++++++++++++++++
-.. ocv:function:: void cv::Retina::getMagno(Mat & retinaOutput_magno)
-.. ocv:function:: void cv::Retina::getMagno(std::valarray< float > & retinaOutput_magno)
+.. ocv:function:: void Retina::getMagno( Mat & retinaOutput_magno )
+.. ocv:function:: void Retina::getMagno( std::valarray<float> & retinaOutput_magno )
+.. ocv:function:: const std::valarray<float> & Retina::getMagno() const
Accessor of the motion channel of the retina (models peripheral vision)
:param retinaOutput_magno: the output buffer (reallocated if necessary), format can be :
-
- * a cv::Mat, this output is rescaled for standard 8bits image processing use in OpenCV
-
+
+ * a Mat, this output is rescaled for standard 8bits image processing use in OpenCV
+
* a 1D std::valarray Buffer (encoding is R1, R2, ... Rn), this output is the original retina filter model output, without any quantification or rescaling
Retina::getParameters
+++++++++++++++++++++
-.. ocv:function:: struct Retina::RetinaParameters cv::Retina::getParameters()
+.. ocv:function:: struct Retina::RetinaParameters Retina::getParameters()
Retrieve the current parameters values in a *Retina::RetinaParameters* structure
Retina::inputSize
+++++++++++++++++
-.. ocv:function:: Size cv::Retina::inputSize()
+.. ocv:function:: Size Retina::inputSize()
Retreive retina input buffer size
Retina::outputSize
++++++++++++++++++
-.. ocv:function:: Size cv::Retina::outputSize()
+.. ocv:function:: Size Retina::outputSize()
- Retreive retina output buffer size that can be different from the input if a spatial log transformation is applied
+ Retreive retina output buffer size that can be different from the input if a spatial log transformation is applied
:return: the retina output buffer size
Retina::printSetup
++++++++++++++++++
-.. ocv:function:: const std::string cv::Retina::printSetup()
+.. ocv:function:: const std::string Retina::printSetup()
Outputs a string showing the used parameters setup
Retina::run
+++++++++++
-.. ocv:function:: void cv::Retina::run(const Mat & inputImage)
+.. ocv:function:: void Retina::run(const Mat & inputImage)
Method which allows retina to be applied on an input image, after run, encapsulated retina module is ready to deliver its outputs using dedicated acccessors, see getParvo and getMagno methods
- :param inputImage: the input cv::Mat image to be processed, can be gray level or BGR coded in any format (from 8bit to 16bits)
+ :param inputImage: the input Mat image to be processed, can be gray level or BGR coded in any format (from 8bit to 16bits)
Retina::setColorSaturation
++++++++++++++++++++++++++
-.. ocv:function:: void cv::Retina::setColorSaturation(const bool saturateColors = true, const float colorSaturationValue = 4.0 )
+.. ocv:function:: void Retina::setColorSaturation(const bool saturateColors = true, const float colorSaturationValue = 4.0 )
Activate color saturation as the final step of the color demultiplexing process -> this saturation is a sigmoide function applied to each channel of the demultiplexed image.
Retina::setup
+++++++++++++
-.. ocv:function:: void cv::Retina::setup(std::string retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
-.. ocv:function:: void cv::Retina::setup(cv::FileStorage & fs, const bool applyDefaultSetupOnFailure = true )
-.. ocv:function:: void cv::Retina::setup(RetinaParameters newParameters)
+.. ocv:function:: void Retina::setup(std::string retinaParameterFile = "", const bool applyDefaultSetupOnFailure = true )
+.. ocv:function:: void Retina::setup(FileStorage & fs, const bool applyDefaultSetupOnFailure = true )
+.. ocv:function:: void Retina::setup(RetinaParameters newParameters)
Try to open an XML retina parameters file to adjust current retina instance setup => if the xml file does not exist, then default setup is applied => warning, Exceptions are thrown if read XML file is not valid
Retina::write
+++++++++++++
-.. ocv:function:: virtual void cv::Retina::write(std::string fs) const
-.. ocv:function:: virtual void cv::Retina::write(FileStorage & fs) const
+.. ocv:function:: void Retina::write( std::string fs ) const
+.. ocv:function:: void Retina::write( FileStorage& fs ) const
Write xml/yml formated parameters information
Retina::setupIPLMagnoChannel
++++++++++++++++++++++++++++
-.. ocv:function:: void cv::Retina::setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta = 0, const float parasolCells_tau = 0, const float parasolCells_k = 7, const float amacrinCellsTemporalCutFrequency = 1.2, const float V0CompressionParameter = 0.95, const float localAdaptintegration_tau = 0, const float localAdaptintegration_k = 7 )
+.. ocv:function:: void Retina::setupIPLMagnoChannel(const bool normaliseOutput = true, const float parasolCells_beta = 0, const float parasolCells_tau = 0, const float parasolCells_k = 7, const float amacrinCellsTemporalCutFrequency = 1.2, const float V0CompressionParameter = 0.95, const float localAdaptintegration_tau = 0, const float localAdaptintegration_k = 7 )
Set parameters values for the Inner Plexiform Layer (IPL) magnocellular channel this channel processes signals output from OPL processing stage in peripheral vision, it allows motion information enhancement. It is decorrelated from the details channel. See reference papers for more details.
Retina::setupOPLandIPLParvoChannel
++++++++++++++++++++++++++++++++++
-.. ocv:function:: void cv::Retina::setupOPLandIPLParvoChannel(const bool colorMode = true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity = 0.7, const float photoreceptorsTemporalConstant = 0.5, const float photoreceptorsSpatialConstant = 0.53, const float horizontalCellsGain = 0, const float HcellsTemporalConstant = 1, const float HcellsSpatialConstant = 7, const float ganglionCellsSensitivity = 0.7 )
+.. ocv:function:: void Retina::setupOPLandIPLParvoChannel(const bool colorMode = true, const bool normaliseOutput = true, const float photoreceptorsLocalAdaptationSensitivity = 0.7, const float photoreceptorsTemporalConstant = 0.5, const float photoreceptorsSpatialConstant = 0.53, const float horizontalCellsGain = 0, const float HcellsTemporalConstant = 1, const float HcellsSpatialConstant = 7, const float ganglionCellsSensitivity = 0.7 )
Setup the OPL and IPL parvo channels (see biologocal model) OPL is referred as Outer Plexiform Layer of the retina, it allows the spatio-temporal filtering which withens the spectrum and reduces spatio-temporal noise while attenuating global luminance (low frequency energy) IPL parvo is the OPL next processing stage, it refers to a part of the Inner Plexiform layer of the retina, it allows high contours sensitivity in foveal vision. See reference papers for more informations.
Retina::RetinaParameters
========================
-.. ocv:class:: RetinaParameters
-This structure merges all the parameters that can be adjusted threw the **cv::Retina::setup()**, **cv::Retina::setupOPLandIPLParvoChannel** and **cv::Retina::setupIPLMagnoChannel** setup methods
+.. ocv:struct:: Retina::RetinaParameters
+This structure merges all the parameters that can be adjusted threw the **Retina::setup()**, **Retina::setupOPLandIPLParvoChannel** and **Retina::setupIPLMagnoChannel** setup methods
Parameters structure for better clarity, check explenations on the comments of methods : setupOPLandIPLParvoChannel and setupIPLMagnoChannel. ::
- class RetinaParameters{
- struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters
+ class RetinaParameters{
+ struct OPLandIplParvoParameters{ // Outer Plexiform Layer (OPL) and Inner Plexiform Layer Parvocellular (IplParvo) parameters
OPLandIplParvoParameters():colorMode(true),
normaliseOutput(true), // specifies if (true) output is rescaled between 0 and 255 of not (false)
photoreceptorsLocalAdaptationSensitivity(0.7f), // the photoreceptors sensitivity renage is 0-1 (more log compression effect when value increases)
:param result: Destination image.
:param stream: Stream for the asynchronous version.
-
-
+
+
gpu::bilateralFilter
--------------------
+--------------------
Performs bilateral filtering of passed image
-.. ocv:function:: void gpu::bilateralFilter(const GpuMat& src, GpuMat& dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode, Stream& stream = Stream::Null());
-
+.. ocv:function:: void gpu::bilateralFilter(const GpuMat& src, GpuMat& dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode, Stream& stream = Stream::Null())
+
:param src: Source image. Supports only (channles != 2 && depth() != CV_8S && depth() != CV_32S && depth() != CV_64F).
:param dst: Destination imagwe.
:param kernel_size: Kernel window size.
- :param sigma_color: Filter sigma in the color space.
-
- :param sigma_spatial: Filter sigma in the coordinate space.
+ :param sigma_color: Filter sigma in the color space.
+
+ :param sigma_spatial: Filter sigma in the coordinate space.
:param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
.. seealso::
:ocv:func:`bilateralFilter`,
-
-
+
+
gpu::nonLocalMeans
-------------------
Performs pure non local means denoising without any simplification, and thus it is not fast.
-.. ocv:function:: void nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_widow_size = 11, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null());
-
+.. ocv:function:: void nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_widow_size = 11, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null())
+
:param src: Source image. Supports only CV_8UC1, CV_8UC3.
:param dst: Destination imagwe.
- :param h: Filter sigma regulating filter strength for color.
-
+ :param h: Filter sigma regulating filter strength for color.
+
:param search_widow_size: Size of search window.
- :param block_size: Size of block used for computing weights.
-
+ :param block_size: Size of block used for computing weights.
+
:param borderMode: Border type. See :ocv:func:`borderInterpolate` for details. ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , ``BORDER_CONSTANT`` , ``BORDER_REFLECT`` and ``BORDER_WRAP`` are supported for now.
:param stream: Stream for the asynchronous version.
.. seealso::
:ocv:func:`fastNlMeansDenoising`
-
+
gpu::alphaComp
-------------------
Composites two images using alpha opacity values contained in each image.