thegoodhen / apriltools Goto Github PK
View Code? Open in Web Editor NEWA marker-based camera tracker for Blender based around the AprilTags Library by University of Michigan
License: GNU General Public License v3.0
A marker-based camera tracker for Blender based around the AprilTags Library by University of Michigan
License: GNU General Public License v3.0
You should add GitHub Actions to this repo so its easier to retrieve build artifacts.
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 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.
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.
You can leave libraries in there, (if the licenses support it), but don't package pre-built stuff in source code. (unless those files are old, then ignore me)
When I try to import in blender 2.9 i just get three errors.
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 ?
You should probably add a .gitignore, here is the most basic one which just ignores editor tmp files:
*.tmp*
*.swp*
*swp*
*~*
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!
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".
`
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.
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.
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.
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
also important note: estimating focal length worked normally
Last commit was in 2020, what happened, did you forget about it or did real life get in the way?
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
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
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.
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!
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.
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
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
(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)
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)
When i attempt to import the python script nothing happens. I don't get any errors either.
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.
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.
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.
When I estimate the focal length with AprilTools, the focal length estimate stays at -1.00. This doesn't change for a long time.
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!
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.
:(
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.
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.
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.
This would be a nice feature to have, as it would make the import process more convenient.
I've been following CGMatter's tutorial on AprilTools and encountered this issue the first, and every time I try to use AprilTools:
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.
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
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.
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?
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
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)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.