build: fix/eliminate MSVC warnings

pull/22940/head
Alexander Alekhin 2 years ago
parent 281b790618
commit be326ff752
  1. 4
      modules/calib3d/test/test_cameracalibration.cpp
  2. 8
      modules/calib3d/test/test_fisheye.cpp
  3. 9
      modules/core/include/opencv2/core/types.hpp
  4. 2
      modules/core/test/test_intrin_utils.hpp
  5. 7
      modules/gapi/include/opencv2/gapi/ocl/goclkernel.hpp
  6. 1
      modules/gapi/src/streaming/onevpl/default.cpp
  7. 10
      modules/objdetect/src/qrcode.cpp
  8. 8
      modules/video/src/tracking/tracker_nano.cpp

@ -1793,8 +1793,8 @@ double CV_StereoCalibrationTest_CPP::calibrateStereoCamera( const vector<vector<
for (size_t i = 0; i < numImgs; i++)
{
perViewErrors1[i] = perViewErrorsMat.at<double>(i, 0);
perViewErrors2[i] = perViewErrorsMat.at<double>(i, 1);
perViewErrors1[i] = perViewErrorsMat.at<double>((int)i, 0);
perViewErrors2[i] = perViewErrorsMat.at<double>((int)i, 1);
}
if (rotationMatrices.size() != numImgs)

@ -906,7 +906,7 @@ TEST_F(fisheyeTest, stereoCalibrateWithPerViewTransformations)
std::vector<cv::Point2d> reprojectedImgPts[2] = {std::vector<cv::Point2d>(n_images), std::vector<cv::Point2d>(n_images)};
size_t totalPoints = 0;
float totalMSError[2] = { 0, 0 }, viewMSError[2];
double totalMSError[2] = { 0, 0 };
for( size_t i = 0; i < n_images; i++ )
{
cv::Matx33d viewRotMat1, viewRotMat2;
@ -929,8 +929,10 @@ TEST_F(fisheyeTest, stereoCalibrateWithPerViewTransformations)
cv::fisheye::projectPoints(objectPoints[i], reprojectedImgPts[0], viewRotVec1, viewT1, K1, D1, alpha1);
cv::fisheye::projectPoints(objectPoints[i], reprojectedImgPts[1], viewRotVec2, viewT2, K2, D2, alpha2);
viewMSError[0] = cv::norm(leftPoints[i], reprojectedImgPts[0], cv::NORM_L2SQR);
viewMSError[1] = cv::norm(rightPoints[i], reprojectedImgPts[1], cv::NORM_L2SQR);
double viewMSError[2] = {
cv::norm(leftPoints[i], reprojectedImgPts[0], cv::NORM_L2SQR),
cv::norm(rightPoints[i], reprojectedImgPts[1], cv::NORM_L2SQR)
};
size_t n = objectPoints[i].size();
totalMSError[0] += viewMSError[0];

@ -57,6 +57,11 @@
#include "opencv2/core/cvstd.hpp"
#include "opencv2/core/matx.hpp"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4459) // declaration of '...' hides global declaration
#endif
namespace cv
{
@ -2445,4 +2450,8 @@ TermCriteria::TermCriteria(int _type, int _maxCount, double _epsilon)
} // cv
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif //OPENCV_CORE_TYPES_HPP

@ -1081,7 +1081,7 @@ template<typename R> struct TheTest
typedef typename VTraits<uint_reg>::lane_type uint_type;
Data<R> dataA, dataB(0), dataC, dataD(1), dataE(2);
dataA[0] = std::numeric_limits<int_type>::max();
dataA[0] = (LaneType)std::numeric_limits<int_type>::max();
dataA[1] *= (LaneType)-1;
union
{

@ -153,6 +153,10 @@ struct tracked_cv_umat{
}
};
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4702) // unreachable code
#endif
template<typename... Outputs>
void postprocess_ocl(Outputs&... outs)
{
@ -166,6 +170,9 @@ void postprocess_ocl(Outputs&... outs)
int dummy[] = { 0, (validate(&outs), 0)... };
cv::util::suppress_unused_warning(dummy);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
template<class T> struct ocl_get_out;
template<> struct ocl_get_out<cv::GMat>

@ -41,7 +41,6 @@ namespace onevpl {
std::shared_ptr<IDeviceSelector> getDefaultDeviceSelector(const std::vector<CfgParam>&) {
std::cerr << "Cannot utilize getDefaultVPLDeviceAndCtx without HAVE_ONEVPL enabled" << std::endl;
util::throw_error(std::logic_error("Cannot utilize getDefaultVPLDeviceAndCtx without HAVE_ONEVPL enabled"));
return nullptr;
}
} // namespace onevpl

@ -2294,8 +2294,8 @@ static inline std::pair<int, int> matchPatternPoints(const vector<Point> &finder
const float tmp = normL2Sqr<float>(Point2f(finderPattern[i]) - cornerPointsQR[j]);
if (tmp < distanceToOrig) {
distanceToOrig = tmp;
closestFinderPatternV = i;
closetOriginalV = j;
closestFinderPatternV = (int)i;
closetOriginalV = (int)j;
}
}
}
@ -2550,15 +2550,15 @@ bool QRDecode::versionDefinition()
if (useCode) {
CV_LOG_INFO(NULL, "Version type: useCode");
version = versionByCode;
version = (uint8_t)versionByCode;
}
else if (useFinderPattern ) {
CV_LOG_INFO(NULL, "Version type: useFinderPattern");
version = cvRound(versionByFinderPattern);
version = (uint8_t)cvRound(versionByFinderPattern);
}
else {
CV_LOG_INFO(NULL, "Version type: useTransition");
version = versionByTransition;
version = (uint8_t)versionByTransition;
}
version_size = 21 + (version - 1) * 4;
if ( !(0 < version && version <= 40) ) { return false; }

@ -148,7 +148,7 @@ void TrackerNanoImpl::generateGrids()
for (int i = 0; i < sz; i++)
{
x1Vec[i] = i - sz2;
x1Vec[i] = (float)(i - sz2);
}
Mat x1M(1, sz, CV_32FC1, x1Vec.data());
@ -202,9 +202,9 @@ void TrackerNanoImpl::getSubwindow(Mat& dstCrop, Mat& srcImg, int originalSz, in
Size imgSz = srcImg.size();
int c = (originalSz + 1) / 2;
int context_xmin = targetPos[0] - c;
int context_xmin = (int)(targetPos[0]) - c;
int context_xmax = context_xmin + originalSz - 1;
int context_ymin = targetPos[1] - c;
int context_ymin = (int)(targetPos[1]) - c;
int context_ymax = context_ymin + originalSz - 1;
int left_pad = std::max(0, -context_xmin);
@ -236,7 +236,7 @@ void TrackerNanoImpl::getSubwindow(Mat& dstCrop, Mat& srcImg, int originalSz, in
bool TrackerNanoImpl::update(InputArray image_, Rect &boundingBoxRes)
{
image = image_.getMat().clone();
int targetSzSum = targetSz[0] + targetSz[1];
int targetSzSum = (int)(targetSz[0] + targetSz[1]);
float wc = targetSz[0] + trackState.contextAmount * targetSzSum;
float hc = targetSz[1] + trackState.contextAmount * targetSzSum;

Loading…
Cancel
Save