Commit 29b6529c authored by biagio montesano's avatar biagio montesano

Additional cast warnings resolved

parent d19f2ba6
......@@ -111,7 +111,7 @@ uchar invertSingleBits( uchar dividend_char, int numBits )
/* reconvert to decimal */
uchar result = 0;
for ( int i = (int) bin_vector.size() - 1; i >= 0; i-- )
result += bin_vector[i] * pow( 2, i );
result += (uchar) ( bin_vector[i] * pow( 2, i ) );
return result;
}
......@@ -162,7 +162,7 @@ int main( int argc, char** argv )
Mat descr2Copy = descr1.clone();
/* randomly change some bits in original descriptors */
srand( time( NULL ) );
srand( (unsigned int) time( NULL ) );
for ( int j = 0; j < descr1.rows; j++ )
{
......
......@@ -167,15 +167,15 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
checkLineExtremes( extremes, gaussianPyrs[j].size() );
/* fill KeyLine's fields */
kl.startPointX = extremes[0];
kl.startPointY = extremes[1];
kl.endPointX = extremes[2];
kl.endPointY = extremes[3];
kl.sPointInOctaveX = extremes[0];
kl.sPointInOctaveY = extremes[1];
kl.ePointInOctaveX = extremes[2];
kl.ePointInOctaveY = extremes[3];
kl.lineLength = sqrt( pow( extremes[0] - extremes[2], 2 ) + pow( extremes[1] - extremes[3], 2 ) );
kl.startPointX = (float) extremes[0];
kl.startPointY = (float) extremes[1];
kl.endPointX = (float) extremes[2];
kl.endPointY = (float) extremes[3];
kl.sPointInOctaveX = (float) extremes[0];
kl.sPointInOctaveY = (float) extremes[1];
kl.ePointInOctaveX = (float) extremes[2];
kl.ePointInOctaveY = (float) extremes[3];
kl.lineLength = (float) sqrt( pow( extremes[0] - extremes[2], 2 ) + pow( extremes[1] - extremes[3], 2 ) );
/* compute number of pixels covered by line */
LineIterator li( gaussianPyrs[j], Point( extremes[0], extremes[1] ), Point( extremes[2], extremes[3] ) );
......@@ -186,7 +186,7 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
kl.octave = j;
kl.size = ( kl.endPointX - kl.startPointX ) * ( kl.endPointY - kl.startPointY );
kl.response = kl.lineLength / max( gaussianPyrs[j].cols, gaussianPyrs[j].rows );
kl.pt = Point( ( kl.endPointX + kl.startPointX ) / 2, ( kl.endPointY + kl.startPointY ) / 2 );
kl.pt = Point2f( ( kl.endPointX + kl.startPointX ) / 2, ( kl.endPointY + kl.startPointY ) / 2 );
keylines.push_back( kl );
}
......@@ -198,7 +198,7 @@ void LSDDetector::detectImpl( const Mat& imageSrc, std::vector<KeyLine>& keyline
for ( size_t keyCounter = 0; keyCounter < keylines.size(); keyCounter++ )
{
KeyLine kl = keylines[keyCounter];
if( mask.at<uchar>( kl.startPointY, kl.startPointX ) == 0 && mask.at<uchar>( kl.endPointY, kl.endPointX ) == 0 )
if( mask.at<uchar>( (int)kl.startPointY, (int)kl.startPointX ) == 0 && mask.at<uchar>( (int)kl.endPointY, (int)kl.endPointX ) == 0 )
keylines.erase( keylines.begin() + keyCounter );
}
}
......
......@@ -948,14 +948,15 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
unsigned int *pLineYCors = lines.yCors.data();
unsigned int *pLineSID = lines.sId.data();
logNT_ = 2.0 * ( log10( (double) imageWidth ) + log10( (double) imageHeight ) );
double lineFitErr; //the line fit error;
double lineFitErr = 0; //the line fit error;
std::vector<double> lineEquation( 2, 0 );
lineEquations_.clear();
lineEndpoints_.clear();
lineDirection_.clear();
unsigned char *pdirImg = dirImg_.data;
unsigned int numOfLines = 0;
unsigned int offsetInEdgeArrayS, offsetInEdgeArrayE, newOffsetS; //start index and end index
unsigned int newOffsetS = 0;
unsigned int offsetInEdgeArrayS, offsetInEdgeArrayE; //start index and end index
unsigned int offsetInLineArray = 0;
float direction; //line direction
......@@ -977,7 +978,7 @@ int EDLineDetector::EDline( cv::Mat &image, LineChains &lines, bool smoothed )
break; //no line is detected
//An initial line segment is detected. Try to extend this line segment
pLineSID[numOfLines] = offsetInLineArray;
double coef1; //for a line ax+by+c=0, coef1 = 1/sqrt(a^2+b^2);
double coef1 = 0; //for a line ax+by+c=0, coef1 = 1/sqrt(a^2+b^2);
double pointToLineDis; //for a line ax+by+c=0 and a point(xi, yi), pointToLineDis = coef1*|a*xi+b*yi+c|
bool bExtended = true;
bool bFirstTry = true;
......
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