diff --git a/modules/bioinspired/include/opencv2/bioinspired/transientareassegmentationmodule.hpp b/modules/bioinspired/include/opencv2/bioinspired/transientareassegmentationmodule.hpp index d9536de20..fe3898451 100755 --- a/modules/bioinspired/include/opencv2/bioinspired/transientareassegmentationmodule.hpp +++ b/modules/bioinspired/include/opencv2/bioinspired/transientareassegmentationmodule.hpp @@ -137,12 +137,12 @@ public: * @param newParameters : a parameters structures updated with the new target configuration * @param applyDefaultSetupOnFailure : set to true if an error must be thrown on error */ - virtual void setup(TransientAreasSegmentationModule::SegmentationParameters newParameters)=0; + virtual void setup(SegmentationParameters newParameters)=0; /** * @return the current parameters setup */ - virtual struct TransientAreasSegmentationModule::TransientAreasSegmentationModule::SegmentationParameters getParameters()=0; + virtual SegmentationParameters getParameters()=0; /** * parameters setup display method diff --git a/modules/bioinspired/src/transientareassegmentationmodule.cpp b/modules/bioinspired/src/transientareassegmentationmodule.cpp index 252956ce8..3d040aab5 100644 --- a/modules/bioinspired/src/transientareassegmentationmodule.cpp +++ b/modules/bioinspired/src/transientareassegmentationmodule.cpp @@ -86,7 +86,8 @@ namespace cv namespace bioinspired { -class TransientAreasSegmentationModuleImpl: protected BasicRetinaFilter +class TransientAreasSegmentationModuleImpl : + protected BasicRetinaFilter { public: @@ -136,7 +137,7 @@ public: /** * @return the current parameters setup */ - struct TransientAreasSegmentationModule::TransientAreasSegmentationModule::SegmentationParameters getParameters(); + struct TransientAreasSegmentationModule::SegmentationParameters getParameters(); /** * parameters setup display method @@ -219,19 +220,21 @@ protected: // Buffer conversion utilities void _convertValarrayBuffer2cvMat(const std::valarray &grayMatrixToConvert, const unsigned int nbRows, const unsigned int nbColumns, OutputArray outBuffer); bool _convertCvMat2ValarrayBuffer(InputArray inputMat, std::valarray &outputValarrayMatrix); + + const TransientAreasSegmentationModuleImpl & operator = (const TransientAreasSegmentationModuleImpl &); }; class TransientAreasSegmentationModuleImpl_: public TransientAreasSegmentationModule { public: -TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){}; + TransientAreasSegmentationModuleImpl_(const Size size):_segmTool(size){}; inline virtual Size getSize(){return _segmTool.getSize();}; inline virtual void write( cv::FileStorage& fs ) const{_segmTool.write(fs);}; inline virtual void setup(String segmentationParameterFile, const bool applyDefaultSetupOnFailure){_segmTool.setup(segmentationParameterFile, applyDefaultSetupOnFailure);}; inline virtual void setup(cv::FileStorage &fs, const bool applyDefaultSetupOnFailure){_segmTool.setup(fs, applyDefaultSetupOnFailure);}; inline virtual void setup(TransientAreasSegmentationModule::SegmentationParameters newParameters){_segmTool.setup(newParameters);}; inline virtual const String printSetup(){return _segmTool.printSetup();}; - inline virtual struct TransientAreasSegmentationModule::TransientAreasSegmentationModule::SegmentationParameters getParameters(){return _segmTool.getParameters();}; + inline virtual struct TransientAreasSegmentationModule::SegmentationParameters getParameters(){return _segmTool.getParameters();}; inline virtual void write( String fs ) const{_segmTool.write(fs);}; inline virtual void run(InputArray inputToSegment, const int channelIndex){_segmTool.run(inputToSegment, channelIndex);}; inline virtual void getSegmentationPicture(OutputArray transientAreas){return _segmTool.getSegmentationPicture(transientAreas);}; diff --git a/modules/reg/samples/map_test.cpp b/modules/reg/samples/map_test.cpp index 5eaba661e..ddd58ca7e 100644 --- a/modules/reg/samples/map_test.cpp +++ b/modules/reg/samples/map_test.cpp @@ -125,7 +125,7 @@ static void testEuclidean(const Mat& img1) Mat img2; // Warp original image - double theta = 3*M_PI/180; + double theta = 3*CV_PI/180; double cosT = cos(theta); double sinT = sin(theta); Matx linTr(cosT, -sinT, sinT, cosT); @@ -163,7 +163,7 @@ static void testSimilarity(const Mat& img1) Mat img2; // Warp original image - double theta = 3*M_PI/180; + double theta = 3*CV_PI/180; double scale = 0.95; double a = scale*cos(theta); double b = scale*sin(theta); diff --git a/modules/rgbd/samples/odometry_evaluation.cpp b/modules/rgbd/samples/odometry_evaluation.cpp index cabb14c1e..de825c459 100644 --- a/modules/rgbd/samples/odometry_evaluation.cpp +++ b/modules/rgbd/samples/odometry_evaluation.cpp @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -187,7 +186,7 @@ int main(int argc, char** argv) // scale depth Mat depth_flt; depth.convertTo(depth_flt, CV_32FC1, 1.f/5000.f); -#if not BILATERAL_FILTER +#if !BILATERAL_FILTER depth_flt.setTo(std::numeric_limits::quiet_NaN(), depth == 0); depth = depth_flt; #else diff --git a/modules/rgbd/src/depth_cleaner.cpp b/modules/rgbd/src/depth_cleaner.cpp index d99da3c9e..3c9fecc5e 100644 --- a/modules/rgbd/src/depth_cleaner.cpp +++ b/modules/rgbd/src/depth_cleaner.cpp @@ -114,7 +114,7 @@ namespace { const cv::Mat_ &depth(depth_in); cv::Mat depth_out_tmp; - computeImpl(depth, depth_out_tmp, 0.001); + computeImpl(depth, depth_out_tmp, 0.001f); depth_out_tmp.convertTo(depth_out, CV_16U); break; } @@ -142,16 +142,16 @@ namespace void computeImpl(const cv::Mat_ &depth_in, cv::Mat & depth_out, ContainerDepth scale) const { - const ContainerDepth theta_mean = 30. * CV_PI / 180; + const ContainerDepth theta_mean = (float)(30. * CV_PI / 180); int rows = depth_in.rows; int cols = depth_in.cols; // Precompute some data - const ContainerDepth sigma_L = 0.8 + 0.035 * theta_mean / (CV_PI / 2 - theta_mean); + const ContainerDepth sigma_L = (float)(0.8 + 0.035 * theta_mean / (CV_PI / 2 - theta_mean)); cv::Mat_ sigma_z(rows, cols); for (int y = 0; y < rows; ++y) for (int x = 0; x < cols; ++x) - sigma_z(y, x) = 0.0012 + 0.0019 * (depth_in(y, x) * scale - 0.4) * (depth_in(y, x) * scale - 0.4); + sigma_z(y, x) = (float)(0.0012 + 0.0019 * (depth_in(y, x) * scale - 0.4) * (depth_in(y, x) * scale - 0.4)); ContainerDepth difference_threshold = 10; cv::Mat_ Dw_sum = cv::Mat_::zeros(rows, cols), w_sum = @@ -170,9 +170,9 @@ namespace ContainerDepth(j) * ContainerDepth(j) + ContainerDepth(i) * ContainerDepth(i)); ContainerDepth delta_z; if (depth_in(y, x) > depth_in(y + j, x + i)) - delta_z = depth_in(y, x) - depth_in(y + j, x + i); + delta_z = (float)(depth_in(y, x) - depth_in(y + j, x + i)); else - delta_z = depth_in(y + j, x + i) - depth_in(y, x); + delta_z = (float)(depth_in(y + j, x + i) - depth_in(y, x)); if (delta_z < difference_threshold) { delta_z *= scale; diff --git a/modules/rgbd/src/depth_to_3d.cpp b/modules/rgbd/src/depth_to_3d.cpp index d3411f293..db19cd865 100644 --- a/modules/rgbd/src/depth_to_3d.cpp +++ b/modules/rgbd/src/depth_to_3d.cpp @@ -104,9 +104,9 @@ namespace size_t n_points; if (depth.depth() == CV_16U) - n_points = convertDepthToFloat(depth, mask, 1.0 / 1000.0f, u_mat, v_mat, z_mat); + n_points = convertDepthToFloat(depth, mask, 1.0f / 1000.0f, u_mat, v_mat, z_mat); else if (depth.depth() == CV_16S) - n_points = convertDepthToFloat(depth, mask, 1.0 / 1000.0f, u_mat, v_mat, z_mat); + n_points = convertDepthToFloat(depth, mask, 1.0f / 1000.0f, u_mat, v_mat, z_mat); else { CV_Assert(depth.type() == CV_32F); @@ -199,9 +199,9 @@ namespace cv cv::Mat_ z_mat; if (depth.depth() == CV_16U) - convertDepthToFloat(depth, 1.0 / 1000.0f, points_float, z_mat); + convertDepthToFloat(depth, 1.0f / 1000.0f, points_float, z_mat); else if (depth.depth() == CV_16U) - convertDepthToFloat(depth, 1.0 / 1000.0f, points_float, z_mat); + convertDepthToFloat(depth, 1.0f / 1000.0f, points_float, z_mat); else { CV_Assert(depth.type() == CV_32F); diff --git a/modules/rgbd/src/depth_to_3d.h b/modules/rgbd/src/depth_to_3d.h index dcbd09d9f..78f691ada 100644 --- a/modules/rgbd/src/depth_to_3d.h +++ b/modules/rgbd/src/depth_to_3d.h @@ -72,14 +72,14 @@ convertDepthToFloat(const cv::Mat& depth, const cv::Mat& mask, float scale, cv:: for (int u = 0; u < depth_size.width; u++, ++r) if (*r) { - u_mat(n_points, 0) = u; - v_mat(n_points, 0) = v; + u_mat((int)n_points, 0) = (float)u; + v_mat((int)n_points, 0) = (float)v; T depth_i = depth.at(v, u); if (cvIsNaN(depth_i) || (depth_i == std::numeric_limits::min()) || (depth_i == std::numeric_limits::max())) - z_mat(n_points, 0) = std::numeric_limits::quiet_NaN(); + z_mat((int)n_points, 0) = std::numeric_limits::quiet_NaN(); else - z_mat(n_points, 0) = depth_i * scale; + z_mat((int)n_points, 0) = depth_i * scale; ++n_points; } @@ -104,7 +104,7 @@ convertDepthToFloat(const cv::Mat& depth, float scale, const cv::Mat &uv_mat, cv for (cv::Mat_::const_iterator uv_iter = uv_mat.begin(), uv_end = uv_mat.end(); uv_iter != uv_end; ++uv_iter, ++z_mat_iter) { - T depth_i = depth.at < T > ((*uv_iter)[1], (*uv_iter)[0]); + T depth_i = depth.at < T > ((int)(*uv_iter)[1], (int)(*uv_iter)[0]); if (cvIsNaN(depth_i) || (depth_i == std::numeric_limits < T > ::min()) || (depth_i == std::numeric_limits < T > ::max())) diff --git a/modules/rgbd/src/normal.cpp b/modules/rgbd/src/normal.cpp index c0000328f..d81c0df7c 100644 --- a/modules/rgbd/src/normal.cpp +++ b/modules/rgbd/src/normal.cpp @@ -111,10 +111,10 @@ namespace // In the paper, z goes away from the camera, y goes down, x goes right // OpenCV has the same conventions // Theta goes from z to x (and actually goes from -pi/2 to pi/2, phi goes from z to y - float theta = std::atan2(row_points->val[0], row_points->val[2]); + float theta = (float)std::atan2(row_points->val[0], row_points->val[2]); *row_cos_theta = std::cos(theta); *row_sin_theta = std::sin(theta); - float phi = std::asin(row_points->val[1] / (*row_r)); + float phi = (float)std::asin(row_points->val[1] / (*row_r)); *row_cos_phi = std::cos(phi); *row_sin_phi = std::sin(phi); } @@ -195,7 +195,7 @@ namespace if ((K_ori.cols != K_ori_.cols) || (K_ori.rows != K_ori_.rows) || (K_ori.type() != K_ori_.type())) return false; bool K_test = !(cv::countNonZero(K_ori != K_ori_)); - return (rows == rows_) && (cols = cols_) && (window_size == window_size_) && (depth == depth_) && (K_test) + return (rows == rows_) && (cols == cols_) && (window_size == window_size_) && (depth == depth_) && (K_test) && (method == method_); } protected: @@ -330,9 +330,9 @@ template void multiply_by_K_inv(const cv::Matx & K_inv, U a, U b, U c, cv::Vec &res) { - res[0] = K_inv(0, 0) * a + K_inv(0, 1) * b + K_inv(0, 2) * c; - res[1] = K_inv(1, 1) * b + K_inv(1, 2) * c; - res[2] = c; + res[0] = (T)(K_inv(0, 0) * a + K_inv(0, 1) * b + K_inv(0, 2) * c); + res[1] = (T)(K_inv(1, 1) * b + K_inv(1, 2) * c); + res[2] = (T)c; } namespace @@ -424,7 +424,7 @@ namespace // Define K_inv by hand, just for higher accuracy Mat33T K_inv = cv::Matx::eye(), K; K_.copyTo(K); - K_inv(0, 0) = 1.0 / K(0, 0); + K_inv(0, 0) = 1.0f / K(0, 0); K_inv(0, 1) = -K(0, 1) / (K(0, 0) * K(1, 1)); K_inv(0, 2) = (K(0, 1) * K(1, 2) - K(0, 2) * K(1, 1)) / (K(0, 0) * K(1, 1)); K_inv(1, 1) = 1 / K(1, 1); @@ -527,8 +527,8 @@ namespace getDerivKernels(kx_dy_, ky_dy_, 0, 1, window_size_, true, depth_); // Get the mapping function for SRI - float min_theta = std::asin(sin_theta(0, 0)), max_theta = std::asin(sin_theta(0, cols_ - 1)); - float min_phi = std::asin(sin_phi(0, cols_/2-1)), max_phi = std::asin(sin_phi(rows_ - 1, cols_/2-1)); + float min_theta = (float)std::asin(sin_theta(0, 0)), max_theta = (float)std::asin(sin_theta(0, cols_ - 1)); + float min_phi = (float)std::asin(sin_phi(0, cols_/2-1)), max_phi = (float) std::asin(sin_phi(rows_ - 1, cols_/2-1)); std::vector points3d(cols_ * rows_); R_hat_.create(rows_, cols_); @@ -566,11 +566,11 @@ namespace //map for converting from Spherical coordinate space to Euclidean space euclideanMap_.create(rows_,cols_); - float invFx = 1.0f/K_.at(0,0), cx = K_.at(0,2); + float invFx = (float)(1.0f/K_.at(0,0)), cx = (float)K_.at(0,2); double invFy = 1.0f/K_.at(1,1), cy = K_.at(1,2); for (int i = 0; i < rows_; i++) { - float y = (i - cy)*invFy; + float y = (float)((i - cy)*invFy); for (int j = 0; j < cols_; j++) { float x = (j - cx)*invFx; diff --git a/modules/rgbd/src/odometry.cpp b/modules/rgbd/src/odometry.cpp index ee292cea1..23ec7b72f 100644 --- a/modules/rgbd/src/odometry.cpp +++ b/modules/rgbd/src/odometry.cpp @@ -147,7 +147,7 @@ void preparePyramidImage(const Mat& image, std::vector& pyramidImage, size_ CV_Assert(pyramidImage[i].type() == image.type()); } else - buildPyramid(image, pyramidImage, levelCount - 1); + buildPyramid(image, pyramidImage, (int)levelCount - 1); } static @@ -163,7 +163,7 @@ void preparePyramidDepth(const Mat& depth, std::vector& pyramidDepth, size_ CV_Assert(pyramidDepth[i].type() == depth.type()); } else - buildPyramid(depth, pyramidDepth, levelCount - 1); + buildPyramid(depth, pyramidDepth, (int)levelCount - 1); } static @@ -192,7 +192,7 @@ void preparePyramidMask(const Mat& mask, const std::vector& pyramidDepth, f else validMask = mask.clone(); - buildPyramid(validMask, pyramidMask, pyramidDepth.size() - 1); + buildPyramid(validMask, pyramidMask, (int)pyramidDepth.size() - 1); for(size_t i = 0; i < pyramidMask.size(); i++) { @@ -238,7 +238,7 @@ void preparePyramidCloud(const std::vector& pyramidDepth, const Mat& camera else { std::vector pyramidCameraMatrix; - buildPyramidCameraMatrix(cameraMatrix, pyramidDepth.size(), pyramidCameraMatrix); + buildPyramidCameraMatrix(cameraMatrix, (int)pyramidDepth.size(), pyramidCameraMatrix); pyramidCloud.resize(pyramidDepth.size()); for(size_t i = 0; i < pyramidDepth.size(); i++) @@ -319,7 +319,7 @@ void preparePyramidTexturedMask(const std::vector& pyramid_dI_dx, const std } else { - const float sobelScale2_inv = 1.f / (sobelScale * sobelScale); + const float sobelScale2_inv = 1.f / (float)(sobelScale * sobelScale); pyramidTexturedMask.resize(pyramid_dI_dx.size()); for(size_t i = 0; i < pyramidTexturedMask.size(); i++) { @@ -343,7 +343,7 @@ void preparePyramidTexturedMask(const std::vector& pyramid_dI_dx, const std } pyramidTexturedMask[i] = texturedMask & pyramidMask[i]; - randomSubsetOfMask(pyramidTexturedMask[i], maxPointsPart); + randomSubsetOfMask(pyramidTexturedMask[i], (float)maxPointsPart); } } } @@ -364,7 +364,7 @@ void preparePyramidNormals(const Mat& normals, const std::vector& pyramidDe } else { - buildPyramid(normals, pyramidNormals, pyramidDepth.size() - 1); + buildPyramid(normals, pyramidNormals, (int)pyramidDepth.size() - 1); // renormalize normals for(size_t i = 1; i < pyramidNormals.size(); i++) { @@ -419,7 +419,7 @@ void preparePyramidNormalsMask(const std::vector& pyramidNormals, const std } } } - randomSubsetOfMask(normalsMask, maxPointsPart); + randomSubsetOfMask(normalsMask, (float)maxPointsPart); } } } @@ -488,16 +488,16 @@ void computeCorresps(const Mat& K, const Mat& K_inv, const Mat& Rt, const double * KRK_inv_ptr = KRK_inv.ptr(); for(int u1 = 0; u1 < depth1.cols; u1++) { - KRK_inv0_u1[u1] = KRK_inv_ptr[0] * u1; - KRK_inv3_u1[u1] = KRK_inv_ptr[3] * u1; - KRK_inv6_u1[u1] = KRK_inv_ptr[6] * u1; + KRK_inv0_u1[u1] = (float)(KRK_inv_ptr[0] * u1); + KRK_inv3_u1[u1] = (float)(KRK_inv_ptr[3] * u1); + KRK_inv6_u1[u1] = (float)(KRK_inv_ptr[6] * u1); } for(int v1 = 0; v1 < depth1.rows; v1++) { - KRK_inv1_v1_plus_KRK_inv2[v1] = KRK_inv_ptr[1] * v1 + KRK_inv_ptr[2]; - KRK_inv4_v1_plus_KRK_inv5[v1] = KRK_inv_ptr[4] * v1 + KRK_inv_ptr[5]; - KRK_inv7_v1_plus_KRK_inv8[v1] = KRK_inv_ptr[7] * v1 + KRK_inv_ptr[8]; + KRK_inv1_v1_plus_KRK_inv2[v1] = (float)(KRK_inv_ptr[1] * v1 + KRK_inv_ptr[2]); + KRK_inv4_v1_plus_KRK_inv5[v1] = (float)(KRK_inv_ptr[4] * v1 + KRK_inv_ptr[5]); + KRK_inv7_v1_plus_KRK_inv8[v1] = (float)(KRK_inv_ptr[7] * v1 + KRK_inv_ptr[8]); } } @@ -542,7 +542,7 @@ void computeCorresps(const Mat& K, const Mat& K_inv, const Mat& Rt, else correspCount++; - c = Vec2s(u1,v1); + c = Vec2s((short)u1, (short)v1); } } } @@ -686,9 +686,9 @@ void calcRgbdLsmMatrices(const Mat& image0, const Mat& cloud0, const Mat& Rt, const Point3f& p0 = cloud0.at(v0,u0); Point3f tp0; - tp0.x = p0.x * Rt_ptr[0] + p0.y * Rt_ptr[1] + p0.z * Rt_ptr[2] + Rt_ptr[3]; - tp0.y = p0.x * Rt_ptr[4] + p0.y * Rt_ptr[5] + p0.z * Rt_ptr[6] + Rt_ptr[7]; - tp0.z = p0.x * Rt_ptr[8] + p0.y * Rt_ptr[9] + p0.z * Rt_ptr[10] + Rt_ptr[11]; + tp0.x = (float)(p0.x * Rt_ptr[0] + p0.y * Rt_ptr[1] + p0.z * Rt_ptr[2] + Rt_ptr[3]); + tp0.y = (float)(p0.x * Rt_ptr[4] + p0.y * Rt_ptr[5] + p0.z * Rt_ptr[6] + Rt_ptr[7]); + tp0.z = (float)(p0.x * Rt_ptr[8] + p0.y * Rt_ptr[9] + p0.z * Rt_ptr[10] + Rt_ptr[11]); func(A_ptr, w_sobelScale * dI_dx1.at(v1,u1), @@ -742,9 +742,9 @@ void calcICPLsmMatrices(const Mat& cloud0, const Mat& Rt, const Point3f& p0 = cloud0.at(v0,u0); Point3f tp0; - tp0.x = p0.x * Rt_ptr[0] + p0.y * Rt_ptr[1] + p0.z * Rt_ptr[2] + Rt_ptr[3]; - tp0.y = p0.x * Rt_ptr[4] + p0.y * Rt_ptr[5] + p0.z * Rt_ptr[6] + Rt_ptr[7]; - tp0.z = p0.x * Rt_ptr[8] + p0.y * Rt_ptr[9] + p0.z * Rt_ptr[10] + Rt_ptr[11]; + tp0.x = (float)(p0.x * Rt_ptr[0] + p0.y * Rt_ptr[1] + p0.z * Rt_ptr[2] + Rt_ptr[3]); + tp0.y = (float)(p0.x * Rt_ptr[4] + p0.y * Rt_ptr[5] + p0.z * Rt_ptr[6] + Rt_ptr[7]); + tp0.z = (float)(p0.x * Rt_ptr[8] + p0.y * Rt_ptr[9] + p0.z * Rt_ptr[10] + Rt_ptr[11]); Vec3f n1 = normals1.at(v1, u1); Point3f v = cloud1.at(v1,u1) - tp0; @@ -846,13 +846,13 @@ bool RGBDICPOdometryImpl(Mat& Rt, const Mat& initRt, const int minCorrespsCount = minOverdetermScale * transformDim; std::vector pyramidCameraMatrix; - buildPyramidCameraMatrix(cameraMatrix, iterCounts.size(), pyramidCameraMatrix); + buildPyramidCameraMatrix(cameraMatrix, (int)iterCounts.size(), pyramidCameraMatrix); Mat resultRt = initRt.empty() ? Mat::eye(4,4,CV_64FC1) : initRt.clone(); Mat currRt, ksi; bool isOk = false; - for(int level = iterCounts.size() - 1; level >= 0; level--) + for(int level = (int)iterCounts.size() - 1; level >= 0; level--) { const Mat& levelCameraMatrix = pyramidCameraMatrix[level]; const Mat& levelCameraMatrix_inv = levelCameraMatrix.inv(DECOMP_SVD); @@ -1150,7 +1150,7 @@ Size RgbdOdometry::prepareFrameCache(Ptr& frame, int cacheType) c preparePyramidDepth(frame->depth, frame->pyramidDepth, iterCounts.total()); - preparePyramidMask(frame->mask, frame->pyramidDepth, minDepth, maxDepth, + preparePyramidMask(frame->mask, frame->pyramidDepth, (float)minDepth, (float)maxDepth, frame->pyramidNormals, frame->pyramidMask); if(cacheType & OdometryFrame::CACHE_SRC) @@ -1176,7 +1176,7 @@ void RgbdOdometry::checkParams() const bool RgbdOdometry::computeImpl(const Ptr& srcFrame, const Ptr& dstFrame, Mat& Rt, const Mat& initRt) const { - return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, maxDepthDiff, iterCounts, maxTranslation, maxRotation, RGBD_ODOMETRY, transformType); + return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, (float)maxDepthDiff, iterCounts, maxTranslation, maxRotation, RGBD_ODOMETRY, transformType); } // @@ -1250,13 +1250,13 @@ Size ICPOdometry::prepareFrameCache(Ptr& frame, int cacheType) co preparePyramidNormals(frame->normals, frame->pyramidDepth, frame->pyramidNormals); - preparePyramidMask(frame->mask, frame->pyramidDepth, minDepth, maxDepth, + preparePyramidMask(frame->mask, frame->pyramidDepth, (float)minDepth, (float)maxDepth, frame->pyramidNormals, frame->pyramidMask); preparePyramidNormalsMask(frame->pyramidNormals, frame->pyramidMask, maxPointsPart, frame->pyramidNormalsMask); } else - preparePyramidMask(frame->mask, frame->pyramidDepth, minDepth, maxDepth, + preparePyramidMask(frame->mask, frame->pyramidDepth, (float)minDepth, (float)maxDepth, frame->pyramidNormals, frame->pyramidMask); return frame->depth.size(); @@ -1270,7 +1270,7 @@ void ICPOdometry::checkParams() const bool ICPOdometry::computeImpl(const Ptr& srcFrame, const Ptr& dstFrame, Mat& Rt, const Mat& initRt) const { - return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, maxDepthDiff, iterCounts, maxTranslation, maxRotation, ICP_ODOMETRY, transformType); + return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, (float)maxDepthDiff, iterCounts, maxTranslation, maxRotation, ICP_ODOMETRY, transformType); } // @@ -1359,7 +1359,7 @@ Size RgbdICPOdometry::prepareFrameCache(Ptr& frame, int cacheType preparePyramidNormals(frame->normals, frame->pyramidDepth, frame->pyramidNormals); - preparePyramidMask(frame->mask, frame->pyramidDepth, minDepth, maxDepth, + preparePyramidMask(frame->mask, frame->pyramidDepth, (float)minDepth, (float)maxDepth, frame->pyramidNormals, frame->pyramidMask); preparePyramidSobel(frame->pyramidImage, 1, 0, frame->pyramid_dI_dx); @@ -1371,7 +1371,7 @@ Size RgbdICPOdometry::prepareFrameCache(Ptr& frame, int cacheType preparePyramidNormalsMask(frame->pyramidNormals, frame->pyramidMask, maxPointsPart, frame->pyramidNormalsMask); } else - preparePyramidMask(frame->mask, frame->pyramidDepth, minDepth, maxDepth, + preparePyramidMask(frame->mask, frame->pyramidDepth, (float)minDepth, (float)maxDepth, frame->pyramidNormals, frame->pyramidMask); return frame->image.size(); @@ -1386,7 +1386,7 @@ void RgbdICPOdometry::checkParams() const bool RgbdICPOdometry::computeImpl(const Ptr& srcFrame, const Ptr& dstFrame, Mat& Rt, const Mat& initRt) const { - return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, maxDepthDiff, iterCounts, maxTranslation, maxRotation, MERGED_ODOMETRY, transformType); + return RGBDICPOdometryImpl(Rt, initRt, srcFrame, dstFrame, cameraMatrix, (float)maxDepthDiff, iterCounts, maxTranslation, maxRotation, MERGED_ODOMETRY, transformType); } // diff --git a/modules/rgbd/src/plane.cpp b/modules/rgbd/src/plane.cpp index 3a56c4d9c..2f3aa7999 100644 --- a/modules/rgbd/src/plane.cpp +++ b/modules/rgbd/src/plane.cpp @@ -523,6 +523,8 @@ private: unsigned char plane_index_; /** THe block size as defined in the main algorithm */ int block_size_; + + const InlierFinder & operator = (const InlierFinder &); } ; @@ -563,7 +565,7 @@ namespace cv size_t index_plane = 0; std::vector plane_coefficients; - float mse_min = threshold_ * threshold_; + float mse_min = (float)(threshold_ * threshold_); while (!plane_queue.empty()) { @@ -572,16 +574,17 @@ namespace cv if (front_tile.mse_ > mse_min) break; - InlierFinder inlier_finder(threshold_, points3d, normals, index_plane, block_size_); + InlierFinder inlier_finder((float)threshold_, points3d, normals, (unsigned char)index_plane, block_size_); // Construct the plane for the first tile int x = front_tile.x_, y = front_tile.y_; const cv::Vec3f & n = plane_grid.n_(y, x); cv::Ptr plane; if ((sensor_error_a_ == 0) && (sensor_error_b_ == 0) && (sensor_error_c_ == 0)) - plane = cv::Ptr(new Plane(plane_grid.m_(y, x), n, index_plane)); + plane = cv::Ptr(new Plane(plane_grid.m_(y, x), n, (int)index_plane)); else - plane = cv::Ptr(new PlaneABC(plane_grid.m_(y, x), n, index_plane, sensor_error_a_, sensor_error_b_, sensor_error_c_)); + plane = cv::Ptr(new PlaneABC(plane_grid.m_(y, x), n, (int)index_plane, + (float)sensor_error_a_, (float)sensor_error_b_, (float)sensor_error_c_)); cv::Mat_ plane_mask = cv::Mat_::zeros(points3d.rows / block_size_, points3d.cols / block_size_); @@ -631,7 +634,7 @@ namespace cv // Fill the plane coefficients if (plane_coefficients.empty()) return; - plane_coefficients_out.create(plane_coefficients.size(), 1, CV_32FC4); + plane_coefficients_out.create((int)plane_coefficients.size(), 1, CV_32FC4); cv::Mat plane_coefficients_mat = plane_coefficients_out.getMat(); float* data = plane_coefficients_mat.ptr(0); for(size_t i=0; iaddParam(obj, "transformType", obj.transformType); obj.info()->addParam(obj, "maxTranslation", obj.maxTranslation); obj.info()->addParam(obj, "maxRotation", obj.maxRotation); - obj.info()->addParam(obj, "normalsComputer", obj.normalsComputer, true);) + obj.info()->addParam(obj, "normalsComputer", obj.normalsComputer, true, NULL, NULL);) CV_INIT_ALGORITHM(RgbdICPOdometry, "RGBD.RgbdICPOdometry", obj.info()->addParam(obj, "cameraMatrix", obj.cameraMatrix); @@ -97,7 +97,7 @@ namespace cv obj.info()->addParam(obj, "transformType", obj.transformType); obj.info()->addParam(obj, "maxTranslation", obj.maxTranslation); obj.info()->addParam(obj, "maxRotation", obj.maxRotation); - obj.info()->addParam(obj, "normalsComputer", obj.normalsComputer, true);) + obj.info()->addParam(obj, "normalsComputer", obj.normalsComputer, true, NULL, NULL);) bool initModule_rgbd(void); diff --git a/modules/rgbd/src/utils.cpp b/modules/rgbd/src/utils.cpp index e2be065cd..97abf8e98 100644 --- a/modules/rgbd/src/utils.cpp +++ b/modules/rgbd/src/utils.cpp @@ -62,13 +62,13 @@ namespace cv if (in_depth == CV_16U) { in.convertTo(out, depth, 1 / 1000.0); //convert to float so that it is in meters - cv::Mat valid_mask = in == std::numeric_limits::min(); // Should we do std::numeric_limits::max() too ? + cv::Mat valid_mask = in == std::numeric_limits::min(); // Should we do std::numeric_limits::max() too ? out.setTo(std::numeric_limits::quiet_NaN(), valid_mask); //set a$ } if (in_depth == CV_16S) { in.convertTo(out, depth, 1 / 1000.0); //convert to float so tha$ - cv::Mat valid_mask = (in == std::numeric_limits::min()) | (in == std::numeric_limits::max()); // Should we do std::numeric_limits::max() too ? + cv::Mat valid_mask = (in == std::numeric_limits::min()) | (in == std::numeric_limits::max()); // Should we do std::numeric_limits::max() too ? out.setTo(std::numeric_limits::quiet_NaN(), valid_mask); //set a$ } if ((in_depth == CV_32F) || (in_depth == CV_64F)) diff --git a/modules/rgbd/test/test_normal.cpp b/modules/rgbd/test/test_normal.cpp index 2bf1f7f4f..c71a8bff4 100644 --- a/modules/rgbd/test/test_normal.cpp +++ b/modules/rgbd/test/test_normal.cpp @@ -65,7 +65,7 @@ rayPlaneIntersection(const cv::Vec3d& uv1, double centroid_dot_normal, const cv: std::cout << "warning, LdotNormal nearly 0! " << LdotNormal << std::endl; std::cout << "contents of L, Normal: " << cv::Mat(L) << ", " << cv::Mat(normal) << std::endl; } - cv::Vec3f xyz(d * L(0), d * L(1), d * L(2)); + cv::Vec3f xyz((float)(d * L(0)), (float)(d * L(1)), (float)(d * L(2))); return xyz; } @@ -99,7 +99,7 @@ struct Plane n[1] = rng.uniform(-0.5, 0.5); n[2] = -0.3; //rng.uniform(-1.f, 0.5f); n = n / cv::norm(n); - set_d(rng.uniform(-2.0, 0.6)); + set_d((float)rng.uniform(-2.0, 0.6)); } void @@ -146,11 +146,11 @@ gen_points_3d(std::vector& planes_out, cv::Mat_ &plane_mas { for (int u = 0; u < W; u++) { - unsigned int plane_index = (u / float(W)) * planes.size(); + unsigned int plane_index = (unsigned int)((u / float(W)) * planes.size()); Plane plane = planes[plane_index]; - outp(v, u) = plane.intersection(u, v, Kinv); + outp(v, u) = plane.intersection((float)u, (float)v, Kinv); outn(v, u) = plane.n; - plane_mask(v, u) = plane_index; + plane_mask(v, u) = (uchar)plane_index; } } planes_out = planes; @@ -210,6 +210,9 @@ protected: errors[1][0] = 0.02; errors[1][1] = 0.04; break; + default: + method = (cv::RgbdNormals::RGBD_NORMALS_METHOD)-1; + CV_Error(0, ""); } for (unsigned char j = 0; j < 2; ++j) diff --git a/modules/rgbd/test/test_odometry.cpp b/modules/rgbd/test/test_odometry.cpp index 8fd723a96..584459c99 100644 --- a/modules/rgbd/test/test_odometry.cpp +++ b/modules/rgbd/test/test_odometry.cpp @@ -192,7 +192,7 @@ bool CV_OdometryTest::readData(Mat& image, Mat& depth) const return false; } - CV_DbgAssert(gray.type() == CV_8UC1); + CV_DbgAssert(image.type() == CV_8UC1); CV_DbgAssert(depth.type() == CV_16UC1); { Mat depth_flt; diff --git a/modules/tracking/perf/perf_Tracker.cpp b/modules/tracking/perf/perf_Tracker.cpp index f0ae90726..30bfff078 100644 --- a/modules/tracking/perf/perf_Tracker.cpp +++ b/modules/tracking/perf/perf_Tracker.cpp @@ -124,12 +124,12 @@ void getSegment( int segmentId, int numSegments, int bbCounter, int& startFrame, void getMatOfRects( const vector& bbs, Mat& bbs_mat ) { - for ( size_t b = 0; b < bbs.size(); b++ ) + for ( int b = 0, size = (int)bbs.size(); b < size; b++ ) { - bbs_mat.at( b, 0 ) = bbs[b].x; - bbs_mat.at( b, 1 ) = bbs[b].y; - bbs_mat.at( b, 2 ) = bbs[b].width; - bbs_mat.at( b, 3 ) = bbs[b].height; + bbs_mat.at( b, 0 ) = (float)bbs[b].x; + bbs_mat.at( b, 1 ) = (float)bbs[b].y; + bbs_mat.at( b, 2 ) = (float)bbs[b].width; + bbs_mat.at( b, 3 ) = (float)bbs[b].height; } } @@ -149,7 +149,7 @@ PERF_TEST_P(tracking, mil, testing::Combine(TESTSET_NAMES, SEGMENTS)) string gtFile = getDataPath( TRACKING_DIR + "/" + video + "/gt.txt" ); if( !getGroundTruth( gtFile, gtBBs ) ) FAIL()<< "Ground truth file " << gtFile << " can not be read" << endl; - int bbCounter = gtBBs.size(); + int bbCounter = (int)gtBBs.size(); Mat frame; bool initialized = false; @@ -197,7 +197,7 @@ PERF_TEST_P(tracking, mil, testing::Combine(TESTSET_NAMES, SEGMENTS)) } } //save the bounding boxes in a Mat - Mat bbs_mat( bbs.size(), 4, CV_32F ); + Mat bbs_mat( (int)bbs.size(), 4, CV_32F ); getMatOfRects( bbs, bbs_mat ); SANITY_CHECK( bbs_mat, 15, ERROR_RELATIVE ); @@ -220,7 +220,7 @@ PERF_TEST_P(tracking, boosting, testing::Combine(TESTSET_NAMES, SEGMENTS)) string gtFile = getDataPath( TRACKING_DIR + "/" + video + "/gt.txt" ); if( !getGroundTruth( gtFile, gtBBs ) ) FAIL()<< "Ground truth file " << gtFile << " can not be read" << endl; - int bbCounter = gtBBs.size(); + int bbCounter = (int)gtBBs.size(); Mat frame; bool initialized = false; @@ -267,7 +267,7 @@ PERF_TEST_P(tracking, boosting, testing::Combine(TESTSET_NAMES, SEGMENTS)) } } //save the bounding boxes in a Mat - Mat bbs_mat( bbs.size(), 4, CV_32F ); + Mat bbs_mat( (int)bbs.size(), 4, CV_32F ); getMatOfRects( bbs, bbs_mat ); SANITY_CHECK( bbs_mat, 15, ERROR_RELATIVE ); diff --git a/modules/tracking/samples/tracker.cpp b/modules/tracking/samples/tracker.cpp index f1ef85770..725a87233 100644 --- a/modules/tracking/samples/tracker.cpp +++ b/modules/tracking/samples/tracker.cpp @@ -58,7 +58,7 @@ static void onMouse( int event, int x, int y, int, void* ) //draw the bounding box Mat currentFrame; image.copyTo( currentFrame ); - rectangle( currentFrame, Point( boundingBox.x, boundingBox.y ), Point( x, y ), Scalar( 255, 0, 0 ), 2, 1 ); + rectangle( currentFrame, Point( (int)boundingBox.x, (int)boundingBox.y ), Point( x, y ), Scalar( 255, 0, 0 ), 2, 1 ); imshow( "Tracking API", currentFrame ); } break; @@ -82,18 +82,23 @@ int main( int argc, char** argv ) int coords[4]={0,0,0,0}; bool initFrameWasGivenInCommandLine=false; - do{ + + do + { String initBoundingBox=parser.get(3); - for(size_t pos=0,ctr=0;ctr<4;ctr++){ + for(size_t pos=0,ctr=0;ctr<4;ctr++) + { size_t npos=initBoundingBox.find_first_of(',',pos); - if(npos==string::npos && ctr<3){ + if(npos==string::npos && ctr<3) + { printf("bounding box should be given in format \"x1,y1,x2,y2\",where x's and y's are integer cordinates of opposed corners of bdd box\n"); printf("got: %s\n",initBoundingBox.substr(pos,string::npos).c_str()); printf("manual selection of bounding box will be employed\n"); break; } int num=atoi(initBoundingBox.substr(pos,(ctr==3)?(string::npos):(npos-pos)).c_str()); - if(num<=0){ + if(num<=0) + { printf("bounding box should be given in format \"x1,y1,x2,y2\",where x's and y's are integer cordinates of opposed corners of bdd box\n"); printf("got: %s\n",initBoundingBox.substr(pos,npos-pos).c_str()); printf("manual selection of bounding box will be employed\n"); @@ -102,10 +107,9 @@ int main( int argc, char** argv ) coords[ctr]=num; pos=npos+1; } - if(coords[0]>0 && coords[1]>0 && coords[2]>0 && coords[3]>0){ + if(coords[0]>0 && coords[1]>0 && coords[2]>0 && coords[3]>0) initFrameWasGivenInCommandLine=true; - } - }while(0); + } while((void)0, 0); //open the capture VideoCapture cap; diff --git a/modules/tracking/src/PFSolver.hpp b/modules/tracking/src/PFSolver.hpp index 89f2dd9d7..d36cce998 100644 --- a/modules/tracking/src/PFSolver.hpp +++ b/modules/tracking/src/PFSolver.hpp @@ -106,7 +106,7 @@ namespace cv{ //Mat_ maxrow=_particles.row(std::max_element(_logweight.begin(),_logweight.end())-_logweight.begin()); double max_element; minMaxLoc(_logweight, 0, &max_element); - Mat_ maxrow=_particles.row(max_element); + Mat_ maxrow=_particles.row((int)max_element); for(;num_particles HShist, Vhist; }; TrackingHistogram _origHist; + + const TrackingFunctionPF & operator = (const TrackingFunctionPF &); }; TrackingFunctionPF::TrackingHistogram::TrackingHistogram(const Mat& img,int nh,int ns,int nv){ diff --git a/modules/tracking/src/feature.cpp b/modules/tracking/src/feature.cpp index 64995a640..b5afe8123 100644 --- a/modules/tracking/src/feature.cpp +++ b/modules/tracking/src/feature.cpp @@ -686,7 +686,7 @@ void CvHaarEvaluator::FeatureHaar::generateRandomFeature( Size patchSize ) valid = true; } else - CV_Assert( false ); + CV_Error(CV_StsAssert, ""); } m_initSize = patchSize; @@ -742,14 +742,14 @@ float CvHaarEvaluator::FeatureHaar::getSum( const Mat& image, Rect imageROI ) co int depth = image.depth(); if( depth == CV_8U || depth == CV_32S ) - value = image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) - image.at( OriginY, OriginX + Width ) - - image.at( OriginY + Height, OriginX ); + value = static_cast(image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) - image.at( OriginY, OriginX + Width ) + - image.at( OriginY + Height, OriginX )); else if( depth == CV_64F ) - value = image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) - - image.at( OriginY, OriginX + Width ) - image.at( OriginY + Height, OriginX ); + value = static_cast(image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) + - image.at( OriginY, OriginX + Width ) - image.at( OriginY + Height, OriginX )); else if( depth == CV_32F ) - value = image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) - image.at( OriginY, OriginX + Width ) - - image.at( OriginY + Height, OriginX ); + value = static_cast(image.at( OriginY + Height, OriginX + Width ) + image.at( OriginY, OriginX ) - image.at( OriginY, OriginX + Width ) + - image.at( OriginY + Height, OriginX )); return value; } diff --git a/modules/tracking/src/onlineBoosting.cpp b/modules/tracking/src/onlineBoosting.cpp index b1b185168..874d53d11 100644 --- a/modules/tracking/src/onlineBoosting.cpp +++ b/modules/tracking/src/onlineBoosting.cpp @@ -287,7 +287,7 @@ void BaseClassifier::trainClassifier( const Mat& image, int target, float import double A = 1; int K = 0; int K_max = 10; - while ( 1 ) + for ( ; ; ) { double U_k = (double) rand() / RAND_MAX; A *= U_k; @@ -572,7 +572,7 @@ void Detector::prepareDetectionsMemory( int numDetections ) void Detector::classifySmooth( const std::vector& images, float minMargin ) { - int numPatches = images.size(); + int numPatches = static_cast(images.size()); prepareConfidencesMemory( numPatches ); diff --git a/modules/tracking/src/onlineMIL.cpp b/modules/tracking/src/onlineMIL.cpp index 9b8532b25..4fcfb548f 100644 --- a/modules/tracking/src/onlineMIL.cpp +++ b/modules/tracking/src/onlineMIL.cpp @@ -99,7 +99,7 @@ ClfMilBoost::Params::Params() { _numSel = 50; _numFeat = 250; - _lRate = 0.85; + _lRate = 0.85f; } ClfMilBoost::ClfMilBoost() diff --git a/modules/tracking/src/trackerBoosting.cpp b/modules/tracking/src/trackerBoosting.cpp index b356617b5..9b8bcc4ca 100644 --- a/modules/tracking/src/trackerBoosting.cpp +++ b/modules/tracking/src/trackerBoosting.cpp @@ -56,7 +56,7 @@ TrackerBoosting::Params::Params() { numClassifiers = 100; samplerOverlap = 0.99f; - samplerSearchFactor = 1.8; + samplerSearchFactor = 1.8f; iterationInit = 50; featureSetNumFeatures = ( numClassifiers * 10 ) + iterationInit; } @@ -141,7 +141,7 @@ bool TrackerBoosting::initImpl( const Mat& image, const Rect2d& boundingBox ) TrackerFeatureHAAR::Params HAARparameters; HAARparameters.numFeatures = params.featureSetNumFeatures; HAARparameters.isIntegral = true; - HAARparameters.rectSize = Size( boundingBox.width, boundingBox.height ); + HAARparameters.rectSize = Size( static_cast(boundingBox.width), static_cast(boundingBox.height) ); Ptr trackerFeature = Ptr( new TrackerFeatureHAAR( HAARparameters ) ); if( !featureSet->addTrackerFeature( trackerFeature ) ) return false; @@ -155,7 +155,7 @@ bool TrackerBoosting::initImpl( const Mat& image, const Rect2d& boundingBox ) model = Ptr( new TrackerBoostingModel( boundingBox ) ); Ptr stateEstimator = Ptr( new TrackerStateEstimatorAdaBoosting( params.numClassifiers, params.iterationInit, params.featureSetNumFeatures, - Size( boundingBox.width, boundingBox.height ), ROI ) ); + Size( static_cast(boundingBox.width), static_cast(boundingBox.height) ), ROI ) ); model->setTrackerStateEstimator( stateEstimator ); //Run model estimation and update for iterationInit iterations @@ -163,9 +163,9 @@ bool TrackerBoosting::initImpl( const Mat& image, const Rect2d& boundingBox ) { //compute temp features TrackerFeatureHAAR::Params HAARparameters2; - HAARparameters2.numFeatures = ( posSamples.size() + negSamples.size() ); + HAARparameters2.numFeatures = static_cast( posSamples.size() + negSamples.size() ); HAARparameters2.isIntegral = true; - HAARparameters2.rectSize = Size( boundingBox.width, boundingBox.height ); + HAARparameters2.rectSize = Size( static_cast(boundingBox.width), static_cast(boundingBox.height) ); Ptr trackerFeature2 = Ptr( new TrackerFeatureHAAR( HAARparameters2 ) ); model.staticCast()->setMode( TrackerBoostingModel::MODE_NEGATIVE, negSamples ); @@ -182,7 +182,7 @@ bool TrackerBoosting::initImpl( const Mat& image, const Rect2d& boundingBox ) if( replacedClassifier[j] != -1 && swappedClassified[j] != -1 ) { trackerFeature.staticCast()->swapFeature( replacedClassifier[j], swappedClassified[j] ); - trackerFeature.staticCast()->swapFeature( swappedClassified[j], trackerFeature2->getFeatureAt( j ) ); + trackerFeature.staticCast()->swapFeature( swappedClassified[j], trackerFeature2->getFeatureAt( (int)j ) ); } } } @@ -199,7 +199,7 @@ bool TrackerBoosting::updateImpl( const Mat& image, Rect2d& boundingBox ) integral( image_, intImage, intSqImage, CV_32S ); //get the last location [AAM] X(k-1) Ptr lastLocation = model->getLastTargetState(); - Rect lastBoundingBox( lastLocation->getTargetPosition().x, lastLocation->getTargetPosition().y, lastLocation->getTargetWidth(), + Rect lastBoundingBox( (int)lastLocation->getTargetPosition().x, (int)lastLocation->getTargetPosition().y, lastLocation->getTargetWidth(), lastLocation->getTargetHeight() ); //sampling new frame based on last location @@ -244,7 +244,7 @@ bool TrackerBoosting::updateImpl( const Mat& image, Rect2d& boundingBox ) } Ptr currentState = model->getLastTargetState(); - boundingBox = Rect( currentState->getTargetPosition().x, currentState->getTargetPosition().y, currentState->getTargetWidth(), + boundingBox = Rect( (int)currentState->getTargetPosition().x, (int)currentState->getTargetPosition().y, currentState->getTargetWidth(), currentState->getTargetHeight() ); /*//TODO debug @@ -276,9 +276,9 @@ bool TrackerBoosting::updateImpl( const Mat& image, Rect2d& boundingBox ) //compute temp features TrackerFeatureHAAR::Params HAARparameters2; - HAARparameters2.numFeatures = ( posSamples.size() + negSamples.size() ); + HAARparameters2.numFeatures = static_cast( posSamples.size() + negSamples.size() ); HAARparameters2.isIntegral = true; - HAARparameters2.rectSize = Size( boundingBox.width, boundingBox.height ); + HAARparameters2.rectSize = Size( static_cast(boundingBox.width), static_cast(boundingBox.height) ); Ptr trackerFeature2 = Ptr( new TrackerFeatureHAAR( HAARparameters2 ) ); //model estimate @@ -299,7 +299,7 @@ bool TrackerBoosting::updateImpl( const Mat& image, Rect2d& boundingBox ) { featureSet->getTrackerFeature().at( 0 ).second.staticCast()->swapFeature( replacedClassifier[j], swappedClassified[j] ); featureSet->getTrackerFeature().at( 0 ).second.staticCast()->swapFeature( swappedClassified[j], - trackerFeature2->getFeatureAt( j ) ); + trackerFeature2->getFeatureAt( (int)j ) ); } } diff --git a/modules/tracking/src/trackerBoostingModel.cpp b/modules/tracking/src/trackerBoostingModel.cpp index ead4cb15e..78b5cef68 100644 --- a/modules/tracking/src/trackerBoostingModel.cpp +++ b/modules/tracking/src/trackerBoostingModel.cpp @@ -55,7 +55,7 @@ TrackerBoostingModel::TrackerBoostingModel( const Rect& boundingBox ) Ptr initState = Ptr( - new TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState( Point2f( boundingBox.x, boundingBox.y ), boundingBox.width, + new TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState( Point2f( (float)boundingBox.x, (float)boundingBox.y ), boundingBox.width, boundingBox.height, true, Mat() ) ); trajectory.push_back( initState ); maxCMLength = 10; @@ -98,7 +98,7 @@ void TrackerBoostingModel::responseToConfidenceMap( const std::vector& resp Size currentSize; Point currentOfs; currentSample.at( i ).locateROI( currentSize, currentOfs ); - bool foreground; + bool foreground = false; if( mode == MODE_POSITIVE || mode == MODE_CLASSIFY ) { foreground = true; @@ -107,7 +107,7 @@ void TrackerBoostingModel::responseToConfidenceMap( const std::vector& resp { foreground = false; } - const Mat resp = responses[0].col( i ); + const Mat resp = responses[0].col( (int)i ); //create the state Ptr currentState = Ptr< @@ -115,7 +115,7 @@ void TrackerBoostingModel::responseToConfidenceMap( const std::vector& resp new TrackerStateEstimatorAdaBoosting::TrackerAdaBoostingTargetState( currentOfs, currentSample.at( i ).cols, currentSample.at( i ).rows, foreground, resp ) ); - confidenceMap.push_back( std::make_pair( currentState, 0 ) ); + confidenceMap.push_back( std::make_pair( currentState, 0.0f ) ); } } diff --git a/modules/tracking/src/trackerFeature.cpp b/modules/tracking/src/trackerFeature.cpp index c17e4c733..c39312037 100644 --- a/modules/tracking/src/trackerFeature.cpp +++ b/modules/tracking/src/trackerFeature.cpp @@ -203,10 +203,10 @@ bool TrackerFeatureHAAR::extractSelected( const std::vector selFeatures, co } int numFeatures = featureEvaluator->getNumFeatures(); - int numSelFeatures = selFeatures.size(); + int numSelFeatures = (int)selFeatures.size(); //response = Mat_( Size( images.size(), numFeatures ) ); - response.create( Size( images.size(), numFeatures ), CV_32F ); + response.create( Size( (int)images.size(), numFeatures ), CV_32F ); response.setTo( 0 ); //double t = getTickCount(); @@ -222,7 +222,7 @@ bool TrackerFeatureHAAR::extractSelected( const std::vector selFeatures, co CvHaarEvaluator::FeatureHaar& feature = featureEvaluator->getFeatures( selFeatures[j] ); feature.eval( images[i], Rect( 0, 0, c, r ), &res ); //( Mat_( response ) )( j, i ) = res; - response.at( selFeatures[j], i ) = res; + response.at( selFeatures[j], (int)i ) = res; } } //t = ( (double) getTickCount() - t ) / getTickFrequency(); @@ -273,11 +273,11 @@ bool TrackerFeatureHAAR::computeImpl( const std::vector& images, Mat& respo int numFeatures = featureEvaluator->getNumFeatures(); - response = Mat_( Size( images.size(), numFeatures ) ); + response = Mat_( Size( (int)images.size(), numFeatures ) ); std::vector f = featureEvaluator->getFeatures(); //for each sample compute #n_feature -> put each feature (n Rect) in response - parallel_for_( Range( 0, images.size() ), Parallel_compute( featureEvaluator, images, response ) ); + parallel_for_( Range( 0, (int)images.size() ), Parallel_compute( featureEvaluator, images, response ) ); /*for ( size_t i = 0; i < images.size(); i++ ) { diff --git a/modules/tracking/src/trackerMIL.cpp b/modules/tracking/src/trackerMIL.cpp index fa06ee15f..725b65c0d 100644 --- a/modules/tracking/src/trackerMIL.cpp +++ b/modules/tracking/src/trackerMIL.cpp @@ -158,7 +158,7 @@ bool TrackerMIL::initImpl( const Mat& image, const Rect2d& boundingBox ) //compute HAAR features TrackerFeatureHAAR::Params HAARparameters; HAARparameters.numFeatures = params.featureSetNumFeatures; - HAARparameters.rectSize = Size( boundingBox.width, boundingBox.height ); + HAARparameters.rectSize = Size( (int)boundingBox.width, (int)boundingBox.height ); HAARparameters.isIntegral = true; Ptr trackerFeature = Ptr( new TrackerFeatureHAAR( HAARparameters ) ); featureSet->addTrackerFeature( trackerFeature ); @@ -191,7 +191,7 @@ bool TrackerMIL::updateImpl( const Mat& image, Rect2d& boundingBox ) //get the last location [AAM] X(k-1) Ptr lastLocation = model->getLastTargetState(); - Rect lastBoundingBox( lastLocation->getTargetPosition().x, lastLocation->getTargetPosition().y, lastLocation->getTargetWidth(), + Rect lastBoundingBox( (int)lastLocation->getTargetPosition().x, (int)lastLocation->getTargetPosition().y, lastLocation->getTargetWidth(), lastLocation->getTargetHeight() ); //sampling new frame based on last location @@ -229,7 +229,7 @@ bool TrackerMIL::updateImpl( const Mat& image, Rect2d& boundingBox ) } Ptr currentState = model->getLastTargetState(); - boundingBox = Rect( currentState->getTargetPosition().x, currentState->getTargetPosition().y, currentState->getTargetWidth(), + boundingBox = Rect( (int)currentState->getTargetPosition().x, (int)currentState->getTargetPosition().y, currentState->getTargetWidth(), currentState->getTargetHeight() ); /*//TODO debug diff --git a/modules/tracking/src/trackerMILModel.cpp b/modules/tracking/src/trackerMILModel.cpp index b4cd2211d..26232f705 100644 --- a/modules/tracking/src/trackerMILModel.cpp +++ b/modules/tracking/src/trackerMILModel.cpp @@ -57,7 +57,7 @@ TrackerMILModel::TrackerMILModel( const Rect& boundingBox ) height = boundingBox.height; Ptr initState = Ptr( - new TrackerStateEstimatorMILBoosting::TrackerMILTargetState( Point2f( boundingBox.x, boundingBox.y ), boundingBox.width, boundingBox.height, + new TrackerStateEstimatorMILBoosting::TrackerMILTargetState( Point2f( (float)boundingBox.x, (float)boundingBox.y ), boundingBox.width, boundingBox.height, true, Mat() ) ); trajectory.push_back( initState ); } @@ -97,7 +97,7 @@ void TrackerMILModel::responseToConfidenceMap( const std::vector& responses Ptr currentState = Ptr( new TrackerStateEstimatorMILBoosting::TrackerMILTargetState( currentOfs, width, height, foreground, singleResponse ) ); - confidenceMap.push_back( std::make_pair( currentState, 0 ) ); + confidenceMap.push_back( std::make_pair( currentState, 0.0f ) ); } diff --git a/modules/tracking/src/trackerStateEstimator.cpp b/modules/tracking/src/trackerStateEstimator.cpp index 3d1f505b9..3ae27cb77 100644 --- a/modules/tracking/src/trackerStateEstimator.cpp +++ b/modules/tracking/src/trackerStateEstimator.cpp @@ -394,7 +394,7 @@ void TrackerStateEstimatorAdaBoosting::updateImpl( std::vector& c swappedClassifier[i] = -1; } - int mapPosition = i + lastConfidenceMap.size() / 2; + int mapPosition = (int)(i + lastConfidenceMap.size() / 2); Ptr currentTargetState2 = lastConfidenceMap.at( mapPosition ).first.staticCast(); currentFg = 1; diff --git a/modules/tracking/test/test_trackerOPE.cpp b/modules/tracking/test/test_trackerOPE.cpp index 28da5c484..66c60a05a 100644 --- a/modules/tracking/test/test_trackerOPE.cpp +++ b/modules/tracking/test/test_trackerOPE.cpp @@ -138,15 +138,15 @@ std::vector TrackerOPETest::splitString( std::string s, std::string float TrackerOPETest::calcDistance( Rect a, Rect b ) { - Point2f p_a( a.x + a.width / 2, a.y + a.height / 2 ); - Point2f p_b( b.x + b.width / 2, b.y + b.height / 2 ); + Point2f p_a( (float)(a.x + a.width / 2), (float)(a.y + a.height / 2) ); + Point2f p_b( (float)(b.x + b.width / 2), (float)(b.y + b.height / 2) ); return sqrt( pow( p_a.x - p_b.x, 2 ) + pow( p_a.y - p_b.y, 2 ) ); } float TrackerOPETest::calcOverlap( Rect a, Rect b ) { - float aArea = a.width * a.height; - float bArea = b.width * b.height; + float aArea = (float)(a.width * a.height); + float bArea = (float)(b.width * b.height); if( aArea < bArea ) { @@ -165,8 +165,8 @@ float TrackerOPETest::calcOverlap( Rect a, Rect b ) Rect rectIntersection = a & b; Rect rectUnion = a | b; - float iArea = rectIntersection.width * rectIntersection.height; - float uArea = rectUnion.width * rectUnion.height; + float iArea = (float)(rectIntersection.width * rectIntersection.height); + float uArea = (float)(rectUnion.width * rectUnion.height); float overlap = iArea / uArea; return overlap; } diff --git a/modules/tracking/test/test_trackerSRE.cpp b/modules/tracking/test/test_trackerSRE.cpp index d2b893d89..a5fa5c7e2 100644 --- a/modules/tracking/test/test_trackerSRE.cpp +++ b/modules/tracking/test/test_trackerSRE.cpp @@ -142,15 +142,15 @@ std::vector TrackerSRETest::splitString( std::string s, std::string float TrackerSRETest::calcDistance( Rect a, Rect b ) { - Point2f p_a( a.x + a.width / 2, a.y + a.height / 2 ); - Point2f p_b( b.x + b.width / 2, b.y + b.height / 2 ); + Point2f p_a( (float)(a.x + a.width / 2), (float)(a.y + a.height / 2) ); + Point2f p_b( (float)(b.x + b.width / 2), (float)(b.y + b.height / 2) ); return sqrt( pow( p_a.x - p_b.x, 2 ) + pow( p_a.y - p_b.y, 2 ) ); } float TrackerSRETest::calcOverlap( Rect a, Rect b ) { - float aArea = a.width * a.height; - float bArea = b.width * b.height; + float aArea = (float)(a.width * a.height); + float bArea = (float)(b.width * b.height); if( aArea < bArea ) { @@ -169,8 +169,8 @@ float TrackerSRETest::calcOverlap( Rect a, Rect b ) Rect rectIntersection = a & b; Rect rectUnion = a | b; - float iArea = rectIntersection.width * rectIntersection.height; - float uArea = rectUnion.width * rectUnion.height; + float iArea = (float)(rectIntersection.width * rectIntersection.height); + float uArea = (float)(rectUnion.width * rectUnion.height); float overlap = iArea / uArea; return overlap; } @@ -327,81 +327,81 @@ void TrackerSRETest::checkDataTest() { case 1: //center shift left - bb.x = bb.x - ceil( 0.1 * bb.width ); + bb.x = bb.x - (int)ceil( 0.1 * bb.width ); break; case 2: //center shift right - bb.x = bb.x + ceil( 0.1 * bb.width ); + bb.x = bb.x + (int)ceil( 0.1 * bb.width ); break; case 3: //center shift up - bb.y = bb.y - ceil( 0.1 * bb.height ); + bb.y = bb.y - (int)ceil( 0.1 * bb.height ); break; case 4: //center shift down - bb.y = bb.y + ceil( 0.1 * bb.height ); + bb.y = bb.y + (int)ceil( 0.1 * bb.height ); break; case 5: //corner shift top-left - bb.x = round( bb.x - ( 0.1 * bb.width ) ); - bb.y = round( bb.y - ( 0.1 * bb.height ) ); + bb.x = (int)round( bb.x - 0.1 * bb.width ); + bb.y = (int)round( bb.y - 0.1 * bb.height ); bb.width = xLimit - bb.x + 1; bb.height = yLimit - bb.y + 1; break; case 6: //corner shift top-right - xLimit = round( xLimit + 0.1 * bb.width ); + xLimit = (int)round( xLimit + 0.1 * bb.width ); - bb.y = round( bb.y - ( 0.1 * bb.height ) ); + bb.y = (int)round( bb.y - 0.1 * bb.height ); bb.width = xLimit - bb.x + 1; bb.height = yLimit - bb.y + 1; break; case 7: //corner shift bottom-left - bb.x = round( bb.x - ( 0.1 * bb.width ) ); - yLimit = round( yLimit + 0.1 * bb.height ); + bb.x = (int)round( bb.x - 0.1 * bb.width ); + yLimit = (int)round( yLimit + 0.1 * bb.height ); bb.width = xLimit - bb.x + 1; bb.height = yLimit - bb.y + 1; break; case 8: //corner shift bottom-right - xLimit = round( xLimit + 0.1 * bb.width ); - yLimit = round( yLimit + 0.1 * bb.height ); + xLimit = (int)round( xLimit + 0.1 * bb.width ); + yLimit = (int)round( yLimit + 0.1 * bb.height ); bb.width = xLimit - bb.x + 1; bb.height = yLimit - bb.y + 1; break; case 9: //scale 0.8 - ratio = 0.8; - w = ratio * bb.width; - h = ratio * bb.height; + ratio = 0.8f; + w = (int)(ratio * bb.width); + h = (int)(ratio * bb.height); bb = Rect( center.x - ( w / 2 ), center.y - ( h / 2 ), w, h ); break; case 10: //scale 0.9 - ratio = 0.9; - w = ratio * bb.width; - h = ratio * bb.height; + ratio = 0.9f; + w = (int)(ratio * bb.width); + h = (int)(ratio * bb.height); bb = Rect( center.x - ( w / 2 ), center.y - ( h / 2 ), w, h ); break; case 11: //scale 1.1 - ratio = 1.1; - w = ratio * bb.width; - h = ratio * bb.height; + ratio = 1.1f; + w = (int)(ratio * bb.width); + h = (int)(ratio * bb.height); bb = Rect( center.x - ( w / 2 ), center.y - ( h / 2 ), w, h ); break; case 12: //scale 1.2 - ratio = 1.2; - w = ratio * bb.width; - h = ratio * bb.height; + ratio = 1.2f; + w = (int)(ratio * bb.width); + h = (int)(ratio * bb.height); bb = Rect( center.x - ( w / 2 ), center.y - ( h / 2 ), w, h ); break; diff --git a/modules/tracking/test/test_trackerTRE.cpp b/modules/tracking/test/test_trackerTRE.cpp index 072eb5bb7..167e3c75c 100644 --- a/modules/tracking/test/test_trackerTRE.cpp +++ b/modules/tracking/test/test_trackerTRE.cpp @@ -150,15 +150,15 @@ std::vector TrackerTRETest::splitString( std::string s, std::string float TrackerTRETest::calcDistance( Rect a, Rect b ) { - Point2f p_a( a.x + a.width / 2, a.y + a.height / 2 ); - Point2f p_b( b.x + b.width / 2, b.y + b.height / 2 ); + Point2f p_a( (float)(a.x + a.width / 2), (float)(a.y + a.height / 2) ); + Point2f p_b( (float)(b.x + b.width / 2), (float)(b.y + b.height / 2) ); return sqrt( pow( p_a.x - p_b.x, 2 ) + pow( p_a.y - p_b.y, 2 ) ); } float TrackerTRETest::calcOverlap( Rect a, Rect b ) { - float aArea = a.width * a.height; - float bArea = b.width * b.height; + float aArea = (float)(a.width * a.height); + float bArea = (float)(b.width * b.height); if( aArea < bArea ) { @@ -177,8 +177,8 @@ float TrackerTRETest::calcOverlap( Rect a, Rect b ) Rect rectIntersection = a & b; Rect rectUnion = a | b; - float iArea = rectIntersection.width * rectIntersection.height; - float uArea = rectUnion.width * rectUnion.height; + float iArea = (float)(rectIntersection.width * rectIntersection.height); + float uArea = (float)(rectUnion.width * rectUnion.height); float overlap = iArea / uArea; return overlap; } @@ -361,7 +361,7 @@ void TrackerTRETest::checkDataTest() gtStartFrame = startFrame; //compute the start and the and for each segment int segmentLength = sizeof ( SEGMENTS)/sizeof(int); - int numFrame = validSequence.size() / segmentLength; + int numFrame = (int)(validSequence.size() / segmentLength); startFrame += ( segmentIdx - 1 ) * numFrame; endFrame = startFrame + numFrame; @@ -389,8 +389,7 @@ void TrackerTRETest::checkDataTest() gt2.close(); if( segmentIdx == ( sizeof ( SEGMENTS)/sizeof(int) ) ) - endFrame = bbs.size(); - + endFrame = (int)bbs.size(); } void TrackerTRETest::run()