Skip to content

Commit 10bfd2d

Browse files
authored
Merge pull request #2725 from DumDereDum:integrateVolumeUnit_fix
integrateVolumeUnit fix * replace int with Point3i at integrateVolumeUnit signature * Update hash_tsdf.hpp * Update hash_tsdf.cpp * Update hash_tsdf.cpp * error fix * minor fix
1 parent d8197c6 commit 10bfd2d

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

modules/rgbd/src/hash_tsdf.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ void HashTSDFVolumeCPU::integrate(InputArray _depth, float depthFactor, const Ma
216216
if (volumeUnit.isActive)
217217
{
218218
//! The volume unit should already be added into the Volume from the allocator
219-
integrateVolumeUnit(truncDist, voxelSize, maxWeight, volumeUnit.pose, volumeUnitResolution, volStrides, depth,
219+
integrateVolumeUnit(truncDist, voxelSize, maxWeight, volumeUnit.pose,
220+
Point3i(volumeUnitResolution, volumeUnitResolution, volumeUnitResolution), volStrides, depth,
220221
depthFactor, cameraPose, intrinsics, pixNorms, volUnitsData.row(volumeUnit.index));
221222

222223
//! Ensure all active volumeUnits are set to inactive for next integration

modules/rgbd/src/tsdf.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ void TSDFVolumeCPU::integrate(InputArray _depth, float depthFactor, const Matx44
133133
pixNorms = preCalculationPixNorm(depth, intrinsics);
134134
}
135135

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

modules/rgbd/src/tsdf_functions.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ depthType bilinearDepth(const Depth& m, cv::Point2f pt)
111111

112112
void integrateVolumeUnit(
113113
float truncDist, float voxelSize, int maxWeight,
114-
cv::Matx44f _pose, int volResolution, Vec4i volStrides,
114+
cv::Matx44f _pose, Point3i volResolution, Vec4i volStrides,
115115
InputArray _depth, float depthFactor, const cv::Matx44f& cameraPose,
116116
const cv::kinfu::Intr& intrinsics, InputArray _pixNorms, InputArray _volume)
117117
{
@@ -122,7 +122,7 @@ void integrateVolumeUnit(
122122
cv::Affine3f vpose(_pose);
123123
Depth depth = _depth.getMat();
124124

125-
Range integrateRange(0, volResolution);
125+
Range integrateRange(0, volResolution.x);
126126

127127
Mat volume = _volume.getMat();
128128
Mat pixNorms = _pixNorms.getMat();
@@ -147,7 +147,7 @@ void integrateVolumeUnit(
147147
for (int x = range.start; x < range.end; x++)
148148
{
149149
TsdfVoxel* volDataX = volDataStart + x * volStrides[0];
150-
for (int y = 0; y < volResolution; y++)
150+
for (int y = 0; y < volResolution.y; y++)
151151
{
152152
TsdfVoxel* volDataY = volDataX + y * volStrides[1];
153153
// optimization of camSpace transformation (vector addition instead of matmul at each z)
@@ -161,7 +161,7 @@ void integrateVolumeUnit(
161161
if (zStepPt.z > 0)
162162
{
163163
startZ = baseZ;
164-
endZ = volResolution;
164+
endZ = volResolution.z;
165165
}
166166
else
167167
{
@@ -174,7 +174,7 @@ void integrateVolumeUnit(
174174
if (basePt.z > 0)
175175
{
176176
startZ = 0;
177-
endZ = volResolution;
177+
endZ = volResolution.z;
178178
}
179179
else
180180
{
@@ -183,7 +183,7 @@ void integrateVolumeUnit(
183183
}
184184
}
185185
startZ = max(0, startZ);
186-
endZ = min(int(volResolution), endZ);
186+
endZ = min(int(volResolution.z), endZ);
187187
for (int z = startZ; z < endZ; z++)
188188
{
189189
// optimization of the following:
@@ -281,7 +281,7 @@ void integrateVolumeUnit(
281281
for (int x = range.start; x < range.end; x++)
282282
{
283283
TsdfVoxel* volDataX = volDataStart + x * volStrides[0];
284-
for (int y = 0; y < volResolution; y++)
284+
for (int y = 0; y < volResolution.y; y++)
285285
{
286286
TsdfVoxel* volDataY = volDataX + y * volStrides[1];
287287
// optimization of camSpace transformation (vector addition instead of matmul at each z)
@@ -299,7 +299,7 @@ void integrateVolumeUnit(
299299
if (zStep.z > 0)
300300
{
301301
startZ = baseZ;
302-
endZ = volResolution;
302+
endZ = volResolution.z;
303303
}
304304
else
305305
{
@@ -312,7 +312,7 @@ void integrateVolumeUnit(
312312
if (basePt.z > 0)
313313
{
314314
startZ = 0;
315-
endZ = volResolution;
315+
endZ = volResolution.z;
316316
}
317317
else
318318
{
@@ -321,7 +321,7 @@ void integrateVolumeUnit(
321321
}
322322
}
323323
startZ = max(0, startZ);
324-
endZ = min(int(volResolution), endZ);
324+
endZ = min(int(volResolution.z), endZ);
325325

326326
for (int z = startZ; z < endZ; z++)
327327
{

modules/rgbd/src/tsdf_functions.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ depthType bilinearDepth(const Depth& m, cv::Point2f pt);
3939

4040
void integrateVolumeUnit(
4141
float truncDist, float voxelSize, int maxWeight,
42-
cv::Matx44f _pose, int volResolution, Vec4i volStrides,
42+
cv::Matx44f _pose, Point3i volResolution, Vec4i volStrides,
4343
InputArray _depth, float depthFactor, const cv::Matx44f& cameraPose,
4444
const cv::kinfu::Intr& intrinsics, InputArray _pixNorms, InputArray _volume);
4545

0 commit comments

Comments
 (0)