mirror of
https://github.com/opencv/opencv.git
synced 2025-01-22 17:43:12 +08:00
trying to fix MSVC compilation
double -> float warning fix warnings in the rest 3d module files extra var removed try to fix warnings
This commit is contained in:
parent
44d6872837
commit
f92a1aa07d
@ -461,7 +461,7 @@ public:
|
|||||||
typedef Vec<T, 3> Vec3T;
|
typedef Vec<T, 3> Vec3T;
|
||||||
typedef Matx<T, 3, 3> Mat33T;
|
typedef Matx<T, 3, 3> Mat33T;
|
||||||
|
|
||||||
LINEMOD(int _rows, int _cols, int _windowSize, const Mat& _K, float _diffThr = 50.f) :
|
LINEMOD(int _rows, int _cols, int _windowSize, const Mat& _K, double _diffThr = 50.0) :
|
||||||
RgbdNormalsImpl<T>(_rows, _cols, _windowSize, _K, RgbdNormals::RGBD_NORMALS_METHOD_LINEMOD),
|
RgbdNormalsImpl<T>(_rows, _cols, _windowSize, _K, RgbdNormals::RGBD_NORMALS_METHOD_LINEMOD),
|
||||||
differenceThreshold(_diffThr)
|
differenceThreshold(_diffThr)
|
||||||
{ }
|
{ }
|
||||||
@ -552,9 +552,9 @@ public:
|
|||||||
|
|
||||||
Vec3T X1_minus_X, X2_minus_X;
|
Vec3T X1_minus_X, X2_minus_X;
|
||||||
|
|
||||||
ContainerDepth difference_threshold(differenceThreshold);
|
ContainerDepth difference_threshold((ContainerDepth)differenceThreshold);
|
||||||
//TODO: fixit, difference threshold should not depend on input type
|
//TODO: fixit, difference threshold should not depend on input type
|
||||||
difference_threshold *= (std::is_same<DepthDepth, ushort>::value ? 1000.f : 1.f);
|
difference_threshold *= (ContainerDepth)(std::is_same<DepthDepth, ushort>::value ? 1000.0 : 1.0);
|
||||||
normals.setTo(std::numeric_limits<DepthDepth>::quiet_NaN());
|
normals.setTo(std::numeric_limits<DepthDepth>::quiet_NaN());
|
||||||
for (int y = r; y < this->rows - r - 1; ++y)
|
for (int y = r; y < this->rows - r - 1; ++y)
|
||||||
{
|
{
|
||||||
@ -609,7 +609,7 @@ public:
|
|||||||
return normals;
|
return normals;
|
||||||
}
|
}
|
||||||
|
|
||||||
float differenceThreshold;
|
double differenceThreshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -517,7 +517,7 @@ void warpFrame(InputArray depth, InputArray image, InputArray mask,
|
|||||||
|
|
||||||
if (z < oldz)
|
if (z < oldz)
|
||||||
{
|
{
|
||||||
zBuffer.at<float>(uv) = z;
|
zBuffer.at<float>(uv) = (float)z;
|
||||||
|
|
||||||
switch (imageType)
|
switch (imageType)
|
||||||
{
|
{
|
||||||
|
@ -290,6 +290,7 @@ void prepareICPFrameDst(OdometryFrame& frame, OdometrySettings settings)
|
|||||||
depth.depth(),
|
depth.depth(),
|
||||||
cameraMatrix,
|
cameraMatrix,
|
||||||
normalWinSize,
|
normalWinSize,
|
||||||
|
50.f,
|
||||||
normalMethod);
|
normalMethod);
|
||||||
TMat c0;
|
TMat c0;
|
||||||
frame.getPyramidAt(c0, OdometryFramePyramidType::PYR_CLOUD, 0);
|
frame.getPyramidAt(c0, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||||
@ -935,7 +936,7 @@ void computeCorresps(const Matx33f& _K, const Mat& rt,
|
|||||||
|
|
||||||
_corresps.create(correspCount, 1, CV_32SC4);
|
_corresps.create(correspCount, 1, CV_32SC4);
|
||||||
Vec4i* corresps_ptr = _corresps.ptr<Vec4i>();
|
Vec4i* corresps_ptr = _corresps.ptr<Vec4i>();
|
||||||
float* diffs_ptr;
|
float* diffs_ptr = nullptr;
|
||||||
if (method == OdometryType::RGB)
|
if (method == OdometryType::RGB)
|
||||||
{
|
{
|
||||||
_diffs.create(correspCount, 1, CV_32F);
|
_diffs.create(correspCount, 1, CV_32F);
|
||||||
@ -944,7 +945,7 @@ void computeCorresps(const Matx33f& _K, const Mat& rt,
|
|||||||
for (int vsrc = 0, i = 0; vsrc < corresps.rows; vsrc++)
|
for (int vsrc = 0, i = 0; vsrc < corresps.rows; vsrc++)
|
||||||
{
|
{
|
||||||
const Vec2s* corresps_row = corresps.ptr<Vec2s>(vsrc);
|
const Vec2s* corresps_row = corresps.ptr<Vec2s>(vsrc);
|
||||||
const float* diffs_row;
|
const float* diffs_row = nullptr;
|
||||||
if (method == OdometryType::RGB)
|
if (method == OdometryType::RGB)
|
||||||
diffs_row = diffs.ptr<float>(vsrc);
|
diffs_row = diffs.ptr<float>(vsrc);
|
||||||
for (int usrc = 0; usrc < corresps.cols; usrc++)
|
for (int usrc = 0; usrc < corresps.cols; usrc++)
|
||||||
|
@ -433,8 +433,7 @@ static double calibrateCameraInternal( const Mat& objectPoints,
|
|||||||
if (releaseObject)
|
if (releaseObject)
|
||||||
JoBuf = Mat( maxPoints*2, maxPoints*3, CV_64FC1);
|
JoBuf = Mat( maxPoints*2, maxPoints*3, CV_64FC1);
|
||||||
|
|
||||||
auto cameraCalcJErr = [matM, _m, npoints, nimages, flags, releaseObject, nparams, maxPoints, aspectRatio, NINTRINSIC,
|
auto cameraCalcJErr = [&, npoints, nimages, flags, releaseObject, nparams, maxPoints, NINTRINSIC]
|
||||||
&JeBuf, &JiBuf, &JoBuf, &errBuf, &allErrors, &perViewErr]
|
|
||||||
(InputOutputArray _param, OutputArray _JtErr, OutputArray _JtJ, double& errnorm) -> bool
|
(InputOutputArray _param, OutputArray _JtErr, OutputArray _JtJ, double& errnorm) -> bool
|
||||||
{
|
{
|
||||||
bool optimizeObjPoints = releaseObject;
|
bool optimizeObjPoints = releaseObject;
|
||||||
@ -659,7 +658,7 @@ static double stereoCalibrateImpl(
|
|||||||
Matx33d A[2];
|
Matx33d A[2];
|
||||||
int pointsTotal = 0, maxPoints = 0, nparams;
|
int pointsTotal = 0, maxPoints = 0, nparams;
|
||||||
bool recomputeIntrinsics = false;
|
bool recomputeIntrinsics = false;
|
||||||
double aspectRatio[2] = {0};
|
double aspectRatio[2] = {0, 0};
|
||||||
|
|
||||||
CV_Assert( _imagePoints1.type() == _imagePoints2.type() &&
|
CV_Assert( _imagePoints1.type() == _imagePoints2.type() &&
|
||||||
_imagePoints1.depth() == _objectPoints.depth() );
|
_imagePoints1.depth() == _objectPoints.depth() );
|
||||||
@ -675,7 +674,8 @@ static double stereoCalibrateImpl(
|
|||||||
pointsTotal += ni;
|
pointsTotal += ni;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mat objectPoints, imagePoints[2];
|
Mat objectPoints;
|
||||||
|
Mat imagePoints[2];
|
||||||
_objectPoints.convertTo(objectPoints, CV_64F);
|
_objectPoints.convertTo(objectPoints, CV_64F);
|
||||||
objectPoints = objectPoints.reshape(3, 1);
|
objectPoints = objectPoints.reshape(3, 1);
|
||||||
|
|
||||||
@ -895,8 +895,7 @@ static double stereoCalibrateImpl(
|
|||||||
Mat J_LRBuf( maxPoints*2, 6, CV_64F );
|
Mat J_LRBuf( maxPoints*2, 6, CV_64F );
|
||||||
Mat JiBuf( maxPoints*2, NINTRINSIC, CV_64F, Scalar(0) );
|
Mat JiBuf( maxPoints*2, NINTRINSIC, CV_64F, Scalar(0) );
|
||||||
|
|
||||||
auto lmcallback = [errBuf, JeBuf, J_LRBuf, JiBuf, recomputeIntrinsics, nimages, flags, aspectRatio, &A, &dk, NINTRINSIC,
|
auto lmcallback = [&, recomputeIntrinsics, nimages, flags, NINTRINSIC, _npoints]
|
||||||
_npoints, objectPoints, imagePoints, Dist, &perViewErr]
|
|
||||||
(InputOutputArray _param, OutputArray JtErr_, OutputArray JtJ_, double& errnorm)
|
(InputOutputArray _param, OutputArray JtErr_, OutputArray JtJ_, double& errnorm)
|
||||||
{
|
{
|
||||||
Mat_<double> param_m = _param.getMat();
|
Mat_<double> param_m = _param.getMat();
|
||||||
@ -911,7 +910,7 @@ static double stereoCalibrateImpl(
|
|||||||
|
|
||||||
if( recomputeIntrinsics )
|
if( recomputeIntrinsics )
|
||||||
{
|
{
|
||||||
size_t idx = (nimages+1)*6;
|
int idx = (nimages+1)*6;
|
||||||
|
|
||||||
if( flags & CALIB_SAME_FOCAL_LENGTH )
|
if( flags & CALIB_SAME_FOCAL_LENGTH )
|
||||||
{
|
{
|
||||||
@ -949,7 +948,7 @@ static double stereoCalibrateImpl(
|
|||||||
{
|
{
|
||||||
int ni = _npoints.at<int>(i);
|
int ni = _npoints.at<int>(i);
|
||||||
|
|
||||||
size_t idx = (i+1)*6;
|
int idx = (i+1)*6;
|
||||||
om[0] = Vec3d(param_m(idx + 0), param_m(idx + 1), param_m(idx + 2));
|
om[0] = Vec3d(param_m(idx + 0), param_m(idx + 1), param_m(idx + 2));
|
||||||
T[0] = Vec3d(param_m(idx + 3), param_m(idx + 4), param_m(idx + 5));
|
T[0] = Vec3d(param_m(idx + 3), param_m(idx + 4), param_m(idx + 5));
|
||||||
|
|
||||||
|
@ -2026,28 +2026,28 @@ TEST(Calib_StereoCalibrate, regression_22421)
|
|||||||
fs["desiredT"] >> desiredT;
|
fs["desiredT"] >> desiredT;
|
||||||
|
|
||||||
std::vector<float> obj_points = {0, 0, 0,
|
std::vector<float> obj_points = {0, 0, 0,
|
||||||
0.5, 0, 0,
|
0.5f, 0, 0,
|
||||||
1, 0, 0,
|
1.f, 0, 0,
|
||||||
1.5000001, 0, 0,
|
1.5000001f, 0, 0,
|
||||||
2, 0, 0,
|
2.0f, 0, 0,
|
||||||
0, 0.5, 0,
|
0, 0.5f, 0,
|
||||||
0.5, 0.5, 0,
|
0.5f, 0.5f, 0,
|
||||||
1, 0.5, 0,
|
1.f, 0.5, 0,
|
||||||
1.5000001, 0.5, 0,
|
1.5000001f, 0.5f, 0,
|
||||||
2, 0.5, 0,
|
2.f, 0.5f, 0,
|
||||||
0, 1, 0,
|
0, 1.f, 0,
|
||||||
0.5, 1, 0,
|
0.5f, 1.f, 0,
|
||||||
1, 1, 0,
|
1.f, 1.f, 0,
|
||||||
1.5000001, 1, 0,
|
1.5000001f, 1.f, 0,
|
||||||
2, 1, 0,
|
2.f, 1.f, 0,
|
||||||
0, 1.5000001, 0,
|
0, 1.5000001f, 0,
|
||||||
0.5, 1.5000001, 0,
|
0.5f, 1.5000001f, 0,
|
||||||
1, 1.5000001, 0,
|
1.f, 1.5000001f, 0,
|
||||||
1.5000001, 1.5000001, 0,
|
1.5000001f, 1.5000001f, 0,
|
||||||
2, 1.5000001, 0};
|
2.f, 1.5000001f, 0};
|
||||||
|
|
||||||
cv::Mat obj_points_mat(obj_points, true);
|
cv::Mat obj_points_mat(obj_points, true);
|
||||||
obj_points_mat = obj_points_mat.reshape(1, obj_points.size() / 3);
|
obj_points_mat = obj_points_mat.reshape(1, int(obj_points.size()) / 3);
|
||||||
std::vector<cv::Mat> grid_points(image_points1.size(), obj_points_mat);
|
std::vector<cv::Mat> grid_points(image_points1.size(), obj_points_mat);
|
||||||
|
|
||||||
cv::Mat R, T;
|
cv::Mat R, T;
|
||||||
|
Loading…
Reference in New Issue
Block a user