Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapped x and y values in world.cameraMatrix? #10

Open
MrMho opened this issue Mar 11, 2022 · 1 comment
Open

Swapped x and y values in world.cameraMatrix? #10

MrMho opened this issue Mar 11, 2022 · 1 comment

Comments

@MrMho
Copy link

MrMho commented Mar 11, 2022

Hi,

first off, thank you very much for writing this program and making it public.

Here is my issue:

The function cameraMatrix from the world module is called like this:

cameraMatrix = world.cameraMatrix(focalLength, (height / 2, width / 2))

That is, the second argument (center) is a tuple containing the center points in vertical or y-direction (height/2) and in horizontal or x-direction (width/2), in this particular order.

Now, please take a look inside the function. You can see that the center point for the y-direction (center[0]) is in the first row, whereas the center point for the x-direction (center[1]) appears in the second row of the matrix:

def cameraMatrix(fl, center):
    mat = [[fl, 1, center[0]],
                [0, fl, center[1]],
                [0, 0, 1]]

Compare this to the camera matrix defined in this Open CV tutorial:
image

with cx and cy being the respective center points.

It seems like the center points for the x and y directions are swapped. Or am I confusing something here?

@jim-meyer
Copy link

I noticed the same thing @MrMho . It sure looks like they need to be swapped. It's only noticeable in non-1:1 aspect ratio images though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants