mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge pull request #22598 from savuor:icp_oframe_readonly
Complement PR: #3366@contrib
Changes
OdometryFrame losts its getters: a user can provide data at construction stage only, pyramids and other generated data is read-only now
OdometryFrame is based on UMats: no TMat templates inside, CPU operations are done with UMat::getMat() method, chaining issues are solved ad-hoc
No more Odometry::createOdometryFrame() method, frames are compatible with all odometry algorithms
Normals computer is cached inside Odometry and exposed to API as well as its settings
Volume::raycast() won't return the result in OdometryFrame anymore
Added test for Odometry::prepareFrame*() & other test fixes
Minor code improvements
TODOs:
fix TODOs in code
lower acceptable accuracy errors
This commit is contained in:
committed by
GitHub
parent
8358efaca1
commit
8b7e586faa
+28
-102
@@ -489,9 +489,7 @@ void normal_test_custom_framesize(VolumeType volumeType, VolumeTestFunction test
|
||||
Mat rgb = scene->rgb(poses[0]);
|
||||
Mat points, normals, tmpnormals, colors;
|
||||
|
||||
OdometryFrame odf;
|
||||
odf.setDepth(depth);
|
||||
odf.setImage(rgb);
|
||||
OdometryFrame odf(rgb, depth);
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
@@ -507,21 +505,10 @@ void normal_test_custom_framesize(VolumeType volumeType, VolumeTestFunction test
|
||||
|
||||
if (testFunction == VolumeTestFunction::RAYCAST)
|
||||
{
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
}
|
||||
else if (testFunction == VolumeTestFunction::FETCH_NORMALS)
|
||||
{
|
||||
@@ -568,9 +555,7 @@ void normal_test_common_framesize(VolumeType volumeType, VolumeTestFunction test
|
||||
Mat rgb = scene->rgb(poses[0]);
|
||||
Mat points, normals, tmpnormals, colors;
|
||||
|
||||
OdometryFrame odf;
|
||||
odf.setDepth(depth);
|
||||
odf.setImage(rgb);
|
||||
OdometryFrame odf(rgb, depth);
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
@@ -586,21 +571,10 @@ void normal_test_common_framesize(VolumeType volumeType, VolumeTestFunction test
|
||||
|
||||
if (testFunction == VolumeTestFunction::RAYCAST)
|
||||
{
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[0].matrix, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, points, normals);
|
||||
}
|
||||
else if (testFunction == VolumeTestFunction::FETCH_NORMALS)
|
||||
{
|
||||
@@ -648,9 +622,7 @@ void valid_points_test_custom_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
Mat points, normals, colors, newPoints, newNormals;
|
||||
int anfas, profile;
|
||||
|
||||
OdometryFrame odf;
|
||||
odf.setDepth(depth);
|
||||
odf.setImage(rgb);
|
||||
OdometryFrame odf(rgb, depth);
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
@@ -664,21 +636,10 @@ void valid_points_test_custom_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
volume.integrate(odf, poses[0].matrix);
|
||||
}
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT) // Odometry frame or Mats
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
|
||||
patchNaNs(points);
|
||||
anfas = counterOfValid(points);
|
||||
@@ -694,21 +655,10 @@ void valid_points_test_custom_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
points.release();
|
||||
normals.release();
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT) // Odometry frame or Mats
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[17].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[17].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[17].matrix, frameSize.height, frameSize.width, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[17].matrix, frameSize.height, frameSize.width, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[17].matrix, frameSize.height, frameSize.width, points, normals);
|
||||
|
||||
patchNaNs(points);
|
||||
profile = counterOfValid(points);
|
||||
@@ -748,9 +698,7 @@ void valid_points_test_common_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
Mat points, normals, colors, newPoints, newNormals;
|
||||
int anfas, profile;
|
||||
|
||||
OdometryFrame odf;
|
||||
odf.setDepth(depth);
|
||||
odf.setImage(rgb);
|
||||
OdometryFrame odf(rgb, depth);
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT)
|
||||
{
|
||||
@@ -764,21 +712,10 @@ void valid_points_test_common_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
volume.integrate(odf, poses[0].matrix);
|
||||
}
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT) // Odometry frame or Mats
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[0].matrix, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[0].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[0].matrix, points, normals);
|
||||
|
||||
patchNaNs(points);
|
||||
anfas = counterOfValid(points);
|
||||
@@ -794,21 +731,10 @@ void valid_points_test_common_framesize(VolumeType volumeType, VolumeTestSrcType
|
||||
points.release();
|
||||
normals.release();
|
||||
|
||||
if (testSrcType == VolumeTestSrcType::MAT) // Odometry frame or Mats
|
||||
{
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[17].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[17].matrix, points, normals);
|
||||
}
|
||||
else if (testSrcType == VolumeTestSrcType::ODOMETRY_FRAME)
|
||||
{
|
||||
volume.raycast(poses[17].matrix, odf);
|
||||
odf.getPyramidAt(points, OdometryFramePyramidType::PYR_CLOUD, 0);
|
||||
odf.getPyramidAt(normals, OdometryFramePyramidType::PYR_NORM, 0);
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
odf.getPyramidAt(colors, OdometryFramePyramidType::PYR_IMAGE, 0);
|
||||
}
|
||||
if (volumeType == VolumeType::ColorTSDF)
|
||||
volume.raycast(poses[17].matrix, points, normals, colors);
|
||||
else
|
||||
volume.raycast(poses[17].matrix, points, normals);
|
||||
|
||||
patchNaNs(points);
|
||||
profile = counterOfValid(points);
|
||||
|
||||
Reference in New Issue
Block a user