fixed hundreds of warnings from MSVC 2010.

pull/13383/head
Vadim Pisarevsky 13 years ago
parent 20cceb8fdf
commit 4985c1b632
  1. 4
      apps/traincascade/HOGfeatures.h
  2. 4
      apps/traincascade/boost.cpp
  3. 4
      modules/calib3d/perf/perf_pnp.cpp
  4. 3
      modules/calib3d/src/solvepnp.cpp
  5. 41
      modules/calib3d/test/test_homography.cpp
  6. 2
      modules/calib3d/test/test_solvepnp_ransac.cpp
  7. 13
      modules/contrib/include/opencv2/contrib/contrib.hpp
  8. 10
      modules/contrib/src/gencolors.cpp
  9. 28
      modules/contrib/src/rgbdodometry.cpp
  10. 6
      modules/core/include/opencv2/core/core_c.h
  11. 12
      modules/core/include/opencv2/core/operations.hpp
  12. 2
      modules/core/perf/perf_math.cpp
  13. 10
      modules/core/src/arithm.cpp
  14. 6
      modules/core/src/cmdparser.cpp
  15. 12
      modules/core/src/datastructs.cpp
  16. 1
      modules/core/src/persistence.cpp
  17. 23
      modules/core/test/test_countnonzero.cpp
  18. 16
      modules/core/test/test_eigen.cpp
  19. 10
      modules/features2d/src/fast.cpp
  20. 8
      modules/features2d/src/matchers.cpp
  21. 8
      modules/features2d/src/mser.cpp
  22. 9
      modules/features2d/src/orb.cpp
  23. 2
      modules/features2d/src/stardetector.cpp
  24. 4
      modules/flann/include/opencv2/flann/ground_truth.h
  25. 8
      modules/flann/include/opencv2/flann/hierarchical_clustering_index.h
  26. 2
      modules/flann/include/opencv2/flann/index_testing.h
  27. 12
      modules/flann/include/opencv2/flann/kdtree_single_index.h
  28. 2
      modules/flann/include/opencv2/flann/kmeans_index.h
  29. 2
      modules/flann/include/opencv2/flann/linear_index.h
  30. 8
      modules/flann/include/opencv2/flann/lsh_index.h
  31. 10
      modules/flann/include/opencv2/flann/lsh_table.h
  32. 4
      modules/flann/include/opencv2/flann/nn_index.h
  33. 4
      modules/flann/include/opencv2/flann/sampling.h
  34. 4
      modules/flann/src/flann.cpp
  35. 4
      modules/flann/src/precomp.hpp
  36. 1
      modules/highgui/src/cap.cpp
  37. 1
      modules/highgui/src/cap_vfw.cpp
  38. 4
      modules/highgui/src/grfmt_jpeg.cpp
  39. 2
      modules/highgui/test/test_positioning.cpp
  40. 2
      modules/imgproc/perf/perf_filter2d.cpp
  41. 17
      modules/imgproc/src/color.cpp
  42. 4
      modules/imgproc/src/gabor.cpp
  43. 6
      modules/imgproc/src/geometry.cpp
  44. 6
      modules/imgproc/src/morph.cpp
  45. 11
      modules/imgproc/src/phasecorr.cpp
  46. 4
      modules/imgproc/src/thresh.cpp
  47. 2
      modules/imgproc/test/test_boundingrect.cpp
  48. 4
      modules/legacy/include/opencv2/legacy/legacy.hpp
  49. 4
      modules/legacy/src/features2d.cpp
  50. 21
      modules/nonfree/src/sift.cpp
  51. 11
      modules/nonfree/src/surf.cpp
  52. 2
      modules/nonfree/test/test_detectors.cpp
  53. 2
      modules/objdetect/src/latentsvmdetector.cpp
  54. 2
      modules/objdetect/src/linemod.cpp
  55. 16
      modules/stitching/include/opencv2/stitching/detail/warpers_inl.hpp
  56. 2
      modules/stitching/src/matchers.cpp
  57. 2
      modules/stitching/src/motion_estimators.cpp
  58. 4
      modules/stitching/src/stitcher.cpp
  59. 10
      modules/ts/src/ts_perf.cpp
  60. 7
      samples/c/blobtrack_sample.cpp
  61. 2
      samples/c/mushroom.cpp
  62. 2
      samples/c/tree_engine.cpp
  63. 3
      samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping.cpp
  64. 11
      samples/cpp/OpenEXRimages_HighDynamicRange_Retina_toneMapping_video.cpp
  65. 30
      samples/cpp/bagofwords_classification.cpp
  66. 2
      samples/cpp/calibration.cpp
  67. 8
      samples/cpp/ffilldemo.cpp
  68. 22
      samples/cpp/hybridtrackingsample.cpp
  69. 6
      samples/cpp/latentsvm_multidetect.cpp
  70. 49
      samples/cpp/linemod.cpp
  71. 2
      samples/cpp/matching_to_many_images.cpp
  72. 2
      samples/cpp/openni_capture.cpp
  73. 2
      samples/cpp/peopledetect.cpp
  74. 2
      samples/cpp/phase_corr.cpp
  75. 2
      samples/cpp/point_cloud.cpp
  76. 2
      samples/cpp/points_classifier.cpp
  77. 14
      samples/cpp/rgbdodometry.cpp
  78. 4
      samples/cpp/select3dobj.cpp
  79. 5
      samples/cpp/stitching_detailed.cpp
  80. 2
      samples/cpp/video_dmtx.cpp
  81. 2
      samples/gpu/alpha_comp.cpp
  82. 2
      samples/gpu/brox_optical_flow.cpp
  83. 2
      samples/gpu/performance/tests.cpp

