8000 Aaron/fix pin to 0 code by aaroncherian · Pull Request #686 · freemocap/freemocap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Aaron/fix pin to 0 code #686

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Aaron/fix pin to 0 code #686

wants to merge 6 commits into from

Conversation

aaroncherian
Copy link
Collaborator

After a good bit of digging, I believe I've found the issue the pin_camera_0_to_origin code, which lies in how we're handling different coordinate systems.

Currently we're trying to move each cameras tvec by applying a transformation that would place camera 0's position at [0,0,0]. However, each cameras tvec exists in its own local reference frame, not in the world coordinate system.

So currently we calculate a translation in the context of camera 0's coordinate system and then try to apply this same translation to other cameras with different orientations. This means that this function hasn't been rigidly moving the cameras as a set - it's been changing the spatial relationships between cameras. This explains why different 'translations' that have been applied (for example, how which video was listed as 'camera 0' led to a different translation to origin vector) has led to differently scaled data.

The solution that I've tried to implement here is to calculate the translation needed to get camera 0 to the origin in the world coordinate system, not in camera 0's specific coordinate system. Then, we take this world-space translation, transform it into each cameras local coordinate system, and apply it.

@aaroncherian
Copy link
Collaborator Author
aaroncherian commented Apr 17, 2025

The big question, does it work? It seems to!

image

Here we have 3 plots - data with the original calibration (no pin to origin), with our current pin to origin code (the big skeleton guy in orange), and with the fixed pin to origin code in the PR. The fixed pin to origin and the original calibration now line up exactly

@aaroncherian
Copy link
Collaborator Author
aaroncherian commented Apr 17, 2025

Another indication that it works:

Before this, we were seeing that the video chosen as camera_0, aka the reference frame, had a major impact on scaling (data from the results of rearranging the video order when calibration and reconstructing data):
image

But now the data is much more closely aligned regardless of which video was chosen as camera 0
image

@aaroncherian
Copy link
Collaborator Author
aaroncherian commented Apr 17, 2025

What this also means is that the true issue causing the bugs mentioned in this issue (#681) was at the core, never related to the OS or the video order. The reason that when we sorted the videos we saw alignment is just because the tvecs for camera 0 were relatively the same between each OS, so the data looked really similar, but was not necessarily more accurate. They would have all suffered from the same 'distortion' from the improper pinning.

Thankfully, this also means that the video chosen as camera 0 doesn't matter that much, which is a relief.

@aaroncherian
Copy link
Collaborator Author

I've added an extra step to zero out the rotation as well before zeroing out the translation, which seems to work?

image

Copy link
Collaborator
@philipqueen philipqueen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running through a couple of test recordings this looks good!

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

Successfully merging this pull request may close these issues.

[BUG] 3D data is different on the same test data depending on OS
2 participants
0