thegoodhen / AprilTools

A marker-based camera tracker for Blender based around the AprilTags Library by University of Michigan
GNU General Public License v3.0
253 stars 29 forks source link

estimate-focal-length does not work for 4K video #7

Open i124q2n8 opened 5 years ago

i124q2n8 commented 5 years ago

I read #6 and filmed the footage according to the requirements. (.png, ~500 Frames) Running --estimate-focal-length on the footage yields only one estimate != -1.

Down scaling the sequence to 25% of the original resolution does work and yields useful results. Down scaling to 50% doesn't work either.

What is the optimal resolution to estimate the focal length?

Tracking on 50% with --focal-length-pixels {estimated focal length for 25% * 2} does work.

Maybe adding --focal-length-percent would be a nice addition to be independent from the actual resolution. Not sure whether this will work in general.

thegoodhen commented 5 years ago

...Oh. Right. Of course it does!

I will fix that. That's a bug, which should be easy to fix. The focal length estimation uses vanishing points to estimate the focal length. It extends the sides of the square tag and finds intersection. To combat numerical instabilities, when the intersection is "too far away," it gives up, assuming that the sides are parallel. But the value for "too far away" was determined empirically on a fullHD footage. It should scale with the frame size, which it doesn't (such a dumb oversight :D) .

thegoodhen commented 5 years ago

It should be fixed. Can you please confirm it?

i124q2n8 commented 5 years ago

Now i don't even get results with the down scaled version. I am going to look into this later.

thegoodhen commented 5 years ago

Damnit. That makes no sense. Well, at least it changed, so the problem is somewhere close.

thegoodhen commented 5 years ago

Aha! I think I know. Is the tag small, or viewed mostly from the front?

thegoodhen commented 5 years ago

@MAP94 poke

fvlasie commented 4 years ago

It is working for me with 4K footage!

Many thanks!