GithubHelp home page GithubHelp logo

thegoodhen / apriltools Goto Github PK

View Code? Open in Web Editor NEW
249.0 249.0 29.0 25.2 MB

A marker-based camera tracker for Blender based around the AprilTags Library by University of Michigan

License: GNU General Public License v3.0

C++ 78.72% Python 20.03% CMake 1.25%

apriltools's People

Contributors

c3ypt1c avatar f0x52 avatar thegoodhen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apriltools's Issues

CI/CD

You should add GitHub Actions to this repo so its easier to retrieve build artifacts.

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

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.

the "Searching for files" step is unreasonably slow

The compareFilenames and isFileAcceptable methods both use regular expressions. When the total number of frames reaches hundreds, sorting them can take tens of seconds.

The two methods should be rewritten without the use of regular expressions.

Run AprilTools on linux

Hello, there!

I just did the cmake and the make in the source directory, but I dont know how to use the program in linux (Ubuntu). Do I need to follow the same instructions for windows users? For example: apriltools.exe --path "PATH_TO_THE_FOLDER_WITH_THE_IMAGE_SEQUENCE_INSIDE" --estimate-focal-length

If is not, what is the correct way to use the program in the command line?

Thanks.

AprilTag returns a focal Length estimation of -1.00 px

Hello,

Tried some dslr footage, and the lens estimation returned a value of -1.000 for the focal length in pixels, which does not work for the rest of the tracking operations. Do you have any idea what could cause this ?

Add a .gitignore

You should probably add a .gitignore, here is the most basic one which just ignores editor tmp files:

*.tmp*
*.swp*
*swp*
*~*

Shaky 3d objects despite good tracking

I have been using April Tools with a fair amount of success. Recently I shot a video and tracked it. Admittedly the footage is shaky, but the grey marker covered the black tag perfectly all throughout, leading me to think that the tracking was just fine. However, another object in my scene (a Porsche) bounced around quite a lot. I'm not sure if this is an issue or some kind of user error. Here is a youtube video of my attempt.

Any help would be much appreciated!

When using Cmake, the source direction /apriltag does not contain a CMakeLists.txt file.

Here is my log for trying to build on Manjaro Linux:

`- The C compiler identification is GNU 10.1.0
-- The CXX compiler identification is GNU 10.1.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr (found version "4.3.0")
CMake Error at CMakeLists.txt:12 (add_subdirectory):
The source directory

/home/gstarr/Documents/tools/AprilTools/apriltag

does not contain a CMakeLists.txt file.

-- Configuring incomplete, errors occurred!
See also "/home/gstarr/Documents/tools/AprilTools/build/CMakeFiles/CMakeOutput.log".
`

Error when trying to enable the importer addon in Blender 2.80

When I try to enable the addon for importing the tracking data, Blender 2.80 throws this error:
Traceback (most recent call last): File "C:\Program Files\Blender Foundation\Blender\2.80\scripts\modules\addon_utils.py", line 351, in enable mod = __import__(module_name) File "C:\Users\chris\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\apriltags_import.py", line 2, in <module> import numpy as np File "C:\Users\chris\AppData\Roaming\Python\Python37\site-packages\numpy\__init__.py", line 142, in <module> from . import core File "C:\Users\chris\AppData\Roaming\Python\Python37\site-packages\numpy\core\__init__.py", line 23, in <module> WinDLL(os.path.abspath(filename)) File "C:\Program Files\Blender Foundation\Blender\2.80\python\lib\ctypes\__init__.py", line 356, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application
This also happens on Blender 2.81.

Switch to ArUco

Under Windows, Cygwin needs to be used to compile this program; however, this means that the feature-limited version of OpenCV for Cygwin needs to be used. By using an ArUco marker tracking library instead of the Apriltags library, the code could be compiled natively under both Windows and Linux. This would allow the most full-featured OpenCV version to be used and would also simplify further development. For this reason, this is now a very high priority. Positional accuracy tests need to be carried out to ensure that the ArUco library is good enough for the task.

Import addon only creating one keyframe

After creating the track.txt and importing into Blender, there's only one single keyframe at frame 3.

Peeking into the track.txt, it seems the first value, which normally shows the track number, is 3 for each line. e.g.

