fixed linker errors on Win and some warnings

This commit is contained in:
Maria Dimashova
2010-08-05 13:29:43 +00:00
parent 121e51d35b
commit 4395bad911
6 changed files with 59 additions and 29 deletions

View File

@@ -79,11 +79,11 @@ Mat windowedMatchingMask( const vector<KeyPoint>& keypoints1, const vector<KeyPo
static inline void _drawKeypoint( Mat& img, const KeyPoint& p, const Scalar& color, int flags )
{
Point center( p.pt.x * draw_multiplier, p.pt.y * draw_multiplier );
Point center( cvRound(p.pt.x * draw_multiplier), cvRound(p.pt.y * draw_multiplier) );
if( flags & DrawMatchesFlags::DRAW_RICH_KEYPOINTS )
{
int radius = p.size/2 * draw_multiplier; // KeyPoint::size is a diameter
int radius = cvRound(p.size/2 * draw_multiplier); // KeyPoint::size is a diameter
// draw the circles around keypoints with the keypoints size
circle( img, center, radius, color, 1, CV_AA, draw_shift_bits );
@@ -91,8 +91,9 @@ static inline void _drawKeypoint( Mat& img, const KeyPoint& p, const Scalar& col
// draw orientation of the keypoint, if it is applicable
if( p.angle != -1 )
{
float srcAngleRad = p.angle*CV_PI/180;
Point orient(cos(srcAngleRad)*radius, sin(srcAngleRad)*radius);
float srcAngleRad = p.angle*(float)CV_PI/180.f;
Point orient(cvRound(cos(srcAngleRad)*radius),
cvRound(sin(srcAngleRad)*radius));
line( img, center, center+orient, color, 1, CV_AA, draw_shift_bits );
}
#if 0
@@ -175,7 +176,9 @@ static inline void _drawMatch( Mat& outImg, Mat& outImg1, Mat& outImg2 ,
pt2 = kp2.pt,
dpt2 = Point2f( std::min(pt2.x+outImg1.cols, float(outImg.cols-1)), pt2.y );
line( outImg, Point(pt1.x*draw_multiplier, pt1.y*draw_multiplier), Point(dpt2.x*draw_multiplier, dpt2.y*draw_multiplier),
line( outImg,
Point(cvRound(pt1.x*draw_multiplier), cvRound(pt1.y*draw_multiplier)),
Point(cvRound(dpt2.x*draw_multiplier), cvRound(dpt2.y*draw_multiplier)),
color, 1, CV_AA, draw_shift_bits );
}
@@ -461,7 +464,7 @@ void BruteForceMatcher<L2<float> >::matchImpl( const Mat& query, const Mat& mask
{
match.indexQuery = i;
double queryNorm = norm( query.row(i) );
match.distance = sqrt( minVal + queryNorm*queryNorm );
match.distance = (float)sqrt( minVal + queryNorm*queryNorm );
matches.push_back( match );
}
}

View File

@@ -46,18 +46,18 @@
using namespace cv;
using namespace std;
inline Point2f applyHomography( const Mat_<double>& H, const Point2f& pt )
static inline Point2f applyHomography( const Mat_<double>& H, const Point2f& pt )
{
double z = H(2,0)*pt.x + H(2,1)*pt.y + H(2,2);
if( z )
{
double w = 1./z;
return Point2f( (H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w, (H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w );
return Point2f( (float)((H(0,0)*pt.x + H(0,1)*pt.y + H(0,2))*w), (float)((H(1,0)*pt.x + H(1,1)*pt.y + H(1,2))*w) );
}
return Point2f( numeric_limits<double>::max(), numeric_limits<double>::max() );
return Point2f( numeric_limits<float>::max(), numeric_limits<float>::max() );
}
inline void linearizeHomographyAt( const Mat_<double>& H, const Point2f& pt, Mat_<double>& A )
static inline void linearizeHomographyAt( const Mat_<double>& H, const Point2f& pt, Mat_<double>& A )
{
A.create(2,2);
double p1 = H(0,0)*pt.x + H(0,1)*pt.y + H(0,2),
@@ -110,12 +110,12 @@ EllipticKeyPoint::EllipticKeyPoint( const Point2f& _center, const Scalar& _ellip
Mat_<double> M = getSecondMomentsMatrix(_ellipse), eval;
eigen( M, eval );
assert( eval.rows == 2 && eval.cols == 1 );
axes.width = 1.f / sqrt(eval(0,0));
axes.height = 1.f / sqrt(eval(1,0));
axes.width = 1.f / (float)sqrt(eval(0,0));
axes.height = 1.f / (float)sqrt(eval(1,0));
float ac_b2 = ellipse[0]*ellipse[2] - ellipse[1]*ellipse[1];
boundingBox.width = sqrt(ellipse[2]/ac_b2);
boundingBox.height = sqrt(ellipse[0]/ac_b2);
double ac_b2 = ellipse[0]*ellipse[2] - ellipse[1]*ellipse[1];
boundingBox.width = (float)sqrt(ellipse[2]/ac_b2);
boundingBox.height = (float)sqrt(ellipse[0]/ac_b2);
}
Mat_<double> EllipticKeyPoint::getSecondMomentsMatrix( const Scalar& _ellipse )
@@ -223,7 +223,7 @@ static void overlap( const vector<EllipticKeyPoint>& keypoints1, const vector<El
fac=3;
maxDist = maxDist*4;
fac = 1.0/(fac*fac);
fac = 1.f/(fac*fac);
EllipticKeyPoint keypoint1a = EllipticKeyPoint( kp1.center, Scalar(fac*kp1.ellipse[0], fac*kp1.ellipse[1], fac*kp1.ellipse[2]) );
@@ -246,8 +246,8 @@ static void overlap( const vector<EllipticKeyPoint>& keypoints1, const vector<El
float miny = floor((-keypoint1a.boundingBox.height < (diff.y-keypoint2a.boundingBox.height)) ?
-keypoint1a.boundingBox.height : (diff.y-keypoint2a.boundingBox.height));
float mina = (maxx-minx) < (maxy-miny) ? (maxx-minx) : (maxy-miny) ;
float dr = mina/50.0;
float bua = 0, bna = 0;
float dr = mina/50.f;
float bua = 0.f, bna = 0.f;
//compute the area
for( float rx1 = minx; rx1 <= maxx; rx1+=dr )
{
@@ -256,8 +256,8 @@ static void overlap( const vector<EllipticKeyPoint>& keypoints1, const vector<El
{
float ry2=ry1-diff.y;
//compute the distance from the ellipse center
float e1 = keypoint1a.ellipse[0]*rx1*rx1+2*keypoint1a.ellipse[1]*rx1*ry1+keypoint1a.ellipse[2]*ry1*ry1;
float e2 = keypoint2a.ellipse[0]*rx2*rx2+2*keypoint2a.ellipse[1]*rx2*ry2+keypoint2a.ellipse[2]*ry2*ry2;
float e1 = (float)(keypoint1a.ellipse[0]*rx1*rx1+2*keypoint1a.ellipse[1]*rx1*ry1+keypoint1a.ellipse[2]*ry1*ry1);
float e2 = (float)(keypoint2a.ellipse[0]*rx2*rx2+2*keypoint2a.ellipse[1]*rx2*ry2+keypoint2a.ellipse[2]*ry2*ry2);
//compute the area
if( e1<1 && e2<1 ) bna++;
if( e1<1 || e2<1 ) bua++;

View File

@@ -118,7 +118,7 @@ float KeyPoint::overlap( const KeyPoint& kp1, const KeyPoint& kp2 )
Point2f p1 = kp1.pt;
Point2f p2 = kp2.pt;
float c = norm( p1 - p2 );
float c = (float)norm( p1 - p2 );
float ovrl = 0.f;
@@ -143,7 +143,7 @@ float KeyPoint::overlap( const KeyPoint& kp1, const KeyPoint& kp2 )
float triangleAreaB = b_2 * sinAlpha * cosAlpha;
float intersectionArea = segmentAreaA + segmentAreaB - triangleAreaA - triangleAreaB;
float unionArea = (a_2 + b_2) * CV_PI - intersectionArea;
float unionArea = (a_2 + b_2) * (float)CV_PI - intersectionArea;
ovrl = intersectionArea / unionArea;
}