case HALF_SIZE:
if( i > src.cols*0.25 && i < src.cols*0.75 && j > src.rows*0.25 && j < src.rows*0.75 )
{
- map_x.at<float>(j,i) = 2*( i - src.cols*0.25 ) + 0.5 ;
- map_y.at<float>(j,i) = 2*( j - src.rows*0.25 ) + 0.5 ;
+ map_x.at<float>(j,i) = 2*( i - src.cols*0.25f ) + 0.5f ;
+ map_y.at<float>(j,i) = 2*( j - src.rows*0.25f ) + 0.5f ;
}
else
{
}
break;
case UPSIDE_DOWN:
- map_x.at<float>(j,i) = i ;
- map_y.at<float>(j,i) = src.rows - j ;
+ map_x.at<float>(j,i) = static_cast<float>(i) ;
+ map_y.at<float>(j,i) = static_cast<float>(src.rows - j) ;
break;
case REFLECTION_X:
- map_x.at<float>(j,i) = src.cols - i ;
- map_y.at<float>(j,i) = j ;
+ map_x.at<float>(j,i) = static_cast<float>(src.cols - i) ;
+ map_y.at<float>(j,i) = static_cast<float>(j) ;
break;
case REFLECTION_BOTH:
- map_x.at<float>(j,i) = src.cols - i ;
- map_y.at<float>(j,i) = src.rows - j ;
+ map_x.at<float>(j,i) = static_cast<float>(src.cols - i) ;
+ map_y.at<float>(j,i) = static_cast<float>(src.rows - j) ;
break;
} // end of switch
}
Mat generateHomography(float angle)
{
// angle - rotation around Oz in degrees
- float angleRadian = angle * CV_PI / 180.;
+ float angleRadian = static_cast<float>(angle * CV_PI / 180);
Mat H = Mat::eye(3, 3, CV_32FC1);
H.at<float>(0,0) = H.at<float>(1,1) = std::cos(angleRadian);
H.at<float>(0,1) = -std::sin(angleRadian);
// angle - rotation around Oz in degrees
float diag = std::sqrt(static_cast<float>(srcImage.cols * srcImage.cols + srcImage.rows * srcImage.rows));
Mat LUShift = Mat::eye(3, 3, CV_32FC1); // left up
- LUShift.at<float>(0,2) = -srcImage.cols/2;
- LUShift.at<float>(1,2) = -srcImage.rows/2;
+ LUShift.at<float>(0,2) = static_cast<float>(-srcImage.cols/2);
+ LUShift.at<float>(1,2) = static_cast<float>(-srcImage.rows/2);
Mat RDShift = Mat::eye(3, 3, CV_32FC1); // right down
RDShift.at<float>(0,2) = diag/2;
RDShift.at<float>(1,2) = diag/2;
static
float calcCirclesIntersectArea(const Point2f& p0, float r0, const Point2f& p1, float r1)
{
- float c = norm(p0 - p1), sqr_c = c * c;
+ float c = static_cast<float>(norm(p0 - p1)), sqr_c = c * c;
float sqr_r0 = r0 * r0;
float sqr_r1 = r1 * r1;
float minR = std::min(r0, r1);
float maxR = std::max(r0, r1);
if(c + minR <= maxR)
- return CV_PI * minR * minR;
+ return static_cast<float>(CV_PI * minR * minR);
float cos_halfA0 = (sqr_r0 + sqr_c - sqr_r1) / (2 * r0 * c);
float cos_halfA1 = (sqr_r1 + sqr_c - sqr_r0) / (2 * r1 * c);
float A0 = 2 * acos(cos_halfA0);
float A1 = 2 * acos(cos_halfA1);
- return 0.5 * sqr_r0 * (A0 - sin(A0)) +
- 0.5 * sqr_r1 * (A1 - sin(A1));
+ return 0.5f * sqr_r0 * (A0 - sin(A0)) +
+ 0.5f * sqr_r1 * (A1 - sin(A1));
}
static
float calcIntersectRatio(const Point2f& p0, float r0, const Point2f& p1, float r1)
{
float intersectArea = calcCirclesIntersectArea(p0, r0, p1, r1);
- float unionArea = CV_PI * (r0 * r0 + r1 * r1) - intersectArea;
+ float unionArea = static_cast<float>(CV_PI) * (r0 * r0 + r1 * r1) - intersectArea;
return intersectArea / unionArea;
}
matches.clear();
vector<uchar> usedMask(keypoints1.size(), 0);
- for(size_t i0 = 0; i0 < keypoints0.size(); i0++)
+ for(int i0 = 0; i0 < static_cast<int>(keypoints0.size()); i0++)
{
int nearestPointIndex = -1;
float maxIntersectRatio = 0.f;
if(intersectRatio > maxIntersectRatio)
{
maxIntersectRatio = intersectRatio;
- nearestPointIndex = i1;
+ nearestPointIndex = static_cast<int>(i1);
}
}
const int maxAngle = 360, angleStep = 15;
for(int angle = 0; angle < maxAngle; angle += angleStep)
{
- Mat H = rotateImage(image0, angle, image1, mask1);
+ Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1);
vector<KeyPoint> keypoints1;
featureDetector->detect(image1, keypoints1, mask1);
const int maxAngle = 360, angleStep = 15;
for(int angle = 0; angle < maxAngle; angle += angleStep)
{
- Mat H = rotateImage(image0, angle, image1, mask1);
+ Mat H = rotateImage(image0, static_cast<float>(angle), image1, mask1);
vector<KeyPoint> keypoints1;
- rotateKeyPoints(keypoints0, H, angle, keypoints1);
+ rotateKeyPoints(keypoints0, H, static_cast<float>(angle), keypoints1);
Mat descriptors1;
descriptorExtractor->compute(image1, keypoints1, descriptors1);
keyPointMatchesCount++;
// Check does this inlier have consistent sizes
- const float maxSizeDiff = 0.8;//0.9f; // grad
+ const float maxSizeDiff = 0.8f;//0.9f; // grad
float size0 = keypoints0[matches[m].trainIdx].size;
float size1 = osiKeypoints1[matches[m].queryIdx].size;
CV_Assert(size0 > 0 && size1 > 0);
resize(image0, image1, Size(), 1./scale, 1./scale);
vector<KeyPoint> keypoints1;
- scaleKeyPoints(keypoints0, keypoints1, 1./scale);
+ scaleKeyPoints(keypoints0, keypoints1, 1.0f/scale);
Mat descriptors1;
descriptorExtractor->compute(image1, keypoints1, descriptors1);
if (src.size() == 0)\r
return;\r
\r
- vector<pair<int, int> > pairs;\r
+ vector<pair<size_t, size_t> > pairs;\r
\r
for (size_t i = 0; i+1 < src.size(); ++i)\r
for (size_t j = i+1; j < src.size(); ++j)\r
\r
for (size_t i = 0; i < pairs.size(); ++i)\r
{\r
- int i0 = pairs[i].first, i1 = pairs[i].second;\r
+ size_t i0 = pairs[i].first, i1 = pairs[i].second;\r
process(src[i0], src[i1], corners[i0], corners[i1], masks[i0], masks[i1]);\r
}\r
\r
bool hasConflict = true;\r
while (hasConflict)\r
{\r
- int c1, c2;\r
+ int c1 = 0, c2 = 0;\r
hasConflict = false;\r
\r
for (set<pair<int, int> >::iterator itr = edges_.begin(); itr != edges_.end(); ++itr)\r
double cx = cvRound(sum[idx[i]].x / size);\r
double cy = cvRound(sum[idx[i]].y / size);\r
\r
- int closest = -1;\r
+ size_t closest = points[idx[i]].size();\r
double minDist = numeric_limits<double>::max();\r
\r
for (size_t j = 0; j < points[idx[i]].size(); ++j)\r