@ -16,7 +16,7 @@ Class which provides the main controls to the Gipsa/Listic labs human retina mo
**NOTE : See the Retina tutorial in the tutorial/contrib section for complementary explanations.**
**NOTE : See the Retina tutorial in the tutorial/contrib section for complementary explanations.**
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. ::
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(cv::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(cv::String fs)*. These methods update a *Retina::RetinaParameters* member structure that is described hereafter. ::
class Retina
class Retina
{
{
@ -49,12 +49,12 @@ The retina can be settled up with various parameters, by default, the retina can
Size outputSize ();
Size outputSize ();
// setup methods with specific parameters specification of global xml config file loading/write
// setup methods with specific parameters specification of global xml config file loading/write
std::stringerror_message="The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
cv::Stringerror_message="The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}
}
// number of samples
// number of samples
@ -66,7 +66,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
for(unsignedinti=0;i<n;i++){
for(unsignedinti=0;i<n;i++){
// make sure data can be reshaped, throw exception if not!
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total()!=d){
if(src.getMat(i).total()!=d){
std::stringerror_message=format("Wrong number of elements in matrix #%d! Expected %d was %d.",i,d,src.getMat(i).total());
cv::Stringerror_message=format("Wrong number of elements in matrix #%d! Expected %d was %d.",i,d,src.getMat(i).total());
std::stringerror_msg=format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.",this->name().c_str());
cv::Stringerror_msg=format("This FaceRecognizer (%s) does not support updating, you have to use FaceRecognizer::train to update it.",this->name().c_str());
std::stringerror_message=format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.",_src.getMat(i-1).total(),_src.getMat(i).total());
cv::Stringerror_message=format("In the Eigenfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.",_src.getMat(i-1).total(),_src.getMat(i).total());
std::stringerror_message=format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.",n,labels.total());
cv::Stringerror_message=format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.",n,labels.total());
// check data alignment just for clearer exception messages
// check data alignment just for clearer exception messages
std::stringerror_message=format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.",_eigenvectors.rows,src.total());
cv::Stringerror_message=format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.",_eigenvectors.rows,src.total());
std::stringerror_message=format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.",src.getMat(i-1).total(),src.getMat(i).total());
cv::Stringerror_message=format("In the Fisherfaces method all input samples (training images) must be of equal size! Expected %d pixels, but was %d pixels.",src.getMat(i-1).total(),src.getMat(i).total());
std::stringerror_message=format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.",N,labels.total());
cv::Stringerror_message=format("The number of samples (src) must equal the number of labels (labels)! len(src)=%d, len(labels)=%d.",N,labels.total());
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}elseif(labels.rows!=1&&labels.cols!=1){
}elseif(labels.rows!=1&&labels.cols!=1){
std::stringerror_message=format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.",labels.rows,labels.cols);
cv::Stringerror_message=format("Expected the labels in a matrix with one row or column! Given dimensions are rows=%s, cols=%d.",labels.rows,labels.cols);
// check data alignment just for clearer exception messages
// check data alignment just for clearer exception messages
if(_projections.empty()){
if(_projections.empty()){
// throw error if no data (or simply return -1?)
// throw error if no data (or simply return -1?)
std::stringerror_message="This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
cv::Stringerror_message="This Fisherfaces model is not computed yet. Did you call Fisherfaces::train?";
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}elseif(src.total()!=(size_t)_eigenvectors.rows){
}elseif(src.total()!=(size_t)_eigenvectors.rows){
std::stringerror_message=format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.",_eigenvectors.rows,src.total());
cv::Stringerror_message=format("Wrong input image size. Reason: Training and Test images must be of equal size! Expected an image with %d elements, but got %d.",_eigenvectors.rows,src.total());
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}
}
// project into LDA subspace
// project into LDA subspace
@ -640,7 +640,7 @@ static void elbp(InputArray src, OutputArray dst, int radius, int neighbors)
std::stringerror_msg=format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!",type);
cv::Stringerror_msg=format("Using Original Local Binary Patterns for feature extraction only works on single-channel images (given %d). Please pass the image data as a grayscale image!",type);
std::stringerror_message="The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
cv::Stringerror_message="The images are expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}
}
if(_in_src.total()==0){
if(_in_src.total()==0){
std::stringerror_message=format("Empty training data was given. You'll need more than one sample to learn a model.");
cv::Stringerror_message=format("Empty training data was given. You'll need more than one sample to learn a model.");
CV_Error(CV_StsUnsupportedFormat,error_message);
CV_Error(CV_StsUnsupportedFormat,error_message);
}elseif(_in_labels.getMat().type()!=CV_32SC1){
}elseif(_in_labels.getMat().type()!=CV_32SC1){
std::stringerror_message=format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.",CV_32SC1,_in_labels.type());
cv::Stringerror_message=format("Labels must be given as integer (CV_32SC1). Expected %d, but was %d.",CV_32SC1,_in_labels.type());
std::stringerror_message=format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.",src.size(),_labels.total());
cv::Stringerror_message=format("The number of samples (src) must equal the number of labels (labels). Was len(samples)=%d, len(labels)=%d.",src.size(),_labels.total());
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}
}
// if this model should be trained without preserving old data, delete old model data
// if this model should be trained without preserving old data, delete old model data
std::stringerror_message="The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
cv::Stringerror_message="The data is expected as InputArray::STD_VECTOR_MAT (a std::vector<Mat>) or _InputArray::STD_VECTOR_VECTOR (a std::vector< std::vector<...> >).";
CV_Error(CV_StsBadArg,error_message);
CV_Error(CV_StsBadArg,error_message);
}
}
// number of samples
// number of samples
@ -70,7 +70,7 @@ static Mat asRowMatrix(InputArrayOfArrays src, int rtype, double alpha=1, double
for(inti=0;i<(int)n;i++){
for(inti=0;i<(int)n;i++){
// make sure data can be reshaped, throw exception if not!
// make sure data can be reshaped, throw exception if not!
if(src.getMat(i).total()!=d){
if(src.getMat(i).total()!=d){
std::stringerror_message=format("Wrong number of elements in matrix #%d! Expected %d was %d.",i,(int)d,(int)src.getMat(i).total());
cv::Stringerror_message=format("Wrong number of elements in matrix #%d! Expected %d was %d.",i,(int)d,(int)src.getMat(i).total());
The method opens video reader. Parameters are the same as in the constructor :ocv:func:`gpu::VideoReader_GPU::VideoReader_GPU` . The method throws :ocv:class:`Exception` if error occurs.
The method opens video reader. Parameters are the same as in the constructor :ocv:func:`gpu::VideoReader_GPU::VideoReader_GPU` . The method throws :ocv:class:`Exception` if error occurs.