Skip to content

Commit 776da13

Browse files
committed
make the filled upsampling holes more filled in more relative angle cases, but it still reduces to a sliver from some angles
1 parent c38d954 commit 776da13

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

depth_image_proc/src/nodelets/register.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ void RegisterNodelet::convert(const sensor_msgs::ImageConstPtr& depth_msg,
287287
continue;
288288

289289
// TODO(lucasw) this is identical to above except adding 0.5 instead of subtracting
290+
// TODO(lucasw) need a third and fourth position with u+0.5 and v-0.5 and u-0.5 and v+0.5
291+
// (and then could do the triangle rastering mentioned above, or just take the min
292+
// and max of all of them)
290293
xyz_depth_2 << ((u+0.5f - depth_cx)*depth - depth_Tx) * inv_depth_fx,
291294
((v+0.5f - depth_cy)*depth - depth_Ty) * inv_depth_fy,
292295
depth,
@@ -304,9 +307,9 @@ void RegisterNodelet::convert(const sensor_msgs::ImageConstPtr& depth_msg,
304307

305308
// fill in the square defined by uv range
306309
const T new_depth = DepthTraits<T>::fromMeters(0.5*(xyz_rgb_1.z()+xyz_rgb_2.z()));
307-
for (int nv=v_rgb_1; nv<=v_rgb_2; ++nv)
310+
for (int nv=std::min(v_rgb_1, v_rgb_2); nv<=std::max(v_rgb_1, v_rgb_2); ++nv)
308311
{
309-
for (int nu=u_rgb_1; nu<=u_rgb_2; ++nu)
312+
for (int nu=std::min(u_rgb_1, u_rgb_2); nu<=std::max(u_rgb_2, u_rgb_2); ++nu)
310313
{
311314
T& reg_depth = registered_data[nv*registered_msg->width + nu];
312315
// Validity and Z-buffer checks

0 commit comments

Comments
 (0)