Merge pull request #23186 from savuor:warnings_3d

MSVC warnings fixed in 3d module
pull/23283/head
Alexander Smorkalov 2 years ago committed by GitHub
commit 29dc07b1f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/3d/perf/perf_tsdf.cpp
  2. 22
      modules/3d/src/rgbd/odometry_functions.cpp
  3. 16
      modules/3d/src/rgbd/odometry_functions.hpp
  4. 2
      modules/3d/src/rgbd/volume_impl.cpp
  5. 6
      modules/3d/test/test_odometry.cpp
  6. 10
      modules/3d/test/test_tsdf.cpp

@ -535,7 +535,7 @@ protected:
TestBase::SetUp(); TestBase::SetUp();
auto p = GetParam(); auto p = GetParam();
gpu = std::get<0>(std::get<0>(p)); gpu = (std::get<0>(std::get<0>(p)) == PlatformType::GPU);
volumeType = std::get<1>(std::get<0>(p)); volumeType = std::get<1>(std::get<0>(p));
testSrcType = std::get<1>(p); testSrcType = std::get<1>(p);

@ -95,7 +95,7 @@ static void extendPyrMaskByPyrNormals(const std::vector<UMat>& pyramidNormals,
{ {
if (!pyramidNormals.empty()) if (!pyramidNormals.empty())
{ {
int nLevels = pyramidNormals.size(); int nLevels = (int)pyramidNormals.size();
for (int i = 0; i < nLevels; i++) for (int i = 0; i < nLevels; i++)
{ {
@ -130,7 +130,7 @@ static void buildPyramidCameraMatrix(const Matx33f& cameraMatrix, int levels, st
static void preparePyramidCloud(const std::vector<UMat>& pyramidDepth, const Matx33f& cameraMatrix, std::vector<UMat>& pyramidCloud) static void preparePyramidCloud(const std::vector<UMat>& pyramidDepth, const Matx33f& cameraMatrix, std::vector<UMat>& pyramidCloud)
{ {
int nLevels = pyramidDepth.size(); int nLevels = (int)pyramidDepth.size();
std::vector<Matx33f> pyramidCameraMatrix; std::vector<Matx33f> pyramidCameraMatrix;
buildPyramidCameraMatrix(cameraMatrix, nLevels, pyramidCameraMatrix); buildPyramidCameraMatrix(cameraMatrix, nLevels, pyramidCameraMatrix);
@ -150,7 +150,7 @@ static void preparePyramidTexturedMask(const std::vector<UMat>& pyramid_dI_dx, c
std::vector<float> minGradMagnitudes, const std::vector<UMat>& pyramidMask, double maxPointsPart, std::vector<float> minGradMagnitudes, const std::vector<UMat>& pyramidMask, double maxPointsPart,
std::vector<UMat>& pyramidTexturedMask, double sobelScale) std::vector<UMat>& pyramidTexturedMask, double sobelScale)
{ {
int nLevels = pyramid_dI_dx.size(); int nLevels = (int)pyramid_dI_dx.size();
const float sobelScale2_inv = (float)(1. / (sobelScale * sobelScale)); const float sobelScale2_inv = (float)(1. / (sobelScale * sobelScale));
pyramidTexturedMask.resize(nLevels, UMat()); pyramidTexturedMask.resize(nLevels, UMat());
@ -183,7 +183,7 @@ static void preparePyramidTexturedMask(const std::vector<UMat>& pyramid_dI_dx, c
static void preparePyramidNormals(const UMat &normals, const std::vector<UMat> &pyramidDepth, std::vector<UMat> &pyramidNormals) static void preparePyramidNormals(const UMat &normals, const std::vector<UMat> &pyramidDepth, std::vector<UMat> &pyramidNormals)
{ {
int nLevels = pyramidDepth.size(); int nLevels = (int)pyramidDepth.size();
buildPyramid(normals, pyramidNormals, nLevels - 1); buildPyramid(normals, pyramidNormals, nLevels - 1);
// renormalize normals // renormalize normals
@ -210,7 +210,7 @@ static void preparePyramidNormals(const UMat &normals, const std::vector<UMat> &
static void preparePyramidNormalsMask(const std::vector<UMat> &pyramidNormals, const std::vector<UMat> &pyramidMask, double maxPointsPart, static void preparePyramidNormalsMask(const std::vector<UMat> &pyramidNormals, const std::vector<UMat> &pyramidMask, double maxPointsPart,
std::vector<UMat> &pyramidNormalsMask) std::vector<UMat> &pyramidNormalsMask)
{ {
int nLevels = pyramidNormals.size(); int nLevels = (int)pyramidNormals.size();
pyramidNormalsMask.resize(nLevels, UMat()); pyramidNormalsMask.resize(nLevels, UMat());
for (int i = 0; i < nLevels; i++) for (int i = 0; i < nLevels; i++)
{ {
@ -328,7 +328,7 @@ static void prepareRGBFrameDst(OdometryFrame& frame, OdometrySettings settings)
std::vector<float> minGradientMagnitudes; std::vector<float> minGradientMagnitudes;
settings.getMinGradientMagnitudes(minGradientMagnitudes); settings.getMinGradientMagnitudes(minGradientMagnitudes);
int nLevels = ipyramids.size(); int nLevels = (int)ipyramids.size();
dxpyramids.resize(nLevels, UMat()); dxpyramids.resize(nLevels, UMat());
dypyramids.resize(nLevels, UMat()); dypyramids.resize(nLevels, UMat());
int sobelSize = settings.getSobelSize(); int sobelSize = settings.getSobelSize();
@ -375,7 +375,7 @@ static void prepareICPFrameBase(OdometryFrame& frame, OdometrySettings settings)
std::vector<int> iterCounts; std::vector<int> iterCounts;
settings.getIterCounts(iterCounts); settings.getIterCounts(iterCounts);
int maxLevel = iterCounts.size() - 1; int maxLevel = (int)iterCounts.size() - 1;
std::vector<UMat>& dpyramids = frame.impl->pyramids[OdometryFramePyramidType::PYR_DEPTH]; std::vector<UMat>& dpyramids = frame.impl->pyramids[OdometryFramePyramidType::PYR_DEPTH];
if (dpyramids.empty()) if (dpyramids.empty())
preparePyramidDepth(scaledDepth, dpyramids, maxLevel); preparePyramidDepth(scaledDepth, dpyramids, maxLevel);
@ -400,7 +400,7 @@ static void prepareICPFrameSrc(OdometryFrame& frame, OdometrySettings settings)
settings.getIterCounts(iterCounts); settings.getIterCounts(iterCounts);
std::vector<UMat>& mpyramids = frame.impl->pyramids[OdometryFramePyramidType::PYR_MASK]; std::vector<UMat>& mpyramids = frame.impl->pyramids[OdometryFramePyramidType::PYR_MASK];
if (mpyramids.empty()) if (mpyramids.empty())
preparePyramidMask(mask, dpyramids, iterCounts.size(), settings.getMinDepth(), settings.getMaxDepth(), mpyramids); preparePyramidMask(mask, dpyramids, (int)iterCounts.size(), settings.getMinDepth(), settings.getMaxDepth(), mpyramids);
} }
@ -452,7 +452,7 @@ static void prepareICPFrameDst(OdometryFrame& frame, OdometrySettings settings,
{ {
std::vector<int> iterCounts; std::vector<int> iterCounts;
settings.getIterCounts(iterCounts); settings.getIterCounts(iterCounts);
preparePyramidMask(mask, dpyramids, iterCounts.size(), settings.getMinDepth(), settings.getMaxDepth(), mpyramids); preparePyramidMask(mask, dpyramids, (int)iterCounts.size(), settings.getMinDepth(), settings.getMaxDepth(), mpyramids);
extendPyrMaskByPyrNormals(npyramids, mpyramids); extendPyrMaskByPyrNormals(npyramids, mpyramids);
} }
@ -842,7 +842,7 @@ void calcRgbdLsmMatrices(const Mat& cloud0, const Mat& Rt,
double w_sobelScale = w * sobelScaleIn; double w_sobelScale = w * sobelScaleIn;
const Vec4f& p0 = cloud0.at<Vec4f>(v0, u0); const Vec4f& p0 = cloud0.at<Vec4f>(v0, u0);
Point3f tp0 = rtmat * Point3f(p0[0], p0[1], p0[2]); Point3d tp0 = rtmat * Point3d(p0[0], p0[1], p0[2]);
rgbdCoeffsFunc(transformType, rgbdCoeffsFunc(transformType,
A_ptr, A_ptr,
@ -928,7 +928,7 @@ void calcICPLsmMatrices(const Mat& cloud0, const Mat& Rt,
Vec4f p1 = cloud1.at<Vec4f>(v1, u1); Vec4f p1 = cloud1.at<Vec4f>(v1, u1);
icpCoeffsFunc(transformType, icpCoeffsFunc(transformType,
A_ptr, tps0_ptr[correspIndex], Point3f(p1[0], p1[1], p1[2]), Vec3f(n4[0], n4[1], n4[2]) * w); A_ptr, tps0_ptr[correspIndex], Point3d(p1[0], p1[1], p1[2]), Vec3d(n4[0], n4[1], n4[2]) * w);
for (int y = 0; y < transformDim; y++) for (int y = 0; y < transformDim; y++)
{ {
double* AtA_ptr = AtA.ptr<double>(y); double* AtA_ptr = AtA.ptr<double>(y);

@ -32,7 +32,7 @@ static inline int getTransformDim(OdometryTransformType transformType)
static inline static inline
Vec6d calcRgbdEquationCoeffs(double dIdx, double dIdy, const Point3f& p3d, double fx, double fy) Vec6d calcRgbdEquationCoeffs(double dIdx, double dIdy, const Point3d& p3d, double fx, double fy)
{ {
double invz = 1. / p3d.z, double invz = 1. / p3d.z,
v0 = dIdx * fx * invz, v0 = dIdx * fx * invz,
@ -45,7 +45,7 @@ Vec6d calcRgbdEquationCoeffs(double dIdx, double dIdy, const Point3f& p3d, doubl
} }
static inline static inline
Vec3d calcRgbdEquationCoeffsRotation(double dIdx, double dIdy, const Point3f& p3d, double fx, double fy) Vec3d calcRgbdEquationCoeffsRotation(double dIdx, double dIdy, const Point3d& p3d, double fx, double fy)
{ {
double invz = 1. / p3d.z, double invz = 1. / p3d.z,
v0 = dIdx * fx * invz, v0 = dIdx * fx * invz,
@ -59,7 +59,7 @@ Vec3d calcRgbdEquationCoeffsRotation(double dIdx, double dIdy, const Point3f& p3
} }
static inline static inline
Vec3d calcRgbdEquationCoeffsTranslation(double dIdx, double dIdy, const Point3f& p3d, double fx, double fy) Vec3d calcRgbdEquationCoeffsTranslation(double dIdx, double dIdy, const Point3d& p3d, double fx, double fy)
{ {
double invz = 1. / p3d.z, double invz = 1. / p3d.z,
v0 = dIdx * fx * invz, v0 = dIdx * fx * invz,
@ -70,7 +70,7 @@ Vec3d calcRgbdEquationCoeffsTranslation(double dIdx, double dIdy, const Point3f&
} }
static inline void rgbdCoeffsFunc(OdometryTransformType transformType, static inline void rgbdCoeffsFunc(OdometryTransformType transformType,
double* C, double dIdx, double dIdy, const Point3f& p3d, double fx, double fy) double* C, double dIdx, double dIdy, const Point3d& p3d, double fx, double fy)
{ {
int dim = getTransformDim(transformType); int dim = getTransformDim(transformType);
Vec6d ret; Vec6d ret;
@ -102,7 +102,7 @@ static inline void rgbdCoeffsFunc(OdometryTransformType transformType,
static inline static inline
Vec6d calcICPEquationCoeffs(const Point3f& psrc, const Vec3f& ndst) Vec6d calcICPEquationCoeffs(const Point3d& psrc, const Vec3d& ndst)
{ {
Point3d pxv = psrc.cross(Point3d(ndst)); Point3d pxv = psrc.cross(Point3d(ndst));
@ -110,7 +110,7 @@ Vec6d calcICPEquationCoeffs(const Point3f& psrc, const Vec3f& ndst)
} }
static inline static inline
Vec3d calcICPEquationCoeffsRotation(const Point3f& psrc, const Vec3f& ndst) Vec3d calcICPEquationCoeffsRotation(const Point3d& psrc, const Vec3d& ndst)
{ {
Point3d pxv = psrc.cross(Point3d(ndst)); Point3d pxv = psrc.cross(Point3d(ndst));
@ -118,13 +118,13 @@ Vec3d calcICPEquationCoeffsRotation(const Point3f& psrc, const Vec3f& ndst)
} }
static inline static inline
Vec3d calcICPEquationCoeffsTranslation( const Point3f& /*p0*/, const Vec3f& ndst) Vec3d calcICPEquationCoeffsTranslation( const Point3d& /*p0*/, const Vec3d& ndst)
{ {
return Vec3d(ndst); return Vec3d(ndst);
} }
static inline static inline
void icpCoeffsFunc(OdometryTransformType transformType, double* C, const Point3f& p0, const Point3f& /*p1*/, const Vec3f& n1) void icpCoeffsFunc(OdometryTransformType transformType, double* C, const Point3d& p0, const Point3d& /*p1*/, const Vec3d& n1)
{ {
int dim = getTransformDim(transformType); int dim = getTransformDim(transformType);
Vec6d ret; Vec6d ret;

@ -449,7 +449,7 @@ void HashTsdfVolume::getBoundingBox(OutputArray boundingBox, int precision) cons
std::vector<Point3f> pts; std::vector<Point3f> pts;
for (Vec3i idx : vi) for (Vec3i idx : vi)
{ {
Point3f base = Point3f(idx[0], idx[1], idx[2]) * side; Point3f base = Point3f((float)idx[0], (float)idx[1], (float)idx[2]) * side;
pts.push_back(base); pts.push_back(base);
pts.push_back(base + Point3f(side, 0, 0)); pts.push_back(base + Point3f(side, 0, 0));
pts.push_back(base + Point3f(0, side, 0)); pts.push_back(base + Point3f(0, side, 0));

@ -316,7 +316,7 @@ void OdometryTest::prepareFrameCheck()
std::vector<Mat> gtPyrDepth, gtPyrMask; std::vector<Mat> gtPyrDepth, gtPyrMask;
//TODO: this depth calculation would become incorrect when we implement bilateral filtering, fixit //TODO: this depth calculation would become incorrect when we implement bilateral filtering, fixit
buildPyramid(gtDepth, gtPyrDepth, nlevels - 1); buildPyramid(gtDepth, gtPyrDepth, (int)nlevels - 1);
for (const auto& gd : gtPyrDepth) for (const auto& gd : gtPyrDepth)
{ {
Mat pm = (gd > ods.getMinDepth()) & (gd < ods.getMaxDepth()); Mat pm = (gd > ods.getMinDepth()) & (gd < ods.getMaxDepth());
@ -354,7 +354,7 @@ void OdometryTest::prepareFrameCheck()
if (otype == OdometryType::RGB || otype == OdometryType::RGB_DEPTH) if (otype == OdometryType::RGB || otype == OdometryType::RGB_DEPTH)
{ {
std::vector<Mat> gtPyrImage; std::vector<Mat> gtPyrImage;
buildPyramid(gtGray, gtPyrImage, nlevels - 1); buildPyramid(gtGray, gtPyrImage, (int)nlevels - 1);
for (size_t i = 0; i < nlevels; i++) for (size_t i = 0; i < nlevels; i++)
{ {
@ -389,7 +389,7 @@ void OdometryTest::prepareFrameCheck()
Mat normals; Mat normals;
odf.getNormals(normals); odf.getNormals(normals);
std::vector<Mat> gtPyrNormals; std::vector<Mat> gtPyrNormals;
buildPyramid(normals, gtPyrNormals, nlevels - 1); buildPyramid(normals, gtPyrNormals, (int)nlevels - 1);
for (size_t i = 0; i < nlevels; i++) for (size_t i = 0; i < nlevels; i++)
{ {
Mat gtNormal = gtPyrNormals[i]; Mat gtNormal = gtPyrNormals[i];

@ -886,7 +886,7 @@ protected:
void SetUp() override void SetUp() override
{ {
auto p = GetParam(); auto p = GetParam();
gpu = std::get<0>(std::get<0>(p)); gpu = (std::get<0>(std::get<0>(p)) == PlatformType::GPU);
volumeType = std::get<1>(std::get<0>(p)); volumeType = std::get<1>(std::get<0>(p));
testSrcType = std::get<1>(p); testSrcType = std::get<1>(p);
@ -1161,7 +1161,7 @@ class StaticVolumeBoundingBox : public ::testing::TestWithParam<PlatformVolumeTy
TEST_P(StaticVolumeBoundingBox, staticBoundingBox) TEST_P(StaticVolumeBoundingBox, staticBoundingBox)
{ {
auto p = GetParam(); auto p = GetParam();
bool gpu = bool(std::get<0>(p)); bool gpu = (std::get<0>(p) == PlatformType::GPU);
VolumeType volumeType = std::get<1>(p); VolumeType volumeType = std::get<1>(p);
OpenCLStatusRevert oclStatus; OpenCLStatusRevert oclStatus;
@ -1183,7 +1183,7 @@ class ReproduceVolPoseRotTest : public ::testing::TestWithParam<PlatformTypeEnum
TEST_P(ReproduceVolPoseRotTest, reproduce_volPoseRot) TEST_P(ReproduceVolPoseRotTest, reproduce_volPoseRot)
{ {
bool gpu = bool(GetParam()); bool gpu = (GetParam() == PlatformType::GPU);
OpenCLStatusRevert oclStatus; OpenCLStatusRevert oclStatus;
@ -1208,8 +1208,8 @@ class BoundingBoxEnableGrowthTest : public ::testing::TestWithParam<std::tuple<P
TEST_P(BoundingBoxEnableGrowthTest, boundingBoxEnableGrowth) TEST_P(BoundingBoxEnableGrowthTest, boundingBoxEnableGrowth)
{ {
auto p = GetParam(); auto p = GetParam();
bool gpu = bool(std::get<0>(p)); bool gpu = (std::get<0>(p) == PlatformType::GPU);
bool enableGrowth = bool(std::get<1>(p)); bool enableGrowth = (std::get<1>(p) == Growth::ON);
OpenCLStatusRevert oclStatus; OpenCLStatusRevert oclStatus;

Loading…
Cancel
Save