@ -65,10 +65,10 @@ inline float CvHOGEvaluator::Feature::calc( const vector<Mat>& _hists, const Mat
int binIdx = featComponent % N_BINS;
int cellIdx = featComponent / N_BINS;
const float *hist = _hists[binIdx].ptr<float>(y);
const float *hist = _hists[binIdx].ptr<float>((int)y);
res = hist[fastRect[cellIdx].p0] - hist[fastRect[cellIdx].p1] - hist[fastRect[cellIdx].p2] + hist[fastRect[cellIdx].p3];
const float *normSum = _normSum.ptr<float>(y);
const float *normSum = _normSum.ptr<float>((int)y);
normFactor = (float)(normSum[fastRect[0].p0] - normSum[fastRect[1].p1] - normSum[fastRect[2].p2] + normSum[fastRect[3].p3]);
res = (res > 0.001f) ? ( res / (normFactor + 0.001f) ) : 0.f; //for cutting negative values, which apper due to floating precision

@ -275,7 +275,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
if( _subsample_idx )
{
CV_Assert( isubsample_idx = cvPreprocessIndexArray( _subsample_idx, sample_count ) );
CV_Assert( (isubsample_idx = cvPreprocessIndexArray( _subsample_idx, sample_count )) != 0 );
if( isubsample_idx->cols + isubsample_idx->rows - 1 == sample_count )
{
@ -321,7 +321,7 @@ CvDTreeNode* CvCascadeBoostTrainData::subsample_data( const CvMat* _subsample_id
root = new_node( 0, count, 1, 0 );
CV_Assert( subsample_co = cvCreateMat( 1, sample_count*2, CV_32SC1 ));
CV_Assert( (subsample_co = cvCreateMat( 1, sample_count*2, CV_32SC1 )) != 0);
cvZero( subsample_co );
co = subsample_co->data.i;
for( int i = 0; i < count; i++ )

@ -40,7 +40,7 @@ PERF_TEST_P(PointsNum_Algo, solvePnP,
projectPoints(points3d, rvec, tvec, intrinsics, distortion, points2d);
//add noise
Mat noise(1, points2d.size(), CV_32FC2);
Mat noise(1, (int)points2d.size(), CV_32FC2);
randu(noise, 0, 0.01);
add(points2d, noise, points2d);
@ -75,7 +75,7 @@ PERF_TEST(PointsNum_Algo, solveP3P)
projectPoints(points3d, rvec, tvec, intrinsics, distortion, points2d);
//add noise
Mat noise(1, points2d.size(), CV_32FC2);
Mat noise(1, (int)points2d.size(), CV_32FC2);
randu(noise, 0, 0.01);
add(points2d, noise, points2d);

@ -92,10 +92,7 @@ bool cv::solvePnP( InputArray _opoints, InputArray _ipoints,
return true;
}
else
{
CV_Error(CV_StsBadArg, "The flags argument must be one of CV_ITERATIVE or CV_EPNP");
return false;
}
return false;
}

@ -64,8 +64,8 @@
#define COUNT_NORM_TYPES 3
#define METHODS_COUNT 3
size_t NORM_TYPE[COUNT_NORM_TYPES] = {cv::NORM_L1, cv::NORM_L2, cv::NORM_INF};
size_t METHOD[METHODS_COUNT] = {0, CV_RANSAC, CV_LMEDS};
int NORM_TYPE[COUNT_NORM_TYPES] = {cv::NORM_L1, cv::NORM_L2, cv::NORM_INF};
int METHOD[METHODS_COUNT] = {0, CV_RANSAC, CV_LMEDS};
using namespace cv;
using namespace std;
@ -247,13 +247,13 @@ void CV_HomographyTest::print_information_8(int j, int N, int k, int l, double d
void CV_HomographyTest::run(int)
{
for (size_t N = 4; N <= MAX_COUNT_OF_POINTS; ++N)
for (int N = 4; N <= MAX_COUNT_OF_POINTS; ++N)
{
RNG& rng = ts->get_rng();
float *src_data = new float [2*N];
for (size_t i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
src_data[2*i] = (float)cvtest::randReal(rng)*image_size;
src_data[2*i+1] = (float)cvtest::randReal(rng)*image_size;
@ -266,7 +266,7 @@ void CV_HomographyTest::run(int)
vector <Point2f> src_vec, dst_vec;
for (size_t i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
float *tmp = src_mat_2d.ptr<float>()+2*i;
src_mat_3d.at<float>(0, i) = tmp[0];
@ -293,7 +293,7 @@ void CV_HomographyTest::run(int)
dst_mat_2d.create(2, N, CV_32F); dst_mat_2f.create(1, N, CV_32FC2);
for (size_t i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
float *tmp_2f = dst_mat_2f.ptr<float>()+2*i;
tmp_2f[0] = dst_mat_2d.at<float>(0, i) = dst_mat_3d.at<float>(0, i) /= dst_mat_3d.at<float>(2, i);
@ -303,7 +303,7 @@ void CV_HomographyTest::run(int)
dst_vec.push_back(Point2f(tmp_2f[0], tmp_2f[1]));
}
for (size_t i = 0; i < METHODS_COUNT; ++i)
for (int i = 0; i < METHODS_COUNT; ++i)
{
method = METHOD[i];
switch (method)
@ -316,7 +316,7 @@ void CV_HomographyTest::run(int)
cv::findHomography(src_vec, dst_mat_2f, method),
cv::findHomography(src_vec, dst_vec, method) };
for (size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
if (!check_matrix_size(H_res_64[j]))
@ -328,7 +328,7 @@ void CV_HomographyTest::run(int)
double diff;
for (size_t k = 0; k < COUNT_NORM_TYPES; ++k)
for (int k = 0; k < COUNT_NORM_TYPES; ++k)
if (!check_matrix_diff(H_64, H_res_64[j], NORM_TYPE[k], diff))
{
print_information_2(j, N, method, H_64, H_res_64[j], k, diff);
@ -348,7 +348,7 @@ void CV_HomographyTest::run(int)
cv::findHomography(src_vec, dst_mat_2f, CV_RANSAC, reproj_threshold, mask[2]),
cv::findHomography(src_vec, dst_vec, CV_RANSAC, reproj_threshold, mask[3]) };
for (size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
if (!check_matrix_size(H_res_64[j]))
@ -358,7 +358,7 @@ void CV_HomographyTest::run(int)
return;
}
for (size_t k = 0; k < COUNT_NORM_TYPES; ++k)
for (int k = 0; k < COUNT_NORM_TYPES; ++k)
if (!check_matrix_diff(H_64, H_res_64[j], NORM_TYPE[k], diff))
{
print_information_2(j, N, method, H_64, H_res_64[j], k, diff);
@ -398,14 +398,14 @@ void CV_HomographyTest::run(int)
cv::Mat mask(N, 1, CV_8UC1);
for (size_t i = 0; i < N; ++i)
for (int i = 0; i < N; ++i)
{
float *a = noise_2f.ptr<float>()+2*i, *_2f = dst_mat_2f.ptr<float>()+2*i;
_2f[0] += a[0]; _2f[1] += a[1];
mask.at<bool>(i, 0) = !(sqrt(a[0]*a[0]+a[1]*a[1]) > reproj_threshold);
}
for (size_t i = 0; i < METHODS_COUNT; ++i)
for (int i = 0; i < METHODS_COUNT; ++i)
{
method = METHOD[i];
switch (method)
@ -418,7 +418,7 @@ void CV_HomographyTest::run(int)
cv::findHomography(src_vec, dst_mat_2f),
cv::findHomography(src_vec, dst_vec) };
for (size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
if (!check_matrix_size(H_res_64[j]))
@ -432,7 +432,7 @@ void CV_HomographyTest::run(int)
cv::Mat dst_res_3d(3, N, CV_32F), noise_2d(2, N, CV_32F);
for (size_t k = 0; k < N; ++k)
for (int k = 0; k < N; ++k)
{
Mat tmp_mat_3d = H_res_32*src_mat_3d.col(k);
@ -444,7 +444,7 @@ void CV_HomographyTest::run(int)
float *a = noise_2f.ptr<float>()+2*k;
noise_2d.at<float>(0, k) = a[0]; noise_2d.at<float>(1, k) = a[1];
for (size_t l = 0; l < COUNT_NORM_TYPES; ++l)
for (int l = 0; l < COUNT_NORM_TYPES; ++l)
if (cv::norm(tmp_mat_3d, dst_mat_3d.col(k), NORM_TYPE[l]) - cv::norm(noise_2d.col(k), NORM_TYPE[l]) > max_2diff)
{
print_information_4(method, j, N, k, l, cv::norm(tmp_mat_3d, dst_mat_3d.col(k), NORM_TYPE[l]) - cv::norm(noise_2d.col(k), NORM_TYPE[l]));
@ -454,7 +454,7 @@ void CV_HomographyTest::run(int)
}
for (size_t l = 0; l < COUNT_NORM_TYPES; ++l)
for (int l = 0; l < COUNT_NORM_TYPES; ++l)
if (cv::norm(dst_res_3d, dst_mat_3d, NORM_TYPE[l]) - cv::norm(noise_2d, NORM_TYPE[l]) > max_diff)
{
print_information_5(method, j, N, l, cv::norm(dst_res_3d, dst_mat_3d, NORM_TYPE[l]) - cv::norm(noise_2d, NORM_TYPE[l]));
@ -475,9 +475,8 @@ void CV_HomographyTest::run(int)
cv::findHomography(src_vec, dst_mat_2f, CV_RANSAC, reproj_threshold, mask_res[2]),
cv::findHomography(src_vec, dst_vec, CV_RANSAC, reproj_threshold, mask_res[3]) };
for (size_t j = 0; j < 4; ++j)
for (int j = 0; j < 4; ++j)
{
if (!check_matrix_size(H_res_64[j]))
{
print_information_1(j, N, method, H_res_64[j]);
@ -506,7 +505,7 @@ void CV_HomographyTest::run(int)
cv::Mat dst_res_3d = H_res_32*src_mat_3d;
for (size_t k = 0; k < N; ++k)
for (int k = 0; k < N; ++k)
{
dst_res_3d.at<float>(0, k) /= dst_res_3d.at<float>(2, k);
dst_res_3d.at<float>(1, k) /= dst_res_3d.at<float>(2, k);
@ -542,7 +541,7 @@ void CV_HomographyTest::run(int)
cv::Mat noise_2d(2, 1, CV_32F);
noise_2d.at<float>(0, 0) = a[0]; noise_2d.at<float>(1, 0) = a[1];
for (size_t l = 0; l < COUNT_NORM_TYPES; ++l)
for (int l = 0; l < COUNT_NORM_TYPES; ++l)
{
diff = cv::norm(dst_res_3d.col(k), dst_mat_3d.col(k), NORM_TYPE[l]);

@ -126,7 +126,7 @@ protected:
{
if (i % 20 == 0)
{
projectedPoints[i] = projectedPoints[rng.uniform(0,points.size()-1)];
projectedPoints[i] = projectedPoints[rng.uniform(0,(int)points.size()-1)];
}
}

@ -629,19 +629,16 @@ namespace cv
* Estimate the rigid body motion from frame0 to frame1. The method is based on the paper
* "Real-Time Visual Odometry from Dense RGB-D Images", F. Steinbucker, J. Strum, D. Cremers, ICCV, 2011.
*/
CV_EXPORTS struct TransformationType
{
enum { ROTATION = 1,
TRANSLATION = 2,
RIGID_BODY_MOTION = 4
};
};
enum { ROTATION = 1,
TRANSLATION = 2,
RIGID_BODY_MOTION = 4
};
CV_EXPORTS bool RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
const cv::Mat& image0, const cv::Mat& depth0, const cv::Mat& mask0,
const cv::Mat& image1, const cv::Mat& depth1, const cv::Mat& mask1,
const cv::Mat& cameraMatrix, float minDepth, float maxDepth, float maxDepthDiff,
const std::vector<int>& iterCounts, const std::vector<float>& minGradientMagnitudes,
int transformType=TransformationType::RIGID_BODY_MOTION );
int transformType=RIGID_BODY_MOTION );
}
#include "opencv2/contrib/retina.hpp"

@ -53,9 +53,9 @@ void downsamplePoints( const Mat& src, Mat& dst, size_t count )
CV_Assert( src.total() >= count );
CV_Assert( src.type() == CV_8UC3);
dst.create( 1, count, CV_8UC3 );
dst.create( 1, (int)count, CV_8UC3 );
//TODO: optimize by exploiting symmetry in the distance matrix
Mat dists( src.total(), src.total(), CV_32FC1, Scalar(0) );
Mat dists( (int)src.total(), (int)src.total(), CV_32FC1, Scalar(0) );
if( dists.empty() )
std::cerr << "Such big matrix cann't be created." << std::endl;
@ -88,7 +88,7 @@ void downsamplePoints( const Mat& src, Mat& dst, size_t count )
Mat minDists;
reduce( activedDists, minDists, 0, CV_REDUCE_MIN );
minMaxLoc( minDists, 0, &maxVal, 0, &maxLoc, candidatePointsMask );
dst.at<Point3_<uchar> >(i) = src.at<Point3_<uchar> >(maxLoc.x);
dst.at<Point3_<uchar> >((int)i) = src.at<Point3_<uchar> >(maxLoc.x);
}
}
@ -113,7 +113,7 @@ void cv::generateColors( std::vector<Scalar>& colors, size_t count, size_t facto
// Generate a set of colors in RGB space. A size of the set is severel times (=factor) larger then
// the needed count of colors.
Mat bgr( 1, count*factor, CV_8UC3 );
Mat bgr( 1, (int)(count*factor), CV_8UC3 );
randu( bgr, 0, 256 );
// Convert the colors set to Lab space.
@ -134,7 +134,7 @@ void cv::generateColors( std::vector<Scalar>& colors, size_t count, size_t facto
CV_Assert( bgr_subset.total() == count );
for( size_t i = 0; i < count; i++ )
{
Point3_<uchar> c = bgr_subset.at<Point3_<uchar> >(i);
Point3_<uchar> c = bgr_subset.at<Point3_<uchar> >((int)i);
colors[i] = Scalar(c.x, c.y, c.z);
}
}

@ -148,8 +148,8 @@ void cvtDepth2Cloud( const Mat& depth, Mat& cloud, const Mat& cameraMatrix )
for( int x = 0; x < cloud.cols; x++ )
{
float z = depth_prt[x];
cloud_ptr[x].x = (x - ox) * z * inv_fx;
cloud_ptr[x].y = (y - oy) * z * inv_fy;
cloud_ptr[x].x = (float)((x - ox) * z * inv_fx);
cloud_ptr[x].y = (float)((y - oy) * z * inv_fy);
cloud_ptr[x].z = z;
}
}
@ -242,7 +242,7 @@ int computeCorresp( const Mat& K, const Mat& K_inv, const Mat& Rt,
float d1 = depth1.at<float>(v1,u1);
if( !cvIsNaN(d1) && texturedMask1.at<uchar>(v1,u1) )
{
float transformed_d1 = d1 * (KRK_inv_ptr[6] * u1 + KRK_inv_ptr[7] * v1 + KRK_inv_ptr[8]) + Kt_ptr[2];
float transformed_d1 = (float)(d1 * (KRK_inv_ptr[6] * u1 + KRK_inv_ptr[7] * v1 + KRK_inv_ptr[8]) + Kt_ptr[2]);
int u0 = cvRound((d1 * (KRK_inv_ptr[0] * u1 + KRK_inv_ptr[1] * v1 + KRK_inv_ptr[2]) + Kt_ptr[0]) / transformed_d1);
int v0 = cvRound((d1 * (KRK_inv_ptr[3] * u1 + KRK_inv_ptr[4] * v1 + KRK_inv_ptr[5]) + Kt_ptr[1]) / transformed_d1);
@ -257,7 +257,7 @@ int computeCorresp( const Mat& K, const Mat& K_inv, const Mat& Rt,
int exist_u1, exist_v1;
get2shorts( c, exist_u1, exist_v1);
float exist_d1 = depth1.at<float>(exist_v1,exist_u1) * (KRK_inv_ptr[6] * exist_u1 + KRK_inv_ptr[7] * exist_v1 + KRK_inv_ptr[8]) + Kt_ptr[2];
float exist_d1 = (float)(depth1.at<float>(exist_v1,exist_u1) * (KRK_inv_ptr[6] * exist_u1 + KRK_inv_ptr[7] * exist_v1 + KRK_inv_ptr[8]) + Kt_ptr[2]);
if( transformed_d1 > exist_d1 )
continue;
@ -307,7 +307,7 @@ void buildPyramids( const Mat& image0, const Mat& image1,
vector<Mat>& pyramid_dI_dx1, vector<Mat>& pyramid_dI_dy1,
vector<Mat>& pyramidTexturedMask1, vector<Mat>& pyramidCameraMatrix )
{
const int pyramidMaxLevel = minGradMagnitudes.size() - 1;
const int pyramidMaxLevel = (int)minGradMagnitudes.size() - 1;
buildPyramid( image0, pyramidImage0, pyramidMaxLevel );
buildPyramid( image1, pyramidImage1, pyramidMaxLevel );
@ -330,12 +330,12 @@ void buildPyramids( const Mat& image0, const Mat& image1,
const Mat& dy = pyramid_dI_dy1[i];
Mat texturedMask( dx.size(), CV_8UC1, Scalar(0) );
const float minScalesGradMagnitude2 = (minGradMagnitudes[i] * minGradMagnitudes[i]) / (sobelScale * sobelScale);
const float minScalesGradMagnitude2 = (float)((minGradMagnitudes[i] * minGradMagnitudes[i]) / (sobelScale * sobelScale));
for( int y = 0; y < dx.rows; y++ )
{
for( int x = 0; x < dx.cols; x++ )
{
float m2 = dx.at<short int>(y,x)*dx.at<short int>(y,x) + dy.at<short int>(y,x)*dy.at<short int>(y,x);
float m2 = (float)(dx.at<short>(y,x)*dx.at<short>(y,x) + dy.at<short>(y,x)*dy.at<short>(y,x));
if( m2 >= minScalesGradMagnitude2 )
texturedMask.at<uchar>(y,x) = 255;
}
@ -398,17 +398,17 @@ bool computeKsi( int transformType,
{
int Cwidth = -1;
ComputeCFuncPtr computeCFuncPtr = 0;
if( transformType == TransformationType::RIGID_BODY_MOTION )
if( transformType == RIGID_BODY_MOTION )
{
Cwidth = 6;
computeCFuncPtr = computeC_RigidBodyMotion;
}
else if( transformType == TransformationType::ROTATION )
else if( transformType == ROTATION )
{
Cwidth = 3;
computeCFuncPtr = computeC_Rotation;
}
else if( transformType == TransformationType::TRANSLATION )
else if( transformType == TRANSLATION )
{
Cwidth = 3;
computeCFuncPtr = computeC_Translation;
@ -450,15 +450,15 @@ bool computeKsi( int transformType,
ksi = Scalar(0);
Mat subksi;
if( transformType == TransformationType::RIGID_BODY_MOTION )
if( transformType == RIGID_BODY_MOTION )
{
subksi = ksi;
}
else if( transformType == TransformationType::ROTATION )
else if( transformType == ROTATION )
{
subksi = ksi.rowRange(0,3);
}
else if( transformType == TransformationType::TRANSLATION )
else if( transformType == TRANSLATION )
{
subksi = ksi.rowRange(3,6);
}
@ -514,7 +514,7 @@ bool cv::RGBDOdometry( cv::Mat& Rt, const Mat& initRt,
Mat resultRt = initRt.empty() ? Mat::eye(4,4,CV_64FC1) : initRt.clone();
Mat currRt, ksi;
for( int level = iterCounts.size() - 1; level >= 0; level-- )
for( int level = (int)iterCounts.size() - 1; level >= 0; level-- )
{
const Mat& levelCameraMatrix = pyramidCameraMatrix[level];

@ -940,11 +940,11 @@ CVAPI(void*) cvMemStorageAlloc( CvMemStorage* storage, size_t size );
/* Allocates string in memory storage */
CVAPI(CvString) cvMemStorageAllocString( CvMemStorage* storage, const char* ptr,
int len CV_DEFAULT(-1) );
int len CV_DEFAULT(-1) );
/* Creates new empty sequence that will reside in the specified storage */
CVAPI(CvSeq*) cvCreateSeq( int seq_flags, int header_size,
int elem_size, CvMemStorage* storage );
CVAPI(CvSeq*) cvCreateSeq( int seq_flags, size_t header_size,
size_t elem_size, CvMemStorage* storage );
/* Changes default size (granularity) of sequence blocks.
The default size is ~1Kbyte */

@ -862,9 +862,9 @@ template<typename _Tp> struct CV_EXPORTS Matx_FastSolveOp<_Tp, 2, 1>
template<typename _Tp> struct CV_EXPORTS Matx_FastSolveOp<_Tp, 3, 1>
{
bool operator()(const Matx<_Tp, 3, 3>& a, const Matx<_Tp, 3, 1>& b,
Matx<_Tp, 3, 1>& x, int method) const
Matx<_Tp, 3, 1>& x, int) const
{
_Tp d = determinant(a);
_Tp d = (_Tp)determinant(a);
if( d == 0 )
return false;
d = 1/d;
@ -955,7 +955,7 @@ _AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
{
_AccTp s = 0;
int i= 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; i <= n - 4; i += 4 )
{
_AccTp v0 = a[i] - b[i], v1 = a[i+1] - b[i+1], v2 = a[i+2] - b[i+2], v3 = a[i+3] - b[i+3];
@ -964,7 +964,7 @@ _AccTp normL2Sqr(const _Tp* a, const _Tp* b, int n)
#endif
for( ; i < n; i++ )
{
_AccTp v = a[i] - b[i];
_AccTp v = (_AccTp)(a[i] - b[i]);
s += v*v;
}
return s;
@ -995,7 +995,7 @@ _AccTp normL1(const _Tp* a, const _Tp* b, int n)
{
_AccTp s = 0;
int i= 0;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for(; i <= n - 4; i += 4 )
{
_AccTp v0 = a[i] - b[i], v1 = a[i+1] - b[i+1], v2 = a[i+2] - b[i+2], v3 = a[i+3] - b[i+3];
@ -1004,7 +1004,7 @@ _AccTp normL1(const _Tp* a, const _Tp* b, int n)
#endif
for( ; i < n; i++ )
{
_AccTp v = a[i] - b[i];
_AccTp v = (_AccTp)(a[i] - b[i]);
s += std::abs(v);
}
return s;

@ -10,7 +10,7 @@ typedef perf::TestBaseWithParam<size_t> VectorLength;
PERF_TEST_P(VectorLength, phase32f, testing::Values(128, 1000, 128*1024, 512*1024, 1024*1024))
{
int length = GetParam();
size_t length = GetParam();
vector<float> X(length);
vector<float> Y(length);
vector<float> angle(length);

@ -2073,8 +2073,8 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste
int x =0;
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi8 (0xff);
__m128i c128 = _mm_set1_epi8 (128);
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi8 (-1);
__m128i c128 = _mm_set1_epi8 (-128);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
@ -2103,7 +2103,7 @@ static void cmp8u(const uchar* src1, size_t step1, const uchar* src2, size_t ste
int x = 0;
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi8 (0xff);
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi8 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
@ -2154,7 +2154,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
int x =0;
#if CV_SSE2
if( USE_SSE2){//
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi16 (0xffff);
__m128i m128 = code == CMP_GT ? _mm_setzero_si128() : _mm_set1_epi16 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));
@ -2192,7 +2192,7 @@ static void cmp16s(const short* src1, size_t step1, const short* src2, size_t st
int x = 0;
#if CV_SSE2
if( USE_SSE2 ){
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi16 (0xffff);
__m128i m128 = code == CMP_EQ ? _mm_setzero_si128() : _mm_set1_epi16 (-1);
for( ; x <= size.width - 16; x += 16 )
{
__m128i r00 = _mm_loadu_si128((const __m128i*)(src1 + x));

@ -294,15 +294,15 @@ template<typename _Tp>
for(;;)
{
bool tr = ((int)buf.length() > col_d-2) ? true: false;
int pos;
std::string::size_type pos = 0;
if (tr)
{
pos = buf.find_first_of(' ');
for(;;)
{
if ((int)buf.find_first_of(' ', pos + 1 ) < col_d-2 &&
(int)buf.find_first_of(' ', pos + 1 ) != (int)std::string::npos)
if (buf.find_first_of(' ', pos + 1 ) < (std::string::size_type)(col_d-2) &&
buf.find_first_of(' ', pos + 1 ) != std::string::npos)
pos = buf.find_first_of(' ', pos + 1);
else
break;

@ -362,35 +362,35 @@ cvMemStorageAllocString( CvMemStorage* storage, const char* ptr, int len )
/* Create empty sequence: */
CV_IMPL CvSeq *
cvCreateSeq( int seq_flags, int header_size, int elem_size, CvMemStorage * storage )
cvCreateSeq( int seq_flags, size_t header_size, size_t elem_size, CvMemStorage* storage )
{
CvSeq *seq = 0;
if( !storage )
CV_Error( CV_StsNullPtr, "" );
if( header_size < (int)sizeof( CvSeq ) || elem_size <= 0 )
if( header_size < sizeof( CvSeq ) || elem_size <= 0 )
CV_Error( CV_StsBadSize, "" );
/* allocate sequence header */
seq = (CvSeq*)cvMemStorageAlloc( storage, header_size );
memset( seq, 0, header_size );
seq->header_size = header_size;
seq->header_size = (int)header_size;
seq->flags = (seq_flags & ~CV_MAGIC_MASK) | CV_SEQ_MAGIC_VAL;
{
int elemtype = CV_MAT_TYPE(seq_flags);
int typesize = CV_ELEM_SIZE(elemtype);
if( elemtype != CV_SEQ_ELTYPE_GENERIC && elemtype != CV_USRTYPE1 &&
typesize != 0 && typesize != elem_size )
typesize != 0 && typesize != (int)elem_size )
CV_Error( CV_StsBadSize,
"Specified element size doesn't match to the size of the specified element type "
"(try to use 0 for element type)" );
}
seq->elem_size = elem_size;
seq->elem_size = (int)elem_size;
seq->storage = storage;
cvSetSeqBlockSize( seq, (1 << 10)/elem_size );
cvSetSeqBlockSize( seq, (int)((1 << 10)/elem_size) );
return seq;
}

@ -853,6 +853,7 @@ icvProcessSpecialDouble( CvFileStorage* fs, char* buf, double* value, char** end
CV_PARSE_ERROR( "Bad format of floating-point constant" );
union{double d; uint64 i;} v;
v.d = 0.;
if( toupper(buf[1]) == 'I' && toupper(buf[2]) == 'N' && toupper(buf[3]) == 'F' )
v.i = (uint64)inf_hi << 32;
else if( toupper(buf[1]) == 'N' && toupper(buf[2]) == 'A' && toupper(buf[3]) == 'N' )

@ -112,7 +112,7 @@ void CV_CountNonZeroTest::generate_src_data(cv::Size size, int type, int count_n
while (n < count_non_zero)
{
size_t i = rng.next()%size.height, j = rng.next()%size.width;
int i = rng.next()%size.height, j = rng.next()%size.width;
switch (type)
{
@ -151,20 +151,15 @@ int CV_CountNonZeroTest::get_count_non_zero()
for (int i = 0; i < src.rows; ++i)
for (int j = 0; j < src.cols; ++j)
{
if (current_type == CV_8U) result += (src.at<uchar>(i, j) > 0);
else if (current_type == CV_8S) result += abs(sign(src.at<char>(i, j)));
else if (current_type == CV_16U) result += (src.at<ushort>(i, j) > 0);
else if (current_type == CV_16S) result += abs(sign(src.at<short>(i, j)));
else if (current_type == CV_32S) result += abs(sign(src.at<int>(i, j)));
else if (current_type == CV_32F) result += (fabs(src.at<float>(i, j)) > eps_32);
else result += (fabs(src.at<double>(i, j)) > eps_64);
else if (current_type == CV_8S) result += abs(sign(src.at<char>(i, j)));
else if (current_type == CV_16U) result += (src.at<ushort>(i, j) > 0);
else if (current_type == CV_16S) result += abs(sign(src.at<short>(i, j)));
else if (current_type == CV_32S) result += abs(sign(src.at<int>(i, j)));
else if (current_type == CV_32F) result += (fabs(src.at<float>(i, j)) > eps_32);
else result += (fabs(src.at<double>(i, j)) > eps_64);
}
return result;
}

@ -61,8 +61,8 @@ using namespace std;
#define MESSAGE_ERROR_ORTHO "Matrix of eigen vectors is not orthogonal."
#define MESSAGE_ERROR_ORDER "Eigen values are not sorted in ascending order."
const size_t COUNT_NORM_TYPES = 3;
const size_t NORM_TYPE[COUNT_NORM_TYPES] = {cv::NORM_L1, cv::NORM_L2, cv::NORM_INF};
const int COUNT_NORM_TYPES = 3;
const int NORM_TYPE[COUNT_NORM_TYPES] = {cv::NORM_L1, cv::NORM_L2, cv::NORM_INF};
enum TASK_TYPE_EIGEN {VALUES, VECTORS};
@ -232,7 +232,7 @@ bool Core_EigenTest::check_orthogonality(const cv::Mat& U)
cv::Mat E = Mat::eye(U.rows, U.cols, type);
for (size_t i = 0; i < COUNT_NORM_TYPES; ++i)
for (int i = 0; i < COUNT_NORM_TYPES; ++i)
{
double diff = cv::norm(UUt, E, NORM_TYPE[i]);
if (diff > eps_vec)
@ -253,7 +253,7 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values)
{
case CV_32FC1:
{
for (size_t i = 0; i < eigen_values.total() - 1; ++i)
for (int i = 0; i < (int)(eigen_values.total() - 1); ++i)
if (!(eigen_values.at<float>(i, 0) > eigen_values.at<float>(i+1, 0)))
{
std::cout << endl; std::cout << "Checking order of eigen values vector " << eigen_values << "..." << endl;
@ -268,7 +268,7 @@ bool Core_EigenTest::check_pairs_order(const cv::Mat& eigen_values)
case CV_64FC1:
{
for (size_t i = 0; i < eigen_values.total() - 1; ++i)
for (int i = 0; i < (int)(eigen_values.total() - 1); ++i)
if (!(eigen_values.at<double>(i, 0) > eigen_values.at<double>(i+1, 0)))
{
std::cout << endl; std::cout << "Checking order of eigen values vector " << eigen_values << "..." << endl;
@ -338,7 +338,7 @@ bool Core_EigenTest::test_pairs(const cv::Mat& src)
cv::Mat disparity = src_evec - eval_evec;
for (size_t i = 0; i < COUNT_NORM_TYPES; ++i)
for (int i = 0; i < COUNT_NORM_TYPES; ++i)
{
double diff = cv::norm(disparity, NORM_TYPE[i]);
if (diff > eps_vec)
@ -367,7 +367,7 @@ bool Core_EigenTest::test_values(const cv::Mat& src)
if (!check_pair_count(src, eigen_values_2)) return false;
for (size_t i = 0; i < COUNT_NORM_TYPES; ++i)
for (int i = 0; i < COUNT_NORM_TYPES; ++i)
{
double diff = cv::norm(eigen_values_1, eigen_values_2, NORM_TYPE[i]);
if (diff > eps_val)
@ -391,7 +391,7 @@ bool Core_EigenTest::check_full(int type)
for (int i = 1; i <= MATRIX_COUNT; ++i)
{
size_t src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE+1)*1.0));
int src_size = (int)(std::pow(2.0, (rand()%MAX_DEGREE+1)*1.0));
cv::Mat src(src_size, src_size, type);

@ -191,7 +191,7 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
Mat img = _img.getMat();
const int K = 8, N = 16 + K + 1;
int i, j, k, pixel[N];
makeOffsets(pixel, img.step);
makeOffsets(pixel, (int)img.step);
for(k = 16; k < N; k++)
pixel[k] = pixel[k - 16];
@ -200,7 +200,7 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
threshold = std::min(std::max(threshold, 0), 255);
#if CV_SSE2
__m128i delta = _mm_set1_epi8(128), t = _mm_set1_epi8(threshold), K16 = _mm_set1_epi8(K);
__m128i delta = _mm_set1_epi8(-128), t = _mm_set1_epi8((char)threshold), K16 = _mm_set1_epi8((char)K);
#endif
uchar threshold_tab[512];
for( i = -255; i <= 255; i++ )
@ -279,7 +279,7 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
{
cornerpos[ncorners++] = j+k;
if(nonmax_suppression)
curr[j+k] = cornerScore(ptr+k, pixel, threshold);
curr[j+k] = (uchar)cornerScore(ptr+k, pixel, threshold);
}
}
#endif
@ -317,7 +317,7 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
{
cornerpos[ncorners++] = j;
if(nonmax_suppression)
curr[j] = cornerScore(ptr, pixel, threshold);
curr[j] = (uchar)cornerScore(ptr, pixel, threshold);
break;
}
}
@ -339,7 +339,7 @@ void FAST(InputArray _img, std::vector<KeyPoint>& keypoints, int threshold, bool
{
cornerpos[ncorners++] = j;
if(nonmax_suppression)
curr[j] = cornerScore(ptr, pixel, threshold);
curr[j] = (uchar)cornerScore(ptr, pixel, threshold);
break;
}
}

@ -536,7 +536,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
FileNode ip = fn["indexParams"];
CV_Assert(ip.type() == FileNode::SEQ);
for(size_t i = 0; i < ip.size(); ++i)
for(int i = 0; i < (int)ip.size(); ++i)
{
CV_Assert(ip[i].type() == FileNode::MAP);
std::string name = (std::string)ip[i]["name"];
@ -561,7 +561,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
indexParams->setString(name, (std::string) ip[i]["value"]);
break;
case CV_MAKETYPE(CV_USRTYPE1,2):
indexParams->setBool(name, (int) ip[i]["value"]);
indexParams->setBool(name, (int) ip[i]["value"] != 0);
break;
case CV_MAKETYPE(CV_USRTYPE1,3):
indexParams->setAlgorithm((int) ip[i]["value"]);
@ -575,7 +575,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
FileNode sp = fn["searchParams"];
CV_Assert(sp.type() == FileNode::SEQ);
for(size_t i = 0; i < sp.size(); ++i)
for(int i = 0; i < (int)sp.size(); ++i)
{
CV_Assert(sp[i].type() == FileNode::MAP);
std::string name = (std::string)sp[i]["name"];
@ -600,7 +600,7 @@ void FlannBasedMatcher::read( const FileNode& fn)
searchParams->setString(name, (std::string) ip[i]["value"]);
break;
case CV_MAKETYPE(CV_USRTYPE1,2):
searchParams->setBool(name, (int) ip[i]["value"]);
searchParams->setBool(name, (int) ip[i]["value"] != 0);
break;
case CV_MAKETYPE(CV_USRTYPE1,3):
searchParams->setAlgorithm((int) ip[i]["value"]);

@ -191,8 +191,8 @@ inline void _bitreset(unsigned long * a, unsigned long b)
struct MSERParams
{
MSERParams( int _delta, int _minArea, int _maxArea, float _maxVariation,
float _minDiversity, int _maxEvolution, double _areaThreshold,
MSERParams( int _delta, int _minArea, int _maxArea, double _maxVariation,
double _minDiversity, int _maxEvolution, double _areaThreshold,
double _minMargin, int _edgeBlurSize )
: delta(_delta), minArea(_minArea), maxArea(_maxArea), maxVariation(_maxVariation),
minDiversity(_minDiversity), maxEvolution(_maxEvolution), areaThreshold(_areaThreshold),
@ -201,8 +201,8 @@ struct MSERParams
int delta;
int minArea;
int maxArea;
float maxVariation;
float minDiversity;
double maxVariation;
double minDiversity;
int maxEvolution;
double areaThreshold;
double minMargin;

@ -785,7 +785,7 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
vector<Mat> imagePyramid(nlevels), maskPyramid(nlevels);
for (int level = 0; level < nlevels; ++level)
{
float scale = 1/getScale(level, firstLevel, scale);
float scale = 1/getScale(level, firstLevel, scaleFactor);
Size sz(cvRound(image.cols*scale), cvRound(image.rows*scale));
Size wholeSize(sz.width + border*2, sz.height + border*2);
Mat temp(wholeSize, image.type()), masktemp;
@ -810,10 +810,11 @@ void ORB::operator()( InputArray _image, InputArray _mask, vector<KeyPoint>& _ke
}
else
{
float sf = scaleFactor;
resize(imagePyramid[level-1], imagePyramid[level], sz, 1./sf, 1./sf, INTER_LINEAR);
resize(imagePyramid[level-1], imagePyramid[level], sz,
1./scaleFactor, 1./scaleFactor, INTER_LINEAR);
if (!mask.empty())
resize(maskPyramid[level-1], maskPyramid[level], sz, 1./sf, 1./sf, INTER_LINEAR);
resize(maskPyramid[level-1], maskPyramid[level], sz,
1./scaleFactor, 1./scaleFactor, INTER_LINEAR);
copyMakeBorder(imagePyramid[level], temp, border, border, border, border,
BORDER_REFLECT_101+BORDER_ISOLATED);
}

@ -57,7 +57,7 @@ computeIntegralImages( const Mat& matI, Mat& matS, Mat& matT, Mat& _FT )
const uchar* I = matI.ptr<uchar>();
int *S = matS.ptr<int>(), *T = matT.ptr<int>(), *FT = _FT.ptr<int>();
int istep = matI.step, step = matS.step/sizeof(S[0]);
int istep = (int)matI.step, step = (int)(matS.step/sizeof(S[0]));
for( x = 0; x <= cols; x++ )
S[x] = T[x] = FT[x] = 0;

@ -57,12 +57,12 @@ void find_nearest(const Matrix<typename Distance::ElementType>& dataset, typenam
DistanceType tmp = distance(dataset[i], query, dataset.cols);
if (dcnt<n) {
match[dcnt] = i;
match[dcnt] = (int)i;
dists[dcnt++] = tmp;
}
else if (tmp < dists[dcnt-1]) {
dists[dcnt-1] = tmp;
match[dcnt-1] = i;
match[dcnt-1] = (int)i;
}
int j = dcnt-1;

@ -352,10 +352,10 @@ public:
for (int i=0; i<trees_; ++i) {
indices[i] = new int[size_];
for (size_t j=0; j<size_; ++j) {
indices[i][j] = j;
indices[i][j] = (int)j;
}
root[i] = pool.allocate<Node>();
computeClustering(root[i], indices[i], size_, branching_,0);
computeClustering(root[i], indices[i], (int)size_, branching_,0);
}
}
@ -419,7 +419,7 @@ public:
int maxChecks = get_param(searchParams,"checks",32);
// Priority queue storing intermediate branches in the best-bin-first search
Heap<BranchSt>* heap = new Heap<BranchSt>(size_);
Heap<BranchSt>* heap = new Heap<BranchSt>((int)size_);
std::vector<bool> checked(size_,false);
int checks = 0;
@ -487,7 +487,7 @@ private:
{
save_value(stream, *node);
if (node->childs==NULL) {
int indices_offset = node->indices - indices[num];
int indices_offset = (int)(node->indices - indices[num]);
save_value(stream, indices_offset);
}
else {

@ -116,7 +116,7 @@ float search_with_ground_truth(NNIndex<Distance>& index, const Matrix<typename D
index.findNeighbors(resultSet, testData[i], searchParams);
correct += countCorrectMatches(neighbors,matches[i], nn);
distR += computeDistanceRaport<Distance>(inputData, testData[i], neighbors, matches[i], testData.cols, nn, distance);
distR += computeDistanceRaport<Distance>(inputData, testData[i], neighbors, matches[i], (int)testData.cols, nn, distance);
}
t.stop();
}

@ -95,7 +95,7 @@ public:
// Create a permutable array of indices to the input vectors.
vind_.resize(size_);
for (size_t i = 0; i < size_; i++) {
vind_[i] = i;
vind_[i] = (int)i;
}
}
@ -116,7 +116,7 @@ public:
void buildIndex()
{
computeBoundingBox(root_bbox_);
root_node_ = divideTree(0, size_, root_bbox_ ); // construct the tree
root_node_ = divideTree(0, (int)size_, root_bbox_ ); // construct the tree
if (reorder_) {
delete[] data_.data;
@ -197,7 +197,7 @@ public:
*/
int usedMemory() const
{
return pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int); // pool memory and vind array memory
return (int)(pool_.usedMemory+pool_.wastedMemory+dataset_.rows*sizeof(int)); // pool memory and vind array memory
}
@ -461,7 +461,7 @@ private:
computeMinMax(ind, count, cutfeat, min_elem, max_elem);
DistanceType spread = (DistanceType)(max_elem-min_elem);
if (spread>max_spread) {
cutfeat = i;
cutfeat = (int)i;
max_spread = spread;
}
}
@ -524,11 +524,11 @@ private:
for (size_t i = 0; i < dim_; ++i) {
if (vec[i] < root_bbox_[i].low) {
dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].low, i);
dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].low, (int)i);
distsq += dists[i];
}
if (vec[i] > root_bbox_[i].high) {
dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].high, i);
dists[i] = distance_.accum_dist(vec[i], root_bbox_[i].high, (int)i);
distsq += dists[i];
}
}

@ -775,7 +775,7 @@ private:
for (int i=0; i<branching; ++i) {
centers[i] = new DistanceType[veclen_];
memoryCounter_ += veclen_*sizeof(DistanceType);
memoryCounter_ += (int)(veclen_*sizeof(DistanceType));
for (size_t k=0; k<veclen_; ++k) {
centers[i][k] = (DistanceType)dcenters[i][k];
}

@ -108,7 +108,7 @@ public:
ElementType* data = dataset_.data;
for (size_t i = 0; i < dataset_.rows; ++i, data += dataset_.cols) {
DistanceType dist = distance_(data, vec, dataset_.cols);
resultSet.addPoint(dist, i);
resultSet.addPoint(dist, (int)i);
}
}

@ -94,7 +94,7 @@ public:
key_size_ = get_param<int>(index_params_,"key_size",20);
multi_probe_level_ = get_param<int>(index_params_,"multi_probe_level",2);
feature_size_ = dataset_.cols;
feature_size_ = (unsigned)dataset_.cols;
fill_xor_mask(0, key_size_, multi_probe_level_, xor_masks_);
}
@ -168,7 +168,7 @@ public:
*/
int usedMemory() const
{
return dataset_.rows * sizeof(int);
return (int)(dataset_.rows * sizeof(int));
}
@ -344,7 +344,7 @@ private:
std::vector<lsh::BucketKey>::const_iterator xor_mask_end = xor_masks_.end();
for (; xor_mask != xor_mask_end; ++xor_mask) {
size_t sub_key = key ^ (*xor_mask);
const lsh::Bucket* bucket = table->getBucketFromKey(sub_key);
const lsh::Bucket* bucket = table->getBucketFromKey((lsh::BucketKey)sub_key);
if (bucket == 0) continue;
// Go over each descriptor index
@ -355,7 +355,7 @@ private:
// Process the rest of the candidates
for (; training_index < last_training_index; ++training_index) {
// Compute the Hamming distance
hamming_distance = distance_(vec, dataset_[*training_index], dataset_.cols);
hamming_distance = distance_(vec, dataset_[*training_index], (int)dataset_.cols);
result.addPoint(hamming_distance, *training_index);
}
}

@ -151,7 +151,7 @@ public:
LshTable(unsigned int /*feature_size*/, unsigned int /*key_size*/)
{
std::cerr << "LSH is not implemented for that type" << std::endl;
throw;
assert(0);
}
/** Add a feature to the table
@ -161,7 +161,7 @@ public:
void add(unsigned int value, const ElementType* feature)
{
// Add the value to the corresponding bucket
BucketKey key = getKey(feature);
BucketKey key = (lsh::BucketKey)getKey(feature);
switch (speed_level_) {
case kArray:
@ -232,7 +232,7 @@ public:
size_t getKey(const ElementType* /*feature*/) const
{
std::cerr << "LSH is not implemented for that type" << std::endl;
throw;
assert(0);
return 1;
}
@ -414,7 +414,7 @@ inline LshStats LshTable<unsigned char>::getStats() const
if (!buckets_speed_.empty()) {
for (BucketsSpeed::const_iterator pbucket = buckets_speed_.begin(); pbucket != buckets_speed_.end(); ++pbucket) {
stats.bucket_sizes_.push_back(pbucket->size());
stats.bucket_sizes_.push_back((lsh::FeatureIndex)pbucket->size());
stats.bucket_size_mean_ += pbucket->size();
}
stats.bucket_size_mean_ /= buckets_speed_.size();
@ -422,7 +422,7 @@ inline LshStats LshTable<unsigned char>::getStats() const
}
else {
for (BucketsSpace::const_iterator x = buckets_space_.begin(); x != buckets_space_.end(); ++x) {
stats.bucket_sizes_.push_back(x->second.size());
stats.bucket_sizes_.push_back((lsh::FeatureIndex)x->second.size());
stats.bucket_size_mean_ += x->second.size();
}
stats.bucket_size_mean_ /= buckets_space_.size();

@ -114,7 +114,7 @@ public:
int* indices_ptr = NULL;
DistanceType* dists_ptr = NULL;
if (indices.cols > 0) {
n = indices.cols;
n = (int)indices.cols;
indices_ptr = indices[0];
dists_ptr = dists[0];
}
@ -127,7 +127,7 @@ public:
else resultSet.copy(indices_ptr, dists_ptr, n);
}
return resultSet.size();
return (int)resultSet.size();
}
/**

@ -43,7 +43,7 @@ Matrix<T> random_sample(Matrix<T>& srcMatrix, long size, bool remove = false)
T* src,* dest;
for (long i=0; i<size; ++i) {
long r = rand_int(srcMatrix.rows-i);
long r = rand_int((int)(srcMatrix.rows-i));
dest = newSet[i];
src = srcMatrix[r];
std::copy(src, src+srcMatrix.cols, dest);
@ -62,7 +62,7 @@ Matrix<T> random_sample(Matrix<T>& srcMatrix, long size, bool remove = false)
template<typename T>
Matrix<T> random_sample(const Matrix<T>& srcMatrix, size_t size)
{
UniqueRandom rand(srcMatrix.rows);
UniqueRandom rand((int)srcMatrix.rows);
Matrix<T> newSet(new T[size * srcMatrix.cols], size,srcMatrix.cols);
T* src,* dest;

@ -27,6 +27,10 @@
*************************************************************************/
#include "precomp.hpp"
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#include "opencv2/flann/flann.hpp"
namespace cvflann

@ -5,6 +5,10 @@
#include <cstdarg>
#include <sstream>
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
#ifdef HAVE_CVCONFIG_H
# include "cvconfig.h"
#endif

@ -47,6 +47,7 @@
#if defined _M_X64 && defined _MSC_VER && !defined CV_ICC
#pragma optimize("",off)
#pragma warning( disable: 4748 )
#endif
namespace cv

@ -54,6 +54,7 @@
#if defined _M_X64
#pragma optimize("",off)
#pragma warning(disable: 4748)
#endif
/********************* Capturing video from AVI via VFW ************************/

@ -44,6 +44,10 @@
#ifdef HAVE_JPEG
#ifdef _MSC_VER
#pragma warning(disable: 4324 4611)
#endif
#include <stdio.h>
#include <setjmp.h>

@ -148,7 +148,7 @@ void CV_VideoPositioningTest::run_test(int method)
generate_idx_seq(cap, method);
int N = idx.size(), failed_frames = 0, failed_positions = 0, failed_iterations = 0;
int N = (int)idx.size(), failed_frames = 0, failed_positions = 0, failed_iterations = 0;
for (int j = 0; j < N; ++j)
{

@ -32,7 +32,7 @@ PERF_TEST_P( TestFilter2d, Filter2d,
Mat kernel(kSize, kSize, CV_32FC1);
randu(kernel, -3, 10);
float s = fabs( sum(kernel)[0] );
double s = fabs( sum(kernel)[0] );
if(s > 1e-3) kernel /= s;
declare.in(src, WARMUP_RNG).out(dst).time(20);

@ -3216,36 +3216,37 @@ void cv::cvtColor( InputArray _src, OutputArray _dst, int code, int dcn )
const uchar* y = src.ptr();
const uchar* uv = y + dstSz.area();
int srcstep = (int)src.step;
// http://www.fourcc.org/yuv.php#NV21 == yuv420sp -> a plane of 8 bit Y samples followed by an interleaved V/U plane containing 8 bit 2x2 subsampled chroma samples
// http://www.fourcc.org/yuv.php#NV12 == yvu420sp -> a plane of 8 bit Y samples followed by an interleaved U/V plane containing 8 bit 2x2 subsampled colour difference samples
if (CV_YUV420sp2RGB == code || COLOR_YUV420sp2RGBA == code)
{
if (dcn == 3)
cvtYUV4202RGB<2, 1>(dst, src.step, y, uv);
cvtYUV4202RGB<2, 1>(dst, srcstep, y, uv);
else
cvtYUV4202RGBA<2, 1>(dst, src.step, y, uv);
cvtYUV4202RGBA<2, 1>(dst, srcstep, y, uv);
}
else if (CV_YUV420sp2BGR == code || CV_YUV420sp2BGRA == code)
{
if (dcn == 3)
cvtYUV4202RGB<0, 1>(dst, src.step, y, uv);
cvtYUV4202RGB<0, 1>(dst, srcstep, y, uv);
else
cvtYUV4202RGBA<0, 1>(dst, src.step, y, uv);
cvtYUV4202RGBA<0, 1>(dst, srcstep, y, uv);
}
else if (CV_YUV2RGB_NV12 == code || CV_YUV2RGBA_NV12 == code)
{
if (dcn == 3)
cvtYUV4202RGB<2, 0>(dst, src.step, y, uv);
cvtYUV4202RGB<2, 0>(dst, srcstep, y, uv);
else
cvtYUV4202RGBA<2, 0>(dst, src.step, y, uv);
cvtYUV4202RGBA<2, 0>(dst, srcstep, y, uv);
}
else //if (CV_YUV2BGR_NV12 == code || CV_YUV2BGRA_NV12 == code)
{
if (dcn == 3)
cvtYUV4202RGB<0, 0>(dst, src.step, y, uv);
cvtYUV4202RGB<0, 0>(dst, srcstep, y, uv);
else
cvtYUV4202RGBA<0, 0>(dst, src.step, y, uv);
cvtYUV4202RGBA<0, 0>(dst, srcstep, y, uv);
}
}
break;

@ -60,12 +60,12 @@ cv::Mat cv::getGaborKernel( Size ksize, double sigma, double theta,
if( ksize.width > 0 )
xmax = ksize.width/2;
else
xmax = std::max(fabs(nstds*sigma_x*c), fabs(nstds*sigma_y*s));
xmax = cvRound(std::max(fabs(nstds*sigma_x*c), fabs(nstds*sigma_y*s)));
if( ksize.height > 0 )
ymax = ksize.height/2;
else
ymax = std::max(fabs(nstds*sigma_x*s), fabs(nstds*sigma_y*c));
ymax = cvRound(std::max(fabs(nstds*sigma_x*s), fabs(nstds*sigma_y*c)));
xmin = -xmax;
ymin = -ymax;

@ -439,8 +439,8 @@ static char segSegInt( Point2f a, Point2f b, Point2f c, Point2f d, Point2f& p, P
(0.0 > t) || (t > 1.0) )
code = '0';
p.x = a.x + s * ( b.x - a.x );
p.y = a.y + s * ( b.y - a.y );
p.x = (float)(a.x + s*(b.x - a.x));
p.y = (float)(a.y + s*(b.y - a.y));
return code;
}
@ -652,7 +652,7 @@ float cv::intersectConvexConvex( InputArray _p1, InputArray _p2, OutputArray _p1
_p12.release();
return 0.f;
}
area = contourArea(_InputArray(result, nr), false);
area = (float)contourArea(_InputArray(result, nr), false);
}
if( _p12.needed() )

@ -1079,9 +1079,9 @@ public:
int row0 = min(cvRound(range.begin() * src.rows / nStripes), src.rows);
int row1 = min(cvRound(range.end() * src.rows / nStripes), src.rows);
if(0)
/*if(0)
printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n",
src.rows, src.cols, range.begin(), range.end(), row0, row1);
src.rows, src.cols, range.begin(), range.end(), row0, row1);*/
Mat srcStripe = src.rowRange(row0, row1);
Mat dstStripe = dst.rowRange(row0, row1);
@ -1105,7 +1105,7 @@ private:
Point anchor;
int rowBorderType;
int columnBorderType;
const Scalar& borderValue;
Scalar borderValue;
};
static void morphOp( int op, InputArray _src, OutputArray _dst,

@ -571,33 +571,30 @@ void cv::createHanningWindow(OutputArray _dst, cv::Size winSize, int type)
int rows = dst.rows;
int cols = dst.cols;
int step = dst.step/dst.elemSize1();
if(dst.depth() == CV_32F)
{
float* dstData = dst.ptr<float>();
for(int i = 0; i < rows; i++)
{
float* dstData = dst.ptr<float>(i);
double wr = 0.5 * (1.0f - cos(2.0f * CV_PI * (double)i / (double)(rows - 1)));
for(int j = 0; j < cols; j++)
{
double wc = 0.5 * (1.0f - cos(2.0f * CV_PI * (double)j / (double)(cols - 1)));
dstData[i*step + j] = (float)(wr * wc);
dstData[j] = (float)(wr * wc);
}
}
}
else
{
double* dstData = dst.ptr<double>();
for(int i = 0; i < rows; i++)
{
double* dstData = dst.ptr<double>(i);
double wr = 0.5 * (1.0 - cos(2.0 * CV_PI * (double)i / (double)(rows - 1)));
for(int j = 0; j < cols; j++)
{
double wc = 0.5 * (1.0 - cos(2.0 * CV_PI * (double)j / (double)(cols - 1)));
dstData[i*step + j] = wr * wc;
dstData[j] = wr * wc;
}
}
}

@ -687,9 +687,9 @@ public:
int row0 = std::min(cvRound(range.begin() * src.rows / nStripes), src.rows);
int row1 = std::min(cvRound(range.end() * src.rows / nStripes), src.rows);
if(0)
/*if(0)
printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n",
src.rows, src.cols, range.begin(), range.end(), row0, row1);
src.rows, src.cols, range.begin(), range.end(), row0, row1);*/
Mat srcStripe = src.rowRange(row0, row1);
Mat dstStripe = dst.rowRange(row0, row1);

@ -77,7 +77,7 @@ template <typename T> void CV_BoundingRectTest::generate_src_points(vector <Poin
template <typename T> cv::Rect CV_BoundingRectTest::get_bounding_rect(const vector <Point_<T> > src)
{
int n = src.size();
int n = (int)src.size();
T min_w = std::numeric_limits<T>::max(), max_w = std::numeric_limits<T>::min();
T min_h = min_w, max_h = max_w;

@ -2717,7 +2717,7 @@ void CalonderDescriptorExtractor<T>::computeImpl( const Mat& image,
KeyPointsFilter::runByImageBorder(keypoints, image.size(), BORDER_SIZE);
/// @todo Check 16-byte aligned
descriptors.create(keypoints.size(), classifier_.classes(), cv::DataType<T>::type);
descriptors.create((int)keypoints.size(), classifier_.classes(), cv::DataType<T>::type);
int patchSize = RandomizedTree::PATCH_SIZE;
int offset = patchSize / 2;
@ -2725,7 +2725,7 @@ void CalonderDescriptorExtractor<T>::computeImpl( const Mat& image,
{
cv::Point2f pt = keypoints[i].pt;
IplImage ipl = image( Rect((int)(pt.x - offset), (int)(pt.y - offset), patchSize, patchSize) );
classifier_.getSignature( &ipl, descriptors.ptr<T>(i));
classifier_.getSignature( &ipl, descriptors.ptr<T>((int)i));
}
}

@ -89,7 +89,7 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
*_keypoints = cvCreateSeq(0, sizeof(CvSeq), sizeof(CvSURFPoint), storage);
if( _descriptors )
*_descriptors = cvCreateSeq( 0, sizeof(CvSeq), descr.cols*descr.elemSize(), storage );
*_descriptors = cvCreateSeq(0, sizeof(CvSeq), descr.cols*descr.elemSize(), storage);
for( size_t i = 0; i < kpt.size(); i++ )
{
@ -99,7 +99,7 @@ cvExtractSURF( const CvArr* _img, const CvArr* _mask,
cvSeqPush(*_keypoints, &pt);
}
if( _descriptors )
cvSeqPush(*_descriptors, descr.ptr(i));
cvSeqPush(*_descriptors, descr.ptr((int)i));
}
}

@ -275,8 +275,8 @@ static float calcOrientationHist( const Mat& img, Point pt, int radius,
if( x <= 0 || x >= img.cols - 1 )
continue;
float dx = img.at<short>(y, x+1) - img.at<short>(y, x-1);
float dy = img.at<short>(y-1, x) - img.at<short>(y+1, x);
float dx = (float)(img.at<short>(y, x+1) - img.at<short>(y, x-1));
float dy = (float)(img.at<short>(y-1, x) - img.at<short>(y+1, x));
X[k] = dx; Y[k] = dy; W[k] = (i*i + j*j)*expf_scale;
k++;
@ -347,7 +347,7 @@ static bool adjustLocalExtrema( const vector<Mat>& dog_pyr, KeyPoint& kpt, int o
(img.at<short>(r+1, c) - img.at<short>(r-1, c))*deriv_scale,
(next.at<short>(r, c) - prev.at<short>(r, c))*deriv_scale);
float v2 = img.at<short>(r, c)*2;
float v2 = (float)img.at<short>(r, c)*2;
float dxx = (img.at<short>(r, c+1) + img.at<short>(r, c-1) - v2)*second_deriv_scale;
float dyy = (img.at<short>(r+1, c) + img.at<short>(r-1, c) - v2)*second_deriv_scale;
float dss = (next.at<short>(r, c) + prev.at<short>(r, c) - v2)*second_deriv_scale;
@ -400,7 +400,7 @@ static bool adjustLocalExtrema( const vector<Mat>& dog_pyr, KeyPoint& kpt, int o
return false;
/* principal curvatures are computed using the trace and det of Hessian */
float v2 = img.at<short>(r, c)*2;
float v2 = img.at<short>(r, c)*2.f;
float dxx = (img.at<short>(r, c+1) + img.at<short>(r, c-1) - v2)*second_deriv_scale;
float dyy = (img.at<short>(r+1, c) + img.at<short>(r-1, c) - v2)*second_deriv_scale;
float dxy = (img.at<short>(r+1, c+1) - img.at<short>(r+1, c-1) -
@ -477,8 +477,9 @@ void SIFT::findScaleSpaceExtrema( const vector<Mat>& gauss_pyr, const vector<Mat
val <= prevptr[c+step-1] && val <= prevptr[c+step] && val <= prevptr[c+step+1])))
{
int r1 = r, c1 = c, layer = i;
if( !adjustLocalExtrema(dog_pyr, kpt, o, layer, r1, c1, nOctaveLayers,
contrastThreshold, edgeThreshold, sigma) )
if( !adjustLocalExtrema(dog_pyr, kpt, o, layer, r1, c1,
nOctaveLayers, (float)contrastThreshold,
(float)edgeThreshold, (float)sigma) )
continue;
float scl_octv = kpt.size*0.5f/(1 << o);
float omax = calcOrientationHist(gauss_pyr[o*(nOctaveLayers+3) + layer],
@ -551,8 +552,8 @@ static void calcSIFTDescriptor( const Mat& img, Point2f ptf, float ori, float sc
if( rbin > -1 && rbin < d && cbin > -1 && cbin < d &&
r > 0 && r < rows - 1 && c > 0 && c < cols - 1 )
{
float dx = img.at<short>(r, c+1) - img.at<short>(r, c-1);
float dy = img.at<short>(r-1, c) - img.at<short>(r+1, c);
float dx = (float)(img.at<short>(r, c+1) - img.at<short>(r, c-1));
float dy = (float)(img.at<short>(r-1, c) - img.at<short>(r+1, c));
X[k] = dx; Y[k] = dy; RBin[k] = rbin; CBin[k] = cbin;
W[k] = (c_rot * c_rot + r_rot * r_rot)*exp_scale;
k++;
@ -648,7 +649,7 @@ static void calcDescriptors(const vector<Mat>& gpyr, const vector<KeyPoint>& key
Point2f ptf(kpt.pt.x*scale, kpt.pt.y*scale);
const Mat& img = gpyr[octv*(nOctaveLayers + 3) + layer];
calcSIFTDescriptor(img, ptf, kpt.angle, size*0.5f, d, n, descriptors.ptr<float>(i));
calcSIFTDescriptor(img, ptf, kpt.angle, size*0.5f, d, n, descriptors.ptr<float>((int)i));
}
}
@ -714,7 +715,7 @@ void SIFT::operator()(InputArray _image, InputArray _mask,
if( !mask.empty() && mask.type() != CV_8UC1 )
CV_Error( CV_StsBadArg, "mask has incorrect type (!=CV_8UC1)" );
Mat base = createInitialImage(image, false, sigma);
Mat base = createInitialImage(image, false, (float)sigma);
vector<Mat> gpyr, dogpyr;
int nOctaves = cvRound(log( (double)std::min( base.cols, base.rows ) ) / log(2.) - 2);

@ -252,7 +252,7 @@ interpolateKeypoint( float N9[3][9], int dx, int dy, int ds, KeyPoint& kpt )
{
kpt.pt.x += x(0,0)*dx;
kpt.pt.y += x(1,0)*dy;
kpt.size = cvRound( kpt.size + x(2,0)*ds );
kpt.size = (float)cvRound( kpt.size + x(2,0)*ds );
}
return ok;
}
@ -341,7 +341,8 @@ findMaximaInLayer( const Mat& sum, const Mat& mask_sum,
float center_i = sum_i + (size-1)*0.5f;
float center_j = sum_j + (size-1)*0.5f;
KeyPoint kpt( center_j, center_i, sizes[layer], -1, val0, octave, CV_SIGN(trace_ptr[j]) );
KeyPoint kpt( center_j, center_i, (float)sizes[layer],
-1, val0, octave, CV_SIGN(trace_ptr[j]) );
/* Interpolate maxima location within the 3x3x3 neighbourhood */
int ds = size - sizes[layer-1];
@ -561,8 +562,8 @@ struct SURFInvoker
{
maxSize = std::max(maxSize, (*keypoints)[k].size);
}
maxSize = cvCeil((PATCH_SZ+1)*maxSize*1.2f/9.0f);
Ptr<CvMat> winbuf = cvCreateMat( 1, maxSize > 0 ? maxSize*maxSize : 1, CV_8U );
int imaxSize = std::max(cvCeil((PATCH_SZ+1)*maxSize*1.2f/9.0f), 1);
Ptr<CvMat> winbuf = cvCreateMat( 1, imaxSize*imaxSize, CV_8U );
for( k = k1; k < k2; k++ )
{
int i, j, kk, x, y, nangle;
@ -863,7 +864,7 @@ void SURF::operator()(InputArray _img, InputArray _mask,
cv::min(mask, 1, mask1);
integral(mask1, msum, CV_32S);
}
fastHessianDetector( sum, msum, keypoints, nOctaves, nOctaveLayers, hessianThreshold );
fastHessianDetector( sum, msum, keypoints, nOctaves, nOctaveLayers, (float)hessianThreshold );
}
int i, j, N = (int)keypoints.size();

@ -297,7 +297,7 @@ void CV_DetectorsTest::run( int /*start_from*/ )
if (exp.empty())
return;
if (!testDetector(to_test, SurfNoMaskWrap(SURF(1536+512+512, 2)), exp))
if (!testDetector(to_test, SurfNoMaskWrap(SURF(1536+512+512, true, false, 2)), exp))
return;
LoadExpected(string(ts->get_data_path()) + "detectors/star.xml", exp);

@ -201,7 +201,7 @@ string extractModelName( const string& filename )
const int extentionSize = 4; //.xml
int substrLength = filename.size() - startPos - extentionSize;
int substrLength = (int)(filename.size() - startPos - extentionSize);
return filename.substr(startPos, substrLength);
}

@ -66,7 +66,7 @@ static inline int getLabel(int quantized)
case 64: return 6;
case 128: return 7;
default:
CV_Assert(false);
CV_Error(CV_StsBadArg, "Invalid value of quantized parameter");
return -1; //avoid warning
}
}

@ -306,7 +306,7 @@ void FisheyeProjector::mapForward(float x, float y, float &u, float &v)
float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
float u_ = atan2f(x_, z_);
float v_ = CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
u = scale * v_ * cosf(u_);
v = scale * v_ * sinf(u_);
@ -321,9 +321,9 @@ void FisheyeProjector::mapBackward(float u, float v, float &x, float &y)
float u_ = atan2f(v, u);
float v_ = sqrtf(u*u + v*v);
float sinv = sinf(CV_PI - v_);
float sinv = sinf((float)CV_PI - v_);
float x_ = sinv * sinf(u_);
float y_ = cosf(CV_PI - v_);
float y_ = cosf((float)CV_PI - v_);
float z_ = sinv * cosf(u_);
float z;
@ -343,7 +343,7 @@ void StereographicProjector::mapForward(float x, float y, float &u, float &v)
float z_ = r_kinv[6] * x + r_kinv[7] * y + r_kinv[8];
float u_ = atan2f(x_, z_);
float v_ = CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
float v_ = (float)CV_PI - acosf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
float r = sinf(v_) / (1 - cosf(v_));
@ -359,11 +359,11 @@ void StereographicProjector::mapBackward(float u, float v, float &x, float &y)
float u_ = atan2f(v, u);
float r = sqrtf(u*u + v*v);
float v_ = 2 * atanf(1.0 / r);
float v_ = 2 * atanf(1.f / r);
float sinv = sinf(CV_PI - v_);
float sinv = sinf((float)CV_PI - v_);
float x_ = sinv * sinf(u_);
float y_ = cosf(CV_PI - v_);
float y_ = cosf((float)CV_PI - v_);
float z_ = sinv * cosf(u_);
float z;
@ -560,7 +560,7 @@ void MercatorProjector::mapForward(float x, float y, float &u, float &v)
float v_ = asinf(y_ / sqrtf(x_ * x_ + y_ * y_ + z_ * z_));
u = scale * u_;
v = scale * logf( tanf( CV_PI/4 + v_/2 ) );
v = scale * logf( tanf( (float)(CV_PI/4) + v_/2 ) );
}
inline

@ -376,7 +376,7 @@ void OrbFeaturesFinder::find(const Mat &image, ImageFeatures &features)
} else if (image.type() == CV_8UC1) {
gray_image=image;
} else {
CV_Assert(false);
CV_Error(CV_StsUnsupportedFormat, "");
}
if (grid_size.area() == 1)

@ -700,7 +700,7 @@ string matchesGraphAsString(vector<string> &pathes, vector<MatchesInfo> &pairwis
for (size_t i = 0; i < comps.size.size(); ++i)
{
if (comps.size[comps.findSetByElem(i)] == 1)
if (comps.size[comps.findSetByElem((int)i)] == 1)
{
string name = pathes[i];
size_t prefix_len = name.find_last_of("/\\");

@ -268,7 +268,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
warper->warp(mask, K, cameras_[img_idx].R, INTER_NEAREST, BORDER_CONSTANT, mask_warped);
// Compensate exposure
exposure_comp_->apply(img_idx, corners[img_idx], img_warped, mask_warped);
exposure_comp_->apply((int)img_idx, corners[img_idx], img_warped, mask_warped);
img_warped.convertTo(img_warped_s, CV_16S);
img_warped.release();
@ -374,7 +374,7 @@ Stitcher::Status Stitcher::matchImages()
(*features_finder_)(img, features_[i]);
else
(*features_finder_)(img, features_[i], rois_[i]);
features_[i].img_idx = i;
features_[i].img_idx = (int)i;
LOGLN("Features in image #" << i+1 << ": " << features_[i].keypoints.size());
resize(full_img, img, Size(), seam_scale_, seam_scale_);

@ -8,7 +8,7 @@ void randu(cv::Mat& m)
if (m.depth() < CV_32F)
{
int minmax[] = {0, 256};
cv::Mat mr = cv::Mat(m.rows, m.cols * m.elemSize(), CV_8U, m.ptr(), m.step[0]);
cv::Mat mr = cv::Mat(m.rows, (int)(m.cols * m.elemSize()), CV_8U, m.ptr(), m.step[0]);
cv::randu(mr, cv::Mat(1, 1, CV_32S, minmax), cv::Mat(1, 1, CV_32S, minmax + 1));
}
else if (m.depth() == CV_32F)
@ -66,7 +66,7 @@ void Regression::init(const std::string& testSuitName, const std::string& ext)
if (data_path_dir)
{
int len = strlen(data_path_dir)-1;
int len = (int)strlen(data_path_dir)-1;
if (len < 0) len = 0;
std::string path_base = (data_path_dir[0] == 0 ? std::string(".") : std::string(data_path_dir))
+ (data_path_dir[len] == '/' || data_path_dir[len] == '\\' ? "" : path_separator)
@ -260,7 +260,7 @@ void Regression::write(cv::InputArray array)
write() << "type" << array.type();
if (isVector(array))
{
int total = array.total();
int total = (int)array.total();
int idx = regRNG.uniform(0, total);
write() << "len" << total;
write() << "idx" << idx;
@ -586,7 +586,7 @@ void TestBase::warmup(cv::InputOutputArray a, int wtype)
{
size_t total = a.total();
for (size_t i = 0; i < total; ++i)
warmup_impl(a.getMat(i), wtype);
warmup_impl(a.getMat((int)i), wtype);
}
}
@ -908,7 +908,7 @@ std::string TestBase::getDataPath(const std::string& relativePath)
std::string path;
if (data_path_dir)
{
int len = strlen(data_path_dir) - 1;
int len = (int)strlen(data_path_dir) - 1;
if (len < 0) len = 0;
path = (data_path_dir[0] == 0 ? std::string(".") : std::string(data_path_dir))
+ (data_path_dir[len] == '/' || data_path_dir[len] == '\\' ? "" : path_separator);

@ -292,7 +292,7 @@ static int RunBlobTrackingAuto( CvCapture* pCap, CvBlobTrackerAuto* pTracker,cha
*/
static void set_params(int argc, char* argv[], CvVSModule* pM, const char* prefix, const char* module)
{
int prefix_len = strlen(prefix);
int prefix_len = (int)strlen(prefix);
int i;
for(i=0; i<argc; ++i)
{
@ -306,14 +306,15 @@ static void set_params(int argc, char* argv[], CvVSModule* pM, const char* prefi
cmd++;
ptr_eq = strchr(cmd,'=');
if(ptr_eq)cmd_param_len = ptr_eq-cmd;
if(ptr_eq)
cmd_param_len = (int)(ptr_eq-cmd);
for(j=0; ; ++j)
{
int param_len;
const char* param = pM->GetParamName(j);
if(param==NULL) break;
param_len = strlen(param);
param_len = (int)strlen(param);
if(cmd_param_len!=param_len) continue;
if(MY_STRNICMP(param,cmd,param_len)!=0) continue;
cmd+=param_len;

@ -202,7 +202,7 @@ void print_variable_importance( CvDTree* dtree, const char** var_desc )
if( var_desc )
{
char buf[100];
int len = strchr( var_desc[i], '(' ) - var_desc[i] - 1;
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
strncpy( buf, var_desc[i], len );
buf[len] = '\0';
printf( "%s", buf );

@ -32,7 +32,7 @@ int count_classes(CvMLData& data)
return -1;
rmap[ival] = 1;
}
return rmap.size();
return (int)rmap.size();
}
void print_result(float train_err, float test_err, const CvMat* _var_imp)

@ -131,8 +131,7 @@ void drawPlot(const cv::Mat curve, const std::string figureTitle, const int lowe
int localAdaptation_photoreceptors, localAdaptation_Gcells;
void callBack_updateRetinaParams(int, void*)
{
retina->setupOPLandIPLParvoChannel(true, true, (float)(localAdaptation_photoreceptors/200.0), 0.5f, 0.43f, (double)retinaHcellsGain, 1.f, 7.f, (float)(localAdaptation_Gcells/200.0));
retina->setupOPLandIPLParvoChannel(true, true, (float)(localAdaptation_photoreceptors/200.0), 0.5f, 0.43f, (float)retinaHcellsGain, 1.f, 7.f, (float)(localAdaptation_Gcells/200.0));
}
int colorSaturationFactor;

@ -134,8 +134,8 @@ void rescaleGrayLevelMat(const cv::Mat &inputMat, cv::Mat &outputMat, const floa
{
inputMat.copyTo(outputMat);
// update threshold in the initial input image range
maxInputValue=(maxInputValue-255.f)/histNormRescalefactor+maxInput;
minInputValue=minInputValue/histNormRescalefactor+minInput;
maxInputValue=(float)((maxInputValue-255.f)/histNormRescalefactor+maxInput);
minInputValue=(float)(minInputValue/histNormRescalefactor+minInput);
std::cout<<"===> Input Hist clipping values (max,min) = "<<maxInputValue<<", "<<minInputValue<<std::endl;
cv::threshold( outputMat, outputMat, maxInputValue, maxInputValue, 2 ); //THRESH_TRUNC, clips values above maxInputValue
cv::threshold( outputMat, outputMat, minInputValue, minInputValue, 3 ); //
@ -164,8 +164,7 @@ void rescaleGrayLevelMat(const cv::Mat &inputMat, cv::Mat &outputMat, const floa
int localAdaptation_photoreceptors, localAdaptation_Gcells;
void callBack_updateRetinaParams(int, void*)
{
retina->setupOPLandIPLParvoChannel(true, true, (float)(localAdaptation_photoreceptors/200.0), 0.5f, 0.43f, (double)retinaHcellsGain, 1.f, 7.f, (float)(localAdaptation_Gcells/200.0));
retina->setupOPLandIPLParvoChannel(true, true, (float)(localAdaptation_photoreceptors/200.0), 0.5f, 0.43f, (float)retinaHcellsGain, 1.f, 7.f, (float)(localAdaptation_Gcells/200.0));
}
int colorSaturationFactor;
@ -211,8 +210,8 @@ void loadNewFrame(const std::string filenamePrototype, const int currentFileInde
double maxInput, minInput;
minMaxLoc(inputImage, &minInput, &maxInput);
std::cout<<"FIRST IMAGE pixels values range (max,min) : "<<maxInput<<", "<<minInput<<std::endl;
globalRescalefactor=50.0/(maxInput-minInput); // less than 255 for flexibility... experimental value to be carefull about
float channelOffset = -1.5*minInput;
globalRescalefactor=(float)(50.0/(maxInput-minInput)); // less than 255 for flexibility... experimental value to be carefull about
double channelOffset = -1.5*minInput;
globalOffset= cv::Scalar(channelOffset, channelOffset, channelOffset, channelOffset);
}
// call the generic input image rescaling callback

@ -977,7 +977,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector<Obd
CV_Error(CV_StsError,err_msg.c_str());
}
/* convert iterator to index */
target_idx = std::distance(output_headers.begin(),target_idx_it);
target_idx = (int)std::distance(output_headers.begin(),target_idx_it);
}
/* prepare variables related to calculating recall if using the recall threshold */
@ -989,7 +989,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector<Obd
/* in order to calculate the total number of relevant images for normalization of recall
it's necessary to extract the ground truth for the images under consideration */
getClassifierGroundTruth(obj_class, images, ground_truth);
total_relevant = std::count_if(ground_truth.begin(),ground_truth.end(),std::bind2nd(std::equal_to<char>(),(char)1));
total_relevant = (int)std::count_if(ground_truth.begin(),ground_truth.end(),std::bind2nd(std::equal_to<char>(),(char)1));
}
/* iterate through images */
@ -1040,7 +1040,7 @@ void VocData::calcClassifierConfMatRow(const string& obj_class, const vector<Obd
CV_Error(CV_StsError,err_msg.c_str());
}
/* convert iterator to index */
int class_idx = std::distance(output_headers.begin(),class_idx_it);
int class_idx = (int)std::distance(output_headers.begin(),class_idx_it);
//add to confusion matrix row in proportion
output_values[class_idx] += 1.f/static_cast<float>(img_objects.size());
}
@ -1174,7 +1174,7 @@ void VocData::calcDetectorConfMatRow(const string& obj_class, const ObdDatasetTy
if (ov > maxov)
{
maxov = ov;
max_gt_obj_idx = gt_obj_idx;
max_gt_obj_idx = (int)gt_obj_idx;
}
}
}
@ -1192,7 +1192,7 @@ void VocData::calcDetectorConfMatRow(const string& obj_class, const ObdDatasetTy
CV_Error(CV_StsError,err_msg.c_str());
}
/* convert iterator to index */
int class_idx = std::distance(output_headers.begin(),class_idx_it);
int class_idx = (int)std::distance(output_headers.begin(),class_idx_it);
//add to confusion matrix row in proportion
output_values[class_idx] += 1.0;
} else {
@ -1540,7 +1540,7 @@ void VocData::readDetectorResultsFile(const string& input_file, vector<string>&
bounding_boxes.push_back(bounding_box_vect);
} else {
/* if the image index has been seen before, add the current object below it in the 2D arrays */
int image_idx = std::distance(image_codes.begin(),image_codes_it);
int image_idx = (int)std::distance(image_codes.begin(),image_codes_it);
scores[image_idx].push_back(score);
bounding_boxes[image_idx].push_back(bounding_box);
}
@ -1985,7 +1985,7 @@ struct VocabTrainParams
{
VocabTrainParams() : trainObjClass("chair"), vocabSize(1000), memoryUse(200), descProportion(0.3f) {}
VocabTrainParams( const string _trainObjClass, size_t _vocabSize, size_t _memoryUse, float _descProportion ) :
trainObjClass(_trainObjClass), vocabSize(_vocabSize), memoryUse(_memoryUse), descProportion(_descProportion) {}
trainObjClass(_trainObjClass), vocabSize((int)_vocabSize), memoryUse((int)_memoryUse), descProportion(_descProportion) {}
void read( const FileNode& fn )
{
fn["trainObjClass"] >> trainObjClass;
@ -2154,7 +2154,7 @@ Mat trainVocabulary( const string& filename, VocData& vocData, const VocabTrainP
// Randomly pick an image from the dataset which hasn't yet been seen
// and compute the descriptors from that image.
int randImgIdx = rng( images.size() );
int randImgIdx = rng( (unsigned)images.size() );
Mat colorImage = imread( images[randImgIdx].path );
vector<KeyPoint> imageKeypoints;
fdetector->detect( colorImage, imageKeypoints );
@ -2296,12 +2296,12 @@ void removeBowImageDescriptorsByCount( vector<ObdImage>& images, vector<Mat> bow
const SVMTrainParamsExt& svmParamsExt, int descsToDelete )
{
RNG& rng = theRNG();
int pos_ex = std::count( objectPresent.begin(), objectPresent.end(), (char)1 );
int neg_ex = std::count( objectPresent.begin(), objectPresent.end(), (char)0 );
int pos_ex = (int)std::count( objectPresent.begin(), objectPresent.end(), (char)1 );
int neg_ex = (int)std::count( objectPresent.begin(), objectPresent.end(), (char)0 );
while( descsToDelete != 0 )
{
int randIdx = rng(images.size());
int randIdx = rng((unsigned)images.size());
// Prefer positive training examples according to svmParamsExt.targetRatio if required
if( objectPresent[randIdx] )
@ -2415,14 +2415,14 @@ void trainSVMClassifier( CvSVM& svm, const SVMTrainParamsExt& svmParamsExt, cons
}
// Prepare the input matrices for SVM training.
Mat trainData( images.size(), bowExtractor->getVocabulary().rows, CV_32FC1 );
Mat responses( images.size(), 1, CV_32SC1 );
Mat trainData( (int)images.size(), bowExtractor->getVocabulary().rows, CV_32FC1 );
Mat responses( (int)images.size(), 1, CV_32SC1 );
// Transfer bag of words vectors and responses across to the training data matrices
for( size_t imageIdx = 0; imageIdx < images.size(); imageIdx++ )
{
// Transfer image descriptor (bag of words vector) to training data matrix
Mat submat = trainData.row(imageIdx);
Mat submat = trainData.row((int)imageIdx);
if( bowImageDescriptors[imageIdx].cols != bowExtractor->descriptorSize() )
{
cout << "Error: computed bow image descriptor size " << bowImageDescriptors[imageIdx].cols
@ -2432,7 +2432,7 @@ void trainSVMClassifier( CvSVM& svm, const SVMTrainParamsExt& svmParamsExt, cons
bowImageDescriptors[imageIdx].copyTo( submat );
// Set response value
responses.at<int>(imageIdx) = objectPresent[imageIdx] ? 1 : -1;
responses.at<int>((int)imageIdx) = objectPresent[imageIdx] ? 1 : -1;
}
cout << "TRAINING SVM FOR CLASS ..." << objClassName << "..." << endl;

@ -232,7 +232,7 @@ void saveCameraParams( const string& filename,
if( !imagePoints.empty() )
{
Mat imagePtMat((int)imagePoints.size(), imagePoints[0].size(), CV_32FC2);
Mat imagePtMat((int)imagePoints.size(), (int)imagePoints[0].size(), CV_32FC2);
for( int i = 0; i < (int)imagePoints.size(); i++ )
{
Mat r = imagePtMat.row(i).reshape(2, imagePtMat.cols);

@ -95,11 +95,13 @@ int main( int argc, char** argv )
imshow("image", isColor ? image : gray);
int c = waitKey(0);
switch( (char)c )
if( (c & 255) == 27 )
{
case 27:
cout << "Exiting ...\n";
return 0;
break;
}
switch( (char)c )
{
case 'c':
if( isColor )
{

@ -103,12 +103,12 @@ int main(int argc, char** argv)
HybridTrackerParams params;
// motion model params
params.motion_model = CvMotionModel::LOW_PASS_FILTER;
params.low_pass_gain = 0.1;
params.low_pass_gain = 0.1f;
// mean shift params
params.ms_tracker_weight = 0.8;
params.ms_tracker_weight = 0.8f;
params.ms_params.tracking_type = CvMeanShiftTrackerParams::HS;
// feature tracking params
params.ft_tracker_weight = 0.2;
params.ft_tracker_weight = 0.2f;
params.ft_params.feature_type = CvFeatureTrackerParams::OPTICAL_FLOW;
params.ft_params.window_size = 0;
@ -121,12 +121,14 @@ int main(int argc, char** argv)
int i = 0;
float w[4];
while(1)
for(;;)
{
i++;
if (live)
{
cap >> frame;
if( frame.empty() )
break;
frame.copyTo(image);
}
else
@ -134,12 +136,12 @@ int main(int argc, char** argv)
fscanf(f, "%d %f %f %f %f\n", &i, &w[0], &w[1], &w[2], &w[3]);
sprintf(img_file, "seqG/%04d.png", i);
image = imread(img_file, CV_LOAD_IMAGE_COLOR);
selection = Rect(w[0]*image.cols, w[1]*image.rows, w[2]*image.cols, w[3]*image.rows);
if (image.empty())
break;
selection = Rect(cvRound(w[0]*image.cols), cvRound(w[1]*image.rows),
cvRound(w[2]*image.cols), cvRound(w[3]*image.rows));
}
if (image.data == NULL)
continue;
sprintf(img_file_num, "Frame: %d", i);
putText(image, img_file_num, Point(10, image.rows-20), FONT_HERSHEY_PLAIN, 0.75, Scalar(255, 255, 255));
if (!image.empty())
@ -163,7 +165,8 @@ int main(int argc, char** argv)
bitwise_not(roi, roi);
}
drawRectangle(&image, Rect(w[0]*image.cols, w[1]*image.rows, w[2]*image.cols, w[3]*image.rows));
drawRectangle(&image, Rect(cvRound(w[0]*image.cols), cvRound(w[1]*image.rows),
cvRound(w[2]*image.cols), cvRound(w[3]*image.rows)));
imshow("Win", image);
waitKey(100);
@ -174,5 +177,4 @@ int main(int argc, char** argv)
fclose(f);
return 0;
}

@ -107,13 +107,13 @@ int main(int argc, char* argv[])
help();
string images_folder, models_folder;
float overlapThreshold = 0.2;
float overlapThreshold = 0.2f;
int numThreads = -1;
if( argc > 2 )
{
images_folder = argv[1];
models_folder = argv[2];
if( argc > 3 ) overlapThreshold = atof(argv[3]);
if( argc > 3 ) overlapThreshold = (float)atof(argv[3]);
if( overlapThreshold < 0 || overlapThreshold > 1)
{
cout << "overlapThreshold must be in interval (0,1)." << endl;
@ -157,7 +157,7 @@ int main(int argc, char* argv[])
imshow( "result", image );
while(1)
for(;;)
{
int c = waitKey();
if( (char)c == 'n')

@ -48,7 +48,7 @@ public:
}
private:
static void cv_on_mouse(int a_event, int a_x, int a_y, int a_flags, void * a_params)
static void cv_on_mouse(int a_event, int a_x, int a_y, int, void *)
{
m_event = a_event;
m_x = a_x;
@ -186,7 +186,7 @@ int main(int argc, char * argv[])
std::copy(ids.begin(), ids.end(), std::ostream_iterator<std::string>(std::cout, "\n"));
}
}
int num_modalities = detector->getModalities().size();
int num_modalities = (int)detector->getModalities().size();
// Open Kinect sensor
cv::VideoCapture capture( CV_CAP_OPENNI );
@ -201,7 +201,7 @@ int main(int argc, char * argv[])
// Main loop
cv::Mat color, depth;
while (true)
for(;;)
{
// Capture next color/depth pair
capture.grab();
@ -262,7 +262,7 @@ int main(int argc, char * argv[])
std::vector<std::string> class_ids;
std::vector<cv::Mat> quantized_images;
match_timer.start();
detector->match(sources, matching_threshold, matches, class_ids, quantized_images);
detector->match(sources, (float)matching_threshold, matches, class_ids, quantized_images);
match_timer.stop();
int classes_visited = 0;
@ -331,6 +331,9 @@ int main(int argc, char * argv[])
cv::FileStorage fs;
char key = (char)cvWaitKey(10);
if( key == 'q' )
break;
switch (key)
{
case 'h':
@ -366,8 +369,8 @@ int main(int argc, char * argv[])
writeLinemod(detector, filename);
printf("Wrote detector and templates to %s\n", filename.c_str());
break;
case 'q':
return 0;
default:
;
}
}
return 0;
@ -403,8 +406,8 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
for (int l_i = 0; l_i < (int)a_chain.size(); ++l_i)
{
float x_diff = a_chain[(l_i + 1) % a_chain.size()].x - a_chain[l_i].x;
float y_diff = a_chain[(l_i + 1) % a_chain.size()].y - a_chain[l_i].y;
float x_diff = (float)(a_chain[(l_i + 1) % a_chain.size()].x - a_chain[l_i].x);
float y_diff = (float)(a_chain[(l_i + 1) % a_chain.size()].y - a_chain[l_i].y);
lp_seg_length[l_i] = sqrt(x_diff*x_diff + y_diff*y_diff);
l_chain_length += lp_seg_length[l_i];
}
@ -412,7 +415,7 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
{
if (lp_seg_length[l_i] > 0)
{
int l_cur_num = l_num_cost_pts * lp_seg_length[l_i] / l_chain_length;
int l_cur_num = cvRound(l_num_cost_pts * lp_seg_length[l_i] / l_chain_length);
float l_cur_len = lp_seg_length[l_i] / l_cur_num;
for (int l_j = 0; l_j < l_cur_num; ++l_j)
@ -421,8 +424,8 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
CvPoint l_pts;
l_pts.x = l_ratio * (a_chain[(l_i + 1) % a_chain.size()].x - a_chain[l_i].x) + a_chain[l_i].x;
l_pts.y = l_ratio * (a_chain[(l_i + 1) % a_chain.size()].y - a_chain[l_i].y) + a_chain[l_i].y;
l_pts.x = cvRound(l_ratio * (a_chain[(l_i + 1) % a_chain.size()].x - a_chain[l_i].x) + a_chain[l_i].x);
l_pts.y = cvRound(l_ratio * (a_chain[(l_i + 1) % a_chain.size()].y - a_chain[l_i].y) + a_chain[l_i].y);
l_chain_vector.push_back(l_pts);
}
@ -441,16 +444,16 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
reprojectPoints(lp_src_3Dpts, lp_src_3Dpts, f);
CvMat * lp_pts = cvCreateMat(l_chain_vector.size(), 4, CV_32F);
CvMat * lp_pts = cvCreateMat((int)l_chain_vector.size(), 4, CV_32F);
CvMat * lp_v = cvCreateMat(4, 4, CV_32F);
CvMat * lp_w = cvCreateMat(4, 1, CV_32F);
for (int l_i = 0; l_i < (int)l_chain_vector.size(); ++l_i)
{
CV_MAT_ELEM(*lp_pts, float, l_i, 0) = lp_src_3Dpts[l_i].x;
CV_MAT_ELEM(*lp_pts, float, l_i, 1) = lp_src_3Dpts[l_i].y;
CV_MAT_ELEM(*lp_pts, float, l_i, 2) = lp_src_3Dpts[l_i].z;
CV_MAT_ELEM(*lp_pts, float, l_i, 3) = 1.0;
CV_MAT_ELEM(*lp_pts, float, l_i, 0) = (float)lp_src_3Dpts[l_i].x;
CV_MAT_ELEM(*lp_pts, float, l_i, 1) = (float)lp_src_3Dpts[l_i].y;
CV_MAT_ELEM(*lp_pts, float, l_i, 2) = (float)lp_src_3Dpts[l_i].z;
CV_MAT_ELEM(*lp_pts, float, l_i, 3) = 1.0f;
}
cvSVD(lp_pts, lp_w, 0, lp_v);
@ -493,7 +496,7 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
}
int l_w = l_maxx - l_minx + 1;
int l_h = l_maxy - l_miny + 1;
int l_nn = a_chain.size();
int l_nn = (int)a_chain.size();
CvPoint * lp_chain = new CvPoint[l_nn];
@ -528,7 +531,7 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
{
for (int l_c = 0; l_c < l_w; ++l_c)
{
float l_dist = l_n[0] * lp_dst_3Dpts[l_ind].x + l_n[1] * lp_dst_3Dpts[l_ind].y + lp_dst_3Dpts[l_ind].z * l_n[2] + l_n[3];
float l_dist = (float)(l_n[0] * lp_dst_3Dpts[l_ind].x + l_n[1] * lp_dst_3Dpts[l_ind].y + lp_dst_3Dpts[l_ind].z * l_n[2] + l_n[3]);
++l_ind;
@ -538,8 +541,8 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
{
for (int l_p = 0; l_p < (int)a_masks.size(); ++l_p)
{
int l_col = (l_c + l_minx) / (l_p + 1.0);
int l_row = (l_r + l_miny) / (l_p + 1.0);
int l_col = cvRound((l_c + l_minx) / (l_p + 1.0));
int l_row = cvRound((l_r + l_miny) / (l_p + 1.0));
CV_IMAGE_ELEM(a_masks[l_p], unsigned char, l_row, l_col) = 0;
}
@ -548,8 +551,8 @@ void filterPlane(IplImage * ap_depth, std::vector<IplImage *> & a_masks, std::ve
{
for (int l_p = 0; l_p < (int)a_masks.size(); ++l_p)
{
int l_col = (l_c + l_minx) / (l_p + 1.0);
int l_row = (l_r + l_miny) / (l_p + 1.0);
int l_col = cvRound((l_c + l_minx) / (l_p + 1.0));
int l_row = cvRound((l_r + l_miny) / (l_p + 1.0));
CV_IMAGE_ELEM(a_masks[l_p], unsigned char, l_row, l_col) = 255;
}
@ -669,7 +672,7 @@ void templateConvexHull(const std::vector<cv::linemod::Template>& templates,
cv::convexHull(points, hull);
dst = cv::Mat::zeros(size, CV_8U);
const int hull_count = hull.size();
const int hull_count = (int)hull.size();
const cv::Point* hull_pts = &hull[0];
cv::fillPoly(dst, &hull_pts, &hull_count, 1, cv::Scalar(255));
}

@ -192,7 +192,7 @@ void saveResultImages( const Mat& queryImage, const vector<KeyPoint>& queryKeypo
{
if( !trainImages[i].empty() )
{
maskMatchesByTrainImgIdx( matches, i, mask );
maskMatchesByTrainImgIdx( matches, (int)i, mask );
drawMatches( queryImage, queryKeypoints, trainImages[i], trainKeypoints[i],
matches, drawImg, Scalar(255, 0, 0), Scalar(0, 255, 255), mask );
string filename = resultDir + "/res_" + trainImagesNames[i];

@ -184,7 +184,7 @@ int main( int argc, char* argv[] )
return -1;
}
bool modeRes;
bool modeRes=false;
switch ( imageMode )
{
case 0:

@ -60,7 +60,7 @@ int main(int argc, char** argv)
// ++filename;
if(filename[0] == '#')
continue;
int l = strlen(filename);
int l = (int)strlen(filename);
while(l > 0 && isspace(filename[l-1]))
--l;
filename[l] = '\0';

@ -4,7 +4,7 @@
using namespace cv;
int main(int argc, char* argv[])
int main(int, char* [])
{
VideoCapture video(0);
Mat frame, curr, prev, curr64f, prev64f, hann;

@ -196,7 +196,7 @@ int main(int argc, const char* argv[])
setMouseCallback(windowName, mouseCallback, &renderer);
setOpenGlDrawCallback(windowName, openGlDrawCallback, &renderer);
while (true)
for(;;)
{
int key = waitKey(10);

@ -43,7 +43,7 @@ void on_mouse( int event, int x, int y, int /*flags*/, void* )
return;
trainedPoints.push_back( Point(x,y) );
trainedPointsMarkers.push_back( classColors.size()-1 );
trainedPointsMarkers.push_back( (int)(classColors.size()-1) );
updateFlag = true;
}
else if( event == CV_EVENT_RBUTTONUP )

@ -101,21 +101,21 @@ int main(int argc, char** argv)
return -1;
}
int transformationType = TransformationType::RIGID_BODY_MOTION;
int transformationType = RIGID_BODY_MOTION;
if( argc == 6 )
{
string ttype = argv[5];
if( ttype == "-rbm" )
{
transformationType = TransformationType::RIGID_BODY_MOTION;
transformationType = RIGID_BODY_MOTION;
}
else if ( ttype == "-r")
{
transformationType = TransformationType::ROTATION;
transformationType = ROTATION;
}
else if ( ttype == "-t")
{
transformationType = TransformationType::TRANSLATION;
transformationType = TRANSLATION;
}
else
{
@ -145,9 +145,9 @@ int main(int argc, char** argv)
minGradMagnitudes[2] = 3;
minGradMagnitudes[3] = 1;
const float minDepth = 0; //in meters
const float maxDepth = 3; //in meters
const float maxDepthDiff = 0.07; //in meters
const float minDepth = 0.f; //in meters
const float maxDepth = 3.f; //in meters
const float maxDepthDiff = 0.07f; //in meters
tm.start();
bool isFound = cv::RGBDOdometry( Rt, Mat(),

@ -173,13 +173,13 @@ static Rect extract3DBox(const Mat& frame, Mat& shownFrame, Mat& selectedObjFram
vector<Point> hull;
convexHull(Mat_<Point>(Mat(imgpt)), hull);
Mat selectedObjMask = Mat::zeros(frame.size(), CV_8U);
fillConvexPoly(selectedObjMask, &hull[0], hull.size(), Scalar::all(255), 8, 0);
fillConvexPoly(selectedObjMask, &hull[0], (int)hull.size(), Scalar::all(255), 8, 0);
Rect roi = boundingRect(Mat(hull)) & Rect(Point(), frame.size());
if( runExtraSegmentation )
{
selectedObjMask = Scalar::all(GC_BGD);
fillConvexPoly(selectedObjMask, &hull[0], hull.size(), Scalar::all(GC_PR_FGD), 8, 0);
fillConvexPoly(selectedObjMask, &hull[0], (int)hull.size(), Scalar::all(GC_PR_FGD), 8, 0);
Mat bgdModel, fgdModel;
grabCut(frame, selectedObjMask, roi, bgdModel, fgdModel,
3, GC_INIT_WITH_RECT + GC_INIT_WITH_MASK);

@ -570,8 +570,9 @@ int main(int argc, char* argv[])
{
Mat_<float> K;
cameras[i].K().convertTo(K, CV_32F);
K(0,0) *= seam_work_aspect; K(0,2) *= seam_work_aspect;
K(1,1) *= seam_work_aspect; K(1,2) *= seam_work_aspect;
float swa = (float)seam_work_aspect;
K(0,0) *= swa; K(0,2) *= swa;
K(1,1) *= swa; K(1,2) *= swa;
corners[i] = warper->warp(images[i], K, cameras[i].R, INTER_LINEAR, BORDER_REFLECT, images_warped[i]);
sizes[i] = images_warped[i].size();

@ -51,7 +51,7 @@ int process(VideoCapture& capture)
{
capture >> frame;
if (frame.empty())
continue;
break;
cv::Mat gray;
cv::cvtColor(frame,gray,CV_RGB2GRAY);
findDataMatrix(gray, codes);

@ -42,7 +42,7 @@ int main()
"ALPHA_ATOP_PREMUL", "ALPHA_XOR_PREMUL", "ALPHA_PLUS_PREMUL", "ALPHA_PREMUL"
};
while (true)
for(;;)
{
cout << op_names[alpha_op] << endl;

@ -208,7 +208,7 @@ int main(int argc, const char* argv[])
imshow("Interpolated frame", frames[currentFrame]);
while (true)
for(;;)
{
int key = toupper(waitKey(10) & 0xff);

@ -1172,7 +1172,7 @@ TEST(PyrLKOpticalFlow)
gpu::GpuMat d_frame1(frame1);
gpu::GpuMat d_pts;
Mat pts_mat(1, pts.size(), CV_32FC2, (void*)&pts[0]);
Mat pts_mat(1, (int)pts.size(), CV_32FC2, (void*)&pts[0]);
d_pts.upload(pts_mat);
gpu::GpuMat d_nextPts;

Loading…
Cancel
Save