Hello,
I was reviewing your implementation of the countPixel function, and I noticed the following code snippet:
if (valid_pixel_cnt_[drone_id] > pixel_threshold_) {
int init_x = (boundingbox_lu_[drone_id].x + boundingbox_rd_[drone_id].x) / 2;
int init_y = (boundingbox_lu_[drone_id].y + boundingbox_rd_[drone_id].y) / 2;
uint16_t *row_ptr;
row_ptr = depth_img_.ptr(tmp_pixel(1));
depth = (*(row_ptr + tmp_pixel(0))) / 1000.0;
tmp_pose_cam = depth2Pos(init_x, init_y, depth);
// the center of the drone
if (getDist2(tmp_pose_cam, drone_pose_cam_[drone_id]) < max_pose_error2_) {
true_pixel(0) = init_x;
true_pixel(1) = init_y;
true_pose_cam = tmp_pose_cam;
return true;
}
}
My question is: why is the depth value being read using tmp_pixel coordinates here instead of the init_x and init_y that correspond to the center of the bounding box?
Since you are computing tmp_pose_cam with init_x and init_y, shouldn't the depth value be retrieved at (init_x, init_y) as well?
Hello,
I was reviewing your implementation of the countPixel function, and I noticed the following code snippet:
if (valid_pixel_cnt_[drone_id] > pixel_threshold_) { int init_x = (boundingbox_lu_[drone_id].x + boundingbox_rd_[drone_id].x) / 2; int init_y = (boundingbox_lu_[drone_id].y + boundingbox_rd_[drone_id].y) / 2; uint16_t *row_ptr; row_ptr = depth_img_.ptr(tmp_pixel(1)); depth = (*(row_ptr + tmp_pixel(0))) / 1000.0; tmp_pose_cam = depth2Pos(init_x, init_y, depth); // the center of the drone if (getDist2(tmp_pose_cam, drone_pose_cam_[drone_id]) < max_pose_error2_) { true_pixel(0) = init_x; true_pixel(1) = init_y; true_pose_cam = tmp_pose_cam; return true; } }My question is: why is the depth value being read using tmp_pixel coordinates here instead of the init_x and init_y that correspond to the center of the bounding box?
Since you are computing tmp_pose_cam with init_x and init_y, shouldn't the depth value be retrieved at (init_x, init_y) as well?