duckietown / apriltags3-py Goto Github PK
View Code? Open in Web Editor NEWPython bindings for the apriltags3 library
License: Other
Python bindings for the apriltags3 library
License: Other
Hi,
Thanks for your work!
I encountered this problem when I was testing examples in the apriltags3.py
file.
I'm using ubuntu 16.04 LTS, and I installed Apriltags3 library by cmake:
$ cmake .
$ sudo make install
When testing, TESTING WITH A SAMPLE IMAGE
worked fine. But TESTING WITH ROTATION IMAGES
couldn't work. After loading the first image test_image_rotation_0.png
, it shows the error below:
*** Error in `python': free(): invalid pointer: 0x00007f5923ab6308 ***
I found that for test_image_rotation_0.png
, it has detected the tag. But things went wrong when estimating the pose.
err = self.libc.estimate_tag_pose(ctypes.byref(info), ctypes.byref(pose))
print("estimated pose")
I found that by adding some "print" between lines. For test_image_rotation_0.png
the pose was never estimated.
Could you help me with it?
Update: I went back to see the output for TESTING WITH A SAMPLE IMAGE
and noticed that homography matrix are all zeros. But I think this could be because they are now using orthogonal iteration instead of homography.(I think the homography method is still used for initial estimation for orthogonal iteration method) Because CURRENTLY NOT IMPLEMENTED DUE TO A NULL POINTER ERROR ON RPI
. Please correct me if I'm wrong. And I thought those information would help.
TESTING WITH ROTATION IMAGES
Testing image test_image_rotation_0.png
*** Error in `python': free(): invalid pointer: 0x000055891591512e ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f8e457e37e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f8e457ec37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f8e457f053c]
apriltags/lib/libapriltag.so(matd_destroy+0x45)[0x7f8e2f9511c7]
apriltags/lib/libapriltag.so(estimate_tag_pose+0x83)[0x7f8e2f67b58d]
/home/dt/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c)[0x7f8e44645ec0]
/home/dt/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d)[0x7f8e4464587d]
/home/dt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce)[0x7f8e45d9eeee]
/home/dt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(+0x13924)[0x7f8e45d9f924]
python(_PyObject_FastCallKeywords+0x4ab)[0x55891597365b]
python(_PyEval_EvalFrameDefault+0x532e)[0x5589159cf40e]
python(_PyEval_EvalCodeWithName+0x2f9)[0x55891590ff19]
python(_PyFunction_FastCallKeywords+0x325)[0x5589159722d5]
python(_PyEval_EvalFrameDefault+0x535)[0x5589159ca615]
python(_PyEval_EvalCodeWithName+0x2f9)[0x55891590ff19]
python(PyEval_EvalCodeEx+0x44)[0x558915910dd4]
python(PyEval_EvalCode+0x1c)[0x558915910dfc]
python(+0x22f9e4)[0x558915a299e4]
python(PyRun_FileExFlags+0xa1)[0x558915a33bd1]
python(PyRun_SimpleFileExFlags+0x1c3)[0x558915a33dc3]
python(+0x23aedb)[0x558915a34edb]
python(_Py_UnixMain+0x3c)[0x558915a34fbc]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f8e4578c830]
python(+0x1dfed2)[0x5589159d9ed2]
Update again: I tested it with some images taken by myself. Some of the images also crashes, but this time it says there is an error (see below). I looked at apriltag_pose.c
it says this can happen when the prior pose estimate (which is the "homography method" here I believe) was not very good. At least this kind of error is triggering the Error in python : free(): invalid pointer: ...
as well.:
*****image: 001150.jpg
----- 0 tag(s) detected
*****image: 001160.jpg
Error, more than one new minima found.
*** Error in `python': free(): invalid pointer: 0x000055e2b8e3f12e ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fd17ae647e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fd17ae6d37a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd17ae7153c]
apriltags/lib/libapriltag.so(matd_destroy+0x45)[0x7fd1654061c7]
apriltags/lib/libapriltag.so(estimate_tag_pose+0x83)[0x7fd16513058d]
/home/dt/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c)[0x7fd179dc6ec0]
/home/dt/anaconda3/lib/python3.7/lib-dynload/../../libffi.so.6(ffi_call+0x22d)[0x7fd179dc687d]
/home/dt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux- gnu.so(_ctypes_callproc+0x2ce)[0x7fd17b41feee]
/home/dt/anaconda3/lib/python3.7/lib-dynload/_ctypes.cpython-37m-x86_64-linux-gnu.so(+0x13924)[0x7fd17b420924]
python(_PyObject_FastCallKeywords+0x4ab)[0x55e2b8e9d65b]
python(_PyEval_EvalFrameDefault+0x532e)[0x55e2b8ef940e]
python(_PyEval_EvalCodeWithName+0x2f9)[0x55e2b8e39f19]
python(_PyFunction_FastCallKeywords+0x325)[0x55e2b8e9c2d5]
python(_PyEval_EvalFrameDefault+0x535)[0x55e2b8ef4615]
python(_PyEval_EvalCodeWithName+0x2f9)[0x55e2b8e39f19]
python(PyEval_EvalCodeEx+0x44)[0x55e2b8e3add4]
python(PyEval_EvalCode+0x1c)[0x55e2b8e3adfc]
python(+0x22f9e4)[0x55e2b8f539e4]
python(PyRun_FileExFlags+0xa1)[0x55e2b8f5dbd1]
python(PyRun_SimpleFileExFlags+0x1c3)[0x55e2b8f5ddc3]
python(+0x23aedb)[0x55e2b8f5eedb]
python(_Py_UnixMain+0x3c)[0x55e2b8f5efbc]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fd17ae0d830]
python(+0x1dfed2)[0x55e2b8f03ed2]
Hey, thanks a lot for this binding, works great! ๐
I'm not sure how should I use it as a dependency. Currently, I clone the repo next to my sources and patch it with an __init__.py
so I can import the apriltags3.py
, but this doesn't feel like the best way (i don't have much experience with python).
The pupil fork has a nice scikit-build based solution to turn this into a pip installable package. It'd be great to have something similar here.
Line 435 in e4e7787
Hello, I love this wrapper! Works perfectly fine for me under Linux. But... I cannot get it to work on my Windows7 machine.
First I was running into problems such as missing tools, but with the help of windows command line, git bash and 2 different versions of cygwin, I managed to run both the "cmake ." and "make" commands.
Well, the C example which uses opencv failed, since I don't have opencv installed, but whatever. I just deleted it out of the makefile. The other C example works fine (woohoo!)
Since the os.uname doesn't do anything under Windows, I edited that and just hardcoded the filename to be 'libapriltag.so'. I also edited the relative path, because I have no /lib or /lib64 folders anywhere... I guess those would be created if I typed "make install" ? But that failed with "process_begin: CreateProcess(NULL, ldconfig, ...) failed. make (e=2): System cannot find the file."
But anyway, so I made sure the path to the .so file is correct. It still failed, but I figured out that I was using 32 bit python with 64 bit library.
So I fixed THAT problem too, but now... It is just randomly failing.
File "L:/personal/tracker/pycharm2/apriltags3.py", line 253, in __init__
self.tag_detector_ptr = self.libc.apriltag_detector_create()
OSError: exception: access violation writing 0x0000000000000000
File "L:/personal/tracker/pycharm2/apriltags3.py", line 269, in __init__
self.libc.apriltag_detector_add_family_bits(self.tag_detector_ptr, self.tag_families['tag36h11'], 2)
OSError: exception: access violation reading 0x000000000000FFF8
L:/personal/tracker/pycharm2/apriltags3.py:462: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
parameters = yaml.load(stream)
TESTING WITH A SAMPLE IMAGE
Process finished with exit code -1073740771 (0xC000041D)
File "L:/personal/tracker/pycharm2/apriltags3.py", line 269, in __init__
self.libc.apriltag_detector_add_family_bits(self.tag_detector_ptr, self.tag_families['tag36h11'], 2)
OSError: exception: access violation reading 0x000000000000001A
Traceback (most recent call last):
File "L:/personal/tracker/pycharm2/apriltags3.py", line 459, in <module>
debug=0)
File "L:/personal/tracker/pycharm2/apriltags3.py", line 269, in __init__
self.libc.apriltag_detector_add_family_bits(self.tag_detector_ptr, self.tag_families['tag36h11'], 2)
OSError: exception: access violation reading 0xFFFFFFFFFFFFFFF8
Sometimes it doesn't crash, but instead hangs randomly... What is going on... do you know how I could fix it? ;( I ran out of ideas... Thank you!
Dear @duckietown
We would like to use your bindings for https://github.com/pupil-labs/pupil but noticed that you did not provide a license for your bindings.
Please consider adding a license (ideally one compatible with GNU Lesser General Public License (LGPL v3.0) ๐) in order to allow users the usage of your bindings.
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.