Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion modules/rgbd/src/hash_tsdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ void HashTSDFVolumeCPU::integrate(InputArray _depth, float depthFactor, const Ma
if (volumeUnit.isActive)
{
//! The volume unit should already be added into the Volume from the allocator
integrateVolumeUnit(truncDist, voxelSize, maxWeight, volumeUnit.pose, volumeUnitResolution, volStrides, depth,
integrateVolumeUnit(truncDist, voxelSize, maxWeight, volumeUnit.pose,
Point3i(volumeUnitResolution, volumeUnitResolution, volumeUnitResolution), volStrides, depth,
depthFactor, cameraPose, intrinsics, pixNorms, volUnitsData.row(volumeUnit.index));

//! Ensure all active volumeUnits are set to inactive for next integration
Expand Down
2 changes: 1 addition & 1 deletion modules/rgbd/src/tsdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void TSDFVolumeCPU::integrate(InputArray _depth, float depthFactor, const Matx44
pixNorms = preCalculationPixNorm(depth, intrinsics);
}

integrateVolumeUnit(truncDist, voxelSize, maxWeight, (this->pose).matrix, volResolution.x, volStrides, depth,
integrateVolumeUnit(truncDist, voxelSize, maxWeight, (this->pose).matrix, volResolution, volStrides, depth,
depthFactor, cameraPose, intrinsics, pixNorms, volume);
}

Expand Down
20 changes: 10 additions & 10 deletions modules/rgbd/src/tsdf_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ depthType bilinearDepth(const Depth& m, cv::Point2f pt)

void integrateVolumeUnit(
float truncDist, float voxelSize, int maxWeight,
cv::Matx44f _pose, int volResolution, Vec4i volStrides,
cv::Matx44f _pose, Point3i volResolution, Vec4i volStrides,
InputArray _depth, float depthFactor, const cv::Matx44f& cameraPose,
const cv::kinfu::Intr& intrinsics, InputArray _pixNorms, InputArray _volume)
{
Expand All @@ -122,7 +122,7 @@ void integrateVolumeUnit(
cv::Affine3f vpose(_pose);
Depth depth = _depth.getMat();

Range integrateRange(0, volResolution);
Range integrateRange(0, volResolution.x);

Mat volume = _volume.getMat();
Mat pixNorms = _pixNorms.getMat();
Expand All @@ -147,7 +147,7 @@ void integrateVolumeUnit(
for (int x = range.start; x < range.end; x++)
{
TsdfVoxel* volDataX = volDataStart + x * volStrides[0];
for (int y = 0; y < volResolution; y++)
for (int y = 0; y < volResolution.y; y++)
{
TsdfVoxel* volDataY = volDataX + y * volStrides[1];
// optimization of camSpace transformation (vector addition instead of matmul at each z)
Expand All @@ -161,7 +161,7 @@ void integrateVolumeUnit(
if (zStepPt.z > 0)
{
startZ = baseZ;
endZ = volResolution;
endZ = volResolution.z;
}
else
{
Expand All @@ -174,7 +174,7 @@ void integrateVolumeUnit(
if (basePt.z > 0)
{
startZ = 0;
endZ = volResolution;
endZ = volResolution.z;
}
else
{
Expand All @@ -183,7 +183,7 @@ void integrateVolumeUnit(
}
}
startZ = max(0, startZ);
endZ = min(int(volResolution), endZ);
endZ = min(int(volResolution.z), endZ);
for (int z = startZ; z < endZ; z++)
{
// optimization of the following:
Expand Down Expand Up @@ -281,7 +281,7 @@ void integrateVolumeUnit(
for (int x = range.start; x < range.end; x++)
{
TsdfVoxel* volDataX = volDataStart + x * volStrides[0];
for (int y = 0; y < volResolution; y++)
for (int y = 0; y < volResolution.y; y++)
{
TsdfVoxel* volDataY = volDataX + y * volStrides[1];
// optimization of camSpace transformation (vector addition instead of matmul at each z)
Expand All @@ -299,7 +299,7 @@ void integrateVolumeUnit(
if (zStep.z > 0)
{
startZ = baseZ;
endZ = volResolution;
endZ = volResolution.z;
}
else
{
Expand All @@ -312,7 +312,7 @@ void integrateVolumeUnit(
if (basePt.z > 0)
{
startZ = 0;
endZ = volResolution;
endZ = volResolution.z;
}
else
{
Expand All @@ -321,7 +321,7 @@ void integrateVolumeUnit(
}
}
startZ = max(0, startZ);
endZ = min(int(volResolution), endZ);
endZ = min(int(volResolution.z), endZ);

for (int z = startZ; z < endZ; z++)
{
Expand Down
2 changes: 1 addition & 1 deletion modules/rgbd/src/tsdf_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ depthType bilinearDepth(const Depth& m, cv::Point2f pt);

void integrateVolumeUnit(
float truncDist, float voxelSize, int maxWeight,
cv::Matx44f _pose, int volResolution, Vec4i volStrides,
cv::Matx44f _pose, Point3i volResolution, Vec4i volStrides,
InputArray _depth, float depthFactor, const cv::Matx44f& cameraPose,
const cv::kinfu::Intr& intrinsics, InputArray _pixNorms, InputArray _volume);

Expand Down