3, -0.1799,-0.2406,-0.7874,-0.0587,0.0438,0.7369
3, -0.0465,-0.1112,-0.7868,-0.0440,0.0304,0.7635
3, -0.0547,-0.1188,-0.7915,-0.0415,0.0326,0.7671
3, -0.0625,-0.1284,-0.8005,-0.0424,0.0392,0.7712
3, -0.0698,-0.1437,-0.8055,-0.0436,0.0432,0.7733

(Had some other issues with the released version so I downloaded the zip)

april tools does not detect the contents of this folder

april tools does not detect the contents of this folder.
solutions ive tried
-moving the images to a different folder
-changing the name of the folder the images are in
-splitting the source video into images again and using those instead
-using a different file extension (changing from .png to .jpg)
-restarting apriltools
no solution ive tried did anything

image
image

also important note: estimating focal length worked normally

estimate-focal-length no tag found issue

Edit: I am sorry, it does the estimation and the tracking anyways. I thought it might cause any issues, but all good. So sorry again.

I am trying to estimate the focal length, but I get this error that says no tag found. I even tried to do it with the sequence provided in the zip folder, but it didn't work. Here is a video of the issue: https://youtu.be/zDPIJQB1ri4

Blender can't proccess / load the track.txt data

Hello, I tried on other blender builds as well.
Either Blender refuses to activate the plugin addon when I click on the tickbox / or it stops when I load the track.txt file, returning this message :

Capture

Tag is not aligned with marker on vertical video

Here is one of the frame:
image

The video was recorded vertically at 4k and rotated 90° on Adobe Premiere and exported as 2160x3840 PNG. I don't remember seeing any errors during the tracking process, but maybe I just didn't notice it.

I'm not really sure how to get everything to be aligned/tracked properly, I tried moving stuff around but I couldn't get it to be correctly aligned

Adding all apriltag families

How would I go about adding the entirety of the Apriltag families for tracking? I'm not crazy familiar with cmake which from what I can tell is how I would go about making this happen?

Long story short I printed out tags not in the PDF by accident and if I could it would make it much easier just to add tags outside the pdf.

Thank you.

Feature request: Respect camera orientation

At the moment, the tag is always laid flat on the ground in Blender, even if it was e.g. pinned at a wall in the video. If possible, it would be very nice, if the correct orientation would be imported into the Blender scene.

Awesome work, by the way!

A readme for python-rewrite?

Can you do a quick code cleanup and include a readme on python rewrite? I tried running the script and came a long way to success but it's really hard and couldn't make it and searching for help :D As I am able to understand the new code it's using aruco which is supposed to be more accurate (?) and supports multiple tags.

Build from source gets stuck at 21% on OSX

When attempting to build from source on OSX, build gets stuck here after running make:

Scanning dependencies of target apriltag
[ 2%] Building C object apriltag/CMakeFiles/apriltag.dir/apriltag.c.o
[ 5%] Building C object apriltag/CMakeFiles/apriltag.dir/apriltag_pose.c.o
[ 8%] Building C object apriltag/CMakeFiles/apriltag.dir/apriltag_quad_thresh.c.o
[ 10%] Building C object apriltag/CMakeFiles/apriltag.dir/tag16h5.c.o
[ 13%] Building C object apriltag/CMakeFiles/apriltag.dir/tag25h9.c.o
[ 16%] Building C object apriltag/CMakeFiles/apriltag.dir/tag36h11.c.o
[ 18%] Building C object apriltag/CMakeFiles/apriltag.dir/tagCircle21h7.c.o
[ 21%] Building C object apriltag/CMakeFiles/apriltag.dir/tagCircle49h12.c.o

Issue when trying to import to blender

When i try to import the text file to blender (Blender 3.1)
It shows 3 errors
Do i have to downgrade to lower versions like 2.8 its also fine by me
I even tried with the sample video and it didnt work either
image
(the camera has no rotation or position by that i mean the rotation is 0,0,0 and position is 0,0,0 on all axis)

Multiple tags tracking

I tried to track multiple tags, but the camera just switch from one tag to another.
Will it be implemented one day ?

Thanks for this project tho ! Working great when there's only one tracker in the scene

(also coming from CGMatter's video, otherwise I'ld not have known about it haha)

Focal length estimatation works with landscape video but not portrait

I'm just leaving this here for anyone who might be running into this issue, or who might possibly have a solution.

I'm shooting HD video on an Iphone 12 (non-wide lens), and I've noticed that when I supply april tools with "upright" images vs "landscape" images, the focal length estimation always fails.

