ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange

# PinholeCameraModel::project3dToPixel is correct?

I'm a beginner about camera geometry.

I would like to understand PinholeCameraModel::project3dToPixel function.

PinholeCameraModel::project3dToPixel

I derived uv_rect like below but the formula are a little different from API.

API tells,

uv_rect.x = (fx()*xyz.x + Tx()) / xyz.z + cx();
uv_rect.y = (fy()*xyz.y + Ty()) / xyz.z + cy();


I derived,

uv_rect.x = (fx()*(xyz.x + Tx())) / xyz.z + cx();
uv_rect.y = (fy()*(xyz.y + Ty())) / xyz.z + cy();


Is The unit of xyz.x and Tx() meter? If so, my answer is not wrong.

Could you tell me the deriving process of these formula?

edit retag close merge delete

Sort by ยป oldest newest most voted

It's possible there's a bug /transcription error. Can you create a unit test and show it's invalid and see if your solution works correctly? If so I'm sure the maintainer would be interested.

more

The function inverts all points at the midpoint so x and y are inverted. This was at least for me very surprising and I sounds wrong to me. So for anybody having a problem with this function try to invert both axis and see if that helps.

more

How do you get to that?

[U V W]^T = P * [X Y Z 1]^T   (X=xyz.x, Y=xyz.y ...)


with P something like:

[[ fx 0 0 Tx]
[ 0 fy 0 Ty]
[ 0 0  1 0]]


That gives: u = U/W + cx which is what we have in the code no?

more