- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有一个 n:2 矩阵,其中点 (x,y) 从矩形校准图案中的点中找到。我喜欢将这些点逐行排序。我已经用 lexsort 对这些点进行了排序,但是相机的失真太大,以至于 y 坐标会重叠。
imageloading...
blobs=imageprocessing....
coordinates=np.array([blob.centroid() for blob in blobs])
nd=np.lexsort((coordinates[:,0],coordinates[:,1]))
coordinates=coordinates[ind]
有没有办法借助 delaunay 模式对行进行排序?
import matplotlib.tri as tri
x=coordinates[:,0] y=coordinates[:,1]
triang = tri.Triangulation(x, y)
最佳答案
使用三角测量确实很有趣,可以用于您的应用:
import numpy as np
import matplotlib.tri as tri
import matplotlib.pyplot as plt
import random
# create fake data
x,y = np.meshgrid(np.arange(10), np.arange(10))
x = x.flatten()
y = y.flatten()
coordinates = np.column_stack([x,y])+0.04 * np.random.rand(len(x), 2)
np.random.shuffle(coordinates)
x=coordinates[:,0]
y=coordinates[:,1]
# perform triangulation
triang=tri.Triangulation(x,y)
f = plt.figure(0)
ax = plt.axes()
tri.triplot(ax,triang)
# find horizontal edges
f = plt.figure(1)
e_start = coordinates[triang.edges[:,0]]
e_end = coordinates[triang.edges[:,1]]
e_diff = e_end - e_start
e_x = e_diff[:,0]
e_y = e_diff[:,1]
e_len = np.sqrt(e_x**2+e_y**2)
alpha = 180*np.arcsin(e_y/e_len)/np.pi
hist, bins, patches = plt.hist(alpha, bins=20)
# in the histogram, we find that the 'horizontal' lines
# have an alpha < 10.
ind_horizontal = (-10<alpha) & (alpha < 10)
edges_horizontal = triang.edges[ind_horizontal]
plt.show()
结果,你在 edges_horizontal 中得到水平边,它是一个二维数组 [[p_{0},p_{1}], ..., [p_{n}, p_{n+ 1}]]
,其中 p_i 是 coordinates
数组的索引。
关于python - 使用 numpy 对 2d 校准模式点进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13935913/
使用 Kinect for Windows SDK,校准相机的最简单方法是什么? 我找到了这篇可爱的博文 http://nicolas.burrus.name/index.php/Research/K
我最初在 OpenCV 论坛上发布了这个,但不幸的是,我没有得到太多的意见/回复,所以我在这里发布是希望有人可能有方向建议? 我正在使用 Bumblebee XB3 立体相机,它有 3 个镜头。我花了
当移动很远的距离时,比如去另一个城市,关闭 GPS,打开它需要很长时间才能找到第一个正确的点。 因此,如果我通过示例注册到 gps 提供程序,则可能需要 10 分钟才能收到第一个 onLocation
在我的应用中,我使用加速度计来控制游戏中的角色。现在我只允许纵向,所以用户必须向右或向左倾斜设备才能移动角色。到目前为止一切正常。我现在想要完成的是“校准”加速度计以考虑用户正在玩的当前倾斜度。假设用
我使用 2 个 CANON EOS60d 作为立体设置来进行摄影测量。我正在使用 OpenCV 使用高精度 Circlegrid 校准模式校准两个相机。我正在使用信号发生器同时触发两个相机,早些时候我
我花了很长时间才让函数在 OpenCV 中运行,所以我想知道我的总体计划是否有意义,然后再深入研究尝试实现它的细节。 (2.3.1、Windows 7、C++)如果有任何建议,我将不胜感激。 问题:
我注意到 h2o.ai 套件的一个相对较新的添加,能够执行补充 Platt Scaling 以改进输出概率的校准。 (请参阅 calibrate_model in h2o manual 。)不过,在线
我正在尝试在 STM32F042 微 Controller 上读取 VDDA。我在 VDD 为 3.29V 时得到了意想不到的结果。我一定缺少一些基本的东西。 输出: VREFINT=1917; VR
请原谅我对编码完全陌生。首先,出于该项目的目的,我正在使用 Python 绑定(bind)到 OpenCV 的库。 我的相机已针对显示鱼眼失真进行了校准。我分别获得了 K 和 D 的以下值,即固有相机
如何使用 Netbeans 8.1 进行 JDK 校准。我用谷歌搜索了一些并找到了这个链接 here . It says "choose Profile > Advanced Commands > R
我目前正在开发增强现实应用程序。目标设备是光学透视 HMD,我需要校准其显示器以实现虚拟对象的正确注册。我用过那个implementation of SPAAM对于 android 来说,结果对于我的
我是一名优秀的程序员,十分优秀!