1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-17 15:26:00 +08:00

Merge pull request #2460 from ayushgargdroid:fixDepthRegisteration

* Fix for Depth Registration. Issue #2234

* Fix style

* Incorporating suggestions. 1. Trailing whitespace 2. Matx33f 3. EXPECT_EQ

* test: use Matx33f ctor
This commit is contained in:
Ayush Garg
2020-03-17 15:12:22 -04:00
committed by GitHub
parent 2a32a5ad0c
commit 4d57438cb6
2 changed files with 24 additions and 4 deletions

View File

@@ -185,14 +185,14 @@ namespace rgbd
// Apply the initial projection to the input depth
Mat_<Point3f> transformedCloud;
{
Mat_<Point3f> point_tmp(outputImagePlaneSize);
Mat_<Point3f> point_tmp(outputImagePlaneSize,Point3f(0.,0.,0.));
for(int j = 0; j < point_tmp.rows; ++j)
for(int j = 0; j < unregisteredDepth.rows; ++j)
{
const DepthDepth *unregisteredDepthPtr = unregisteredDepth[j];
Point3f *point = point_tmp[j];
for(int i = 0; i < point_tmp.cols; ++i, ++unregisteredDepthPtr, ++point)
for(int i = 0; i < unregisteredDepth.cols; ++i, ++unregisteredDepthPtr, ++point)
{
float rescaled_depth = float(*unregisteredDepthPtr) * inputDepthToMetersScale;
@@ -309,7 +309,6 @@ namespace rgbd
} // iterate cols
} // iterate rows
}

View File

@@ -151,5 +151,26 @@ TEST(Rgbd_DepthRegistration, compute)
test.safe_run();
}
TEST(Rgbd_DepthRegistration, issue_2234)
{
Matx33f intrinsicsDepth(100, 0, 50, 0, 100, 50, 0, 0, 1);
Matx33f intrinsicsColor(100, 0, 200, 0, 100, 50, 0, 0, 1);
Mat_<float> depthMat(100, 100, (float)0.);
for(int i = 1; i <= 100; i++)
{
for(int j = 1; j <= 100; j++)
depthMat(i-1,j-1) = (float)j;
}
Mat registeredDepth;
registerDepth(intrinsicsDepth, intrinsicsColor, Mat(), Matx44f::eye(), depthMat, Size(400, 100), registeredDepth);
Rect roi( 150, 0, 100, 100 );
Mat subM(registeredDepth,roi);
EXPECT_EQ(0, cvtest::norm(subM, depthMat, NORM_INF));
}
}} // namespace