ego-planner-swarm icon indicating copy to clipboard operation
ego-planner-swarm copied to clipboard

drone_detector.cpp, countPixel function question

Open bakiuzun opened this issue 6 months ago • 1 comments

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]) 

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?

bakiuzun avatar May 28 '25 14:05 bakiuzun

Sorry but I can not remember that clearly... My experience is, different implementations just produce similar results

bigsuperZZZX avatar Jun 21 '25 11:06 bigsuperZZZX