Apriltags v3的Python绑定

pupil-apriltags的Python项目详细描述


小学生apriltags:apriltags3库的Python绑定

这些是由AprilRobotics开发的Apriltags3库的python绑定,经过专门调整后可与学生实验室软件一起使用。最初的绑定是由duckietown提供的,灵感来自Apriltags2 bindingsMatt Zucker

如何开始:

从pypi安装

这是推荐的最简单的安装瞳孔的方法

$ pip install pupil-apriltags

我们为常见的操作系统提供预构建的二进制轮子。 如果系统不匹配,则安装可能需要一些时间,因为将首先编译本机库(apriltags源)

通过github的当前主分支从源安装

$ pip install git+https://github.com/pupil-labs/apriltags

从源头手动安装

当然,您可以手动克隆存储库并从中构建。我们使用scikit-build而不是普通的python设置工具,因为skbuild使使用本机库更加容易。构建仍然通过标准的python setup.py [options]命令进行控制,但是skbuild负责在后台独立编译aprltags源代码。

用法

src/pupil_apriltags/bindings.py文件中可以看到一些用法示例。

Detector类是apriltags功能的包装器。您可以如下初始化:

at_detector = Detector(searchpath=['apriltags'],
                       families='tag36h11',
                       nthreads=1,
                       quad_decimate=1.0,
                       quad_sigma=0.0,
                       refine_edges=1,
                       decode_sharpening=0.25,
                       debug=0)

选项是:

OptionDefaultExplanation
families'tag36h11'Tag families, separated with a space
nthreads1Number of threads
quad_decimate2.0Detection of quads can be done on a lower-resolution image, improving speed at a cost of pose accuracy and a slight decrease in detection rate. Decoding the binary payload is still done at full resolution. Set this to 1.0 to use the full resolution.
quad_sigma0.0What Gaussian blur should be applied to the segmented image. Parameter is the standard deviation in pixels. Very noisy images benefit from non-zero values (e.g. 0.8)
refine_edges1When non-zero, the edges of the each quad are adjusted to "snap to" strong gradients nearby. This is useful when decimation is employed, as it can increase the quality of the initial quad estimate substantially. Generally recommended to be on (1). Very computationally inexpensive. Option is ignored if quad_decimate = 1
decode_sharpening0.25How much sharpening should be done to decoded images? This can help decode small tags but may or may not help in odd lighting conditions or low light conditions
searchpath['apriltags']Where to look for the Apriltag 3 library, must be a list
debug0If 1, will save debug images. Runs very slow

通过运行检测器的detect方法来检测图像中的标记:

tags = at_detector.detect(img, estimate_tag_pose=False, camera_params=None, tag_size=None)

如果还要提取标记姿势,则应将estimate_tag_pose设置为True,并应提供camera_params[fx, fy, cx, cy])和tag_size(以米为单位)detect方法返回一个Detection对象列表,每个对象都具有以下属性(请注意,带星号的对象仅在estimate_tag_pose=True时计算):

AttributeExplanation
tag_familyThe family of the tag.
tag_idThe decoded ID of the tag.
hammingHow many error bits were corrected? Note: accepting large numbers of corrected errors leads to greatly increased false positive rates. NOTE: As of this implementation, the detector cannot detect tags with a Hamming distance greater than 2.
decision_marginA measure of the quality of the binary decoding process: the average difference between the intensity of a data bit versus the decision threshold. Higher numbers roughly indicate better decodes. This is a reasonable measure of detection accuracy only for very small tags-- not effective for larger tags (where we could have sampled anywhere within a bit cell and still gotten a good detection.)
homographyThe 3x3 homography matrix describing the projection from an "ideal" tag (with corners at (-1,1), (1,1), (1,-1), and (-1, -1)) to pixels in the image.
centerThe center of the detection in image pixel coordinates.
cornersThe corners of the tag in image pixel coordinates. These always wrap counter-clock wise around the tag.
pose_R*Rotation matrix of the pose estimate.
pose_t*Translation of the pose estimate.
pose_err*Object-space error of the estimation.

自定义布局

如果要使用自定义布局,则需要为其创建C源文件和头文件,然后重新生成库。然后使用新的libapriltag.so库您可以找到有关原始Apriltags repository的更多信息

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java正在寻找Java8中的内置函数以忽略异常   javascript JQuery更改Div的颜色   java PostgreSQL使用JDBC写入inet列   java为什么体重指数计算结果不正确?   java禁用linux中的log4j控制台日志记录   java我可以让我的JMS主题在新订阅者连接时通知发布者(使用ActiveMQ)   基于三个浮点输入的java过滤器JTable?   Java OpenGL/LWJGL体素纹理   在SpringBoot java应用程序中,有没有一种方法可以通过不同的机器使用hostIP作为主机远程连接到redis服务器   java Struts 2 s:提交按钮语法以在映射中设置值   java源代码:setDomainEnv。windows 7中的cmd文件   缺少货币计算java的返回语句   JavaHibernate没有注意到从其他源进行的数据库更新   无法在OpenCV/Java中生成负矩阵   Java不做循环   java无法使用类对象写入文件ArrayList   jpa使用数组作为调用Java的存储过程的输入   java使用文件提供程序检索内容Uri失败   需要java程序来创建方法模板