ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

PinholeCameraModel::project3dToPixel is correct?

asked 2016-12-26 08:00:38 -0500

baozhang gravatar image

updated 2018-04-15 14:36:06 -0500

jayess gravatar image

I'm a beginner about camera geometry.

I would like to understand PinholeCameraModel::project3dToPixel function.


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 flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2017-03-22 04:13:43 -0500

Vincent Rabaud gravatar image

updated 2018-04-15 14:36:53 -0500

jayess gravatar image

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?

edit flag offensive delete link more

answered 2018-04-15 08:32:47 -0500

Hakaishin gravatar image

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.

edit flag offensive delete link more

answered 2017-03-21 20:07:50 -0500

tfoote gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-12-26 08:00:38 -0500

Seen: 984 times

Last updated: Apr 15 '18