I tried all kinds of things to get the focal length estimation to work on upright shots (different angles, providing more frames, different lighting, backdrops, etc) and nothing seemed to work.

But once I switch to landscape mode (1920x1080) the estimation worked.

Tracking not working

I can't track my footage. The included "testAnim" estimates and tracks fine, but when I try it on any other footage, every frame is unusable.

Missing LICENSE

There is no LICENSE or COPYING file for this project. The default is copyright.

You should license this project under the AGPL3 or GPL3 license. Directions on how to apply the license are at the bottom of the license file under the How to Apply These Terms to Your New Programs heading. There is a helpful guide for the GPL at https://www.gnu.org/licenses/gpl-howto.en.html. If you would like me to submit a PR to make this easier, I would be happy to do that.

--estimate-focal-length always returns -1.00.

Hi, I downloaded this software today, and I recorded some footage to test it with. When I run --estimate-focal-length I get -1.00 for all 154 frames. I assume this is because of bad camera quality or something, but the camera quality seems good enough to be able to calculate the focal length at least one time out of 154.

This software is amazing and I hope I can get it to work, so any help would be appreciated. Thanks!

MacOS compilation error

Hello,

In trying to follow these instructions:

Now to compile, from the source directory run the following:

mkdir build
cd build
cmake ..
make

I get:

CMake Error at CMakeLists.txt:12 (add_subdirectory):
  The source directory

    /Users/admin/Downloads/AprilTools-master/apriltag

  does not contain a CMakeLists.txt file.

:(

Tracking stops on frame 73

On exactly frame 73, my camera stops moving, and there are no more keyframes for it in Blender, despite the fact that I have a 282 frame video.

'python_build_flags.py' not found

Tested on raspberry pi. The prebuilt version doesn't work due to difference in architecture, cmake finishes successfully but says that file 'python_build_flags.py' doesn't exist, and make returns Error 2. This doesn't depend on the OS - I tried both Kali and raspbian.

Focal Length Estimation -1 px

I'm having trouble getting a focal length estimation. I'm using a perspective shot as recommended. The program recognizes the tag but cannot estimate focal length. My tag is also not printed an on an iPad screen. Not sure if that is supported or would cause any issues.

cygheap base mismatch detected

I've been following CGMatter's tutorial on AprilTools and encountered this issue the first, and every time I try to use AprilTools:
image
I initially had no cygwin installed. I got the issue, so I tried installing it. I installed the 64bit version which did not help. I then installed the 32bit version which also did not help.

Key frames missing from imported marker

Once the marker is imported from the tracking text file into Blender, the key frames appear to be missing, and as a result, the tag cannot be tracked.

Using fresh Blender 2.80 (With AprilTools add-on)
Deleted and re downloaded AprilTools
Remade tracking file, all commands returned with no error
Tracking file does contain coordinates

Live Video Feed

I haven't gotten the time to try this beauty of a masterwork out yet, but I'm wondering if there are any possibilities for tracking a live video feed? Without writing a file and then processing it which would put a lot of wear on the storage device.

Import track to blender camera not moving

It did everything fine until I imported the txt file into blender with camera movement selected but when I went into camera view nothing moved and it didn't work at all. Any help?

Cannot import tracking file

When I was trying to import a file, a got this error:
RuntimeError: Error: Cannot read 'first line of tracking data'. No such file or directory.
I'm using blender 2.80

there is nothing in the .txt , and all the file where unusable when trying to track!

ok the i found out that in the .txt there is nothing, and all the file where unusable when trying to track!

the command i put in is
.\apriltools.exe --path "K:\secwence UwU" --focal-length-mm 29 --sensor-width 3.60 --tag-size 73

and im recording on a iphone 6
i wold send the image sequence but the folder is 10gb (1080p 60fps 677 frames)

Missing apriltag.h

First of all, I'd like to thank you for such a great library.
I would like to compile this myself (for Linux), but I don't see these files anywhere:
apriltag.h
tag36h11.h
tag25h9.h
tag16h5.h
tagCircle21h7.h
tagCircle49h12.h
tagCustom48h12.h
tagStandard41h12.h
tagStandard52h13.h
common/getopt.h
common/image_u8.h
common/image_u8x4.h
common/pjpeg.h
common/zarray.h
common/g2d.h
apriltag_pose.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.