Commit 0ca3e31d authored by biagio montesano's avatar biagio montesano

Removed some asserts

parent df38bca3
...@@ -236,10 +236,10 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm ...@@ -236,10 +236,10 @@ class CV_EXPORTS_W BinaryDescriptor : public Algorithm
int OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines ); int OctaveKeyLines( cv::Mat& image, ScaleLines &keyLines );
/* the local gaussian coefficient applied to the orthogonal line direction within each band */ /* the local gaussian coefficient applied to the orthogonal line direction within each band */
std::vector<float> gaussCoefL_; std::vector<double> gaussCoefL_;
/* the global gaussian coefficient applied to each row within line support region */ /* the global gaussian coefficient applied to each row within line support region */
std::vector<float> gaussCoefG_; std::vector<double> gaussCoefG_;
/* descriptor parameters */ /* descriptor parameters */
Params params; Params params;
......
...@@ -209,7 +209,7 @@ void BinaryDescriptor::operator()( InputArray image, InputArray mask, CV_OUT std ...@@ -209,7 +209,7 @@ void BinaryDescriptor::operator()( InputArray image, InputArray mask, CV_OUT std
maskMat = mask.getMat(); maskMat = mask.getMat();
/* initialize output matrix */ /* initialize output matrix */
descriptors.create( Size( 32, keylines.size() ), CV_8UC1 ); descriptors.create( Size( 32, (int) keylines.size() ), CV_8UC1 );
/* store reference to output matrix */ /* store reference to output matrix */
descrMat = descriptors.getMat(); descrMat = descriptors.getMat();
...@@ -260,12 +260,11 @@ int BinaryDescriptor::descriptorSize() const ...@@ -260,12 +260,11 @@ int BinaryDescriptor::descriptorSize() const
static inline int get2Pow( int i ) static inline int get2Pow( int i )
{ {
if( i >= 0 && i <= 7 ) if( i >= 0 && i <= 7 )
return pow( 2, (double) i ); return (int) pow( 2, (double) i );
else else
{ {
CV_Assert( false ); throw std::runtime_error( "Invalid power argument" );
return -1;
} }
} }
...@@ -276,7 +275,7 @@ unsigned char BinaryDescriptor::binaryConversion( float* f1, float* f2 ) ...@@ -276,7 +275,7 @@ unsigned char BinaryDescriptor::binaryConversion( float* f1, float* f2 )
for ( int i = 0; i < 8; i++ ) for ( int i = 0; i < 8; i++ )
{ {
if( f1[i] > f2[i] ) if( f1[i] > f2[i] )
result += get2Pow( i ); result += (uchar) get2Pow( i );
} }
return result; return result;
...@@ -287,12 +286,7 @@ unsigned char BinaryDescriptor::binaryConversion( float* f1, float* f2 ) ...@@ -287,12 +286,7 @@ unsigned char BinaryDescriptor::binaryConversion( float* f1, float* f2 )
void BinaryDescriptor::detect( const Mat& image, CV_OUT std::vector<KeyLine>& keylines, const Mat& mask ) void BinaryDescriptor::detect( const Mat& image, CV_OUT std::vector<KeyLine>& keylines, const Mat& mask )
{ {
if( mask.data != NULL && ( mask.size() != image.size() || mask.type() != CV_8UC1 ) ) if( mask.data != NULL && ( mask.size() != image.size() || mask.type() != CV_8UC1 ) )
{ throw std::runtime_error( "Mask error while detecting lines: please check its dimensions and that data type is CV_8UC1" );
std::cout << "Mask error while detecting lines: " << "please check its dimensions and that data type is CV_8UC1" << std::endl;
CV_Assert( false );
}
else else
detectImpl( image, keylines, mask ); detectImpl( image, keylines, mask );
...@@ -305,13 +299,9 @@ void BinaryDescriptor::detect( const std::vector<Mat>& images, std::vector<std:: ...@@ -305,13 +299,9 @@ void BinaryDescriptor::detect( const std::vector<Mat>& images, std::vector<std::
for ( size_t counter = 0; counter < images.size(); counter++ ) for ( size_t counter = 0; counter < images.size(); counter++ )
{ {
if( masks[counter].data != NULL && ( masks[counter].size() != images[counter].size() || masks[counter].type() != CV_8UC1 ) ) if( masks[counter].data != NULL && ( masks[counter].size() != images[counter].size() || masks[counter].type() != CV_8UC1 ) )
{ throw std::runtime_error( "Masks error while detecting lines: please check their dimensions and that data types are CV_8UC1" );
std::cout << "Masks error while detecting lines: " << "please check their dimensions and that data types are CV_8UC1" << std::endl;
CV_Assert( false );
}
else
detectImpl( images[counter], keylines[counter], masks[counter] ); detectImpl( images[counter], keylines[counter], masks[counter] );
} }
} }
...@@ -327,10 +317,7 @@ void BinaryDescriptor::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& ke ...@@ -327,10 +317,7 @@ void BinaryDescriptor::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& ke
/*check whether image depth is different from 0 */ /*check whether image depth is different from 0 */
if( image.depth() != 0 ) if( image.depth() != 0 )
{ throw std::runtime_error( "Warning, depth image!= 0" );
std::cout << "Warning, depth image!= 0" << std::endl;
CV_Assert( false );
}
/* create a pointer to self */ /* create a pointer to self */
BinaryDescriptor *bn = const_cast<BinaryDescriptor*>( this ); BinaryDescriptor *bn = const_cast<BinaryDescriptor*>( this );
...@@ -415,10 +402,7 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector<KeyLine>& k ...@@ -415,10 +402,7 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector<KeyLine>& k
/*check whether image's depth is different from 0 */ /*check whether image's depth is different from 0 */
if( image.depth() != 0 ) if( image.depth() != 0 )
{ throw std::runtime_error( "Error, depth of image != 0" );
std::cout << "Error, depth of image != 0" << std::endl;
CV_Assert( false );
}
/* keypoints list can't be empty */ /* keypoints list can't be empty */
if( keylines.size() == 0 ) if( keylines.size() == 0 )
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include <algorithm> #include <algorithm>
#include <bitset> #include <bitset>
#include <time.h> #include <time.h>
#include <stdexcept>
#include "opencv2/line_descriptor.hpp" #include "opencv2/line_descriptor.hpp"
......
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