- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试求解变换矩阵 M(以其数值形式)。源点已知(s1、s2、s3、s4),目标点也已知(d1、d2、d3、d4)。来自金字塔的点。该变换是任意的,并将每个点 sn 映射到其目标 dn。
显然 s1 到 s4 和 d1 到 d4 是已知的并且使用数值,为了清楚起见,这样呈现它们
s1 = np.matrix([[s1x],[s1y],[s1z],[0]])
s2 = np.matrix([[s2x],[s2y],[s2z],[0]])
s3 = np.matrix([[s3x],[s3y],[s3z],[0]])
s4 = np.matrix([[s4x],[s4y],[s4z],[0]])
d1 = np.matrix([[d1x],[d1y],[d1z],[0]])
d2 = np.matrix([[d2x],[d2y],[d2z],[0]])
d3 = np.matrix([[d3x],[d3y],[d3z],[0]])
d4 = np.matrix([[d4x],[d4y],[d4z],[0]])
对于每个点,dn = M x sn与:
M = np.matrix([4,4])
一般公式好像在这里:https://en.wikipedia.org/wiki/Transformation_matrix#Finding_the_matrix_of_a_transformation
我基本上是想把它放在代码形式中,如果可能的话降低复杂性以便使用 numpy linalg 求解器。
我检查了其他线程,我的问题实际上是关于一般情况的。 (最少需要4分)
最佳答案
也许我遗漏了什么,但这可以分两行完成:
# set up
# create example affine trafo in homogeneous coordinates
M = np.r_[np.random.normal(size=(3,4)),[[0,0,0,1]]]
n = 4 # or more
# create n points as the columns of s
# note that homogeneous coordinates have a "dummy" 1, not 0, as last element
s = np.r_[np.random.normal(size=(3,n)),np.ones((1,n))]
# apply trafo, transformed points are the columns of d
d = M@s
# solve
# solving is as simple as
M_rec,resid,rank,sing = np.linalg.lstsq(s.T,d.T)
M_rec = M_rec.T
# you may want to inspect resid (should be small),
# rank (should be 4) and sing (shouldn't spread too wide)
# check
np.allclose(M,M_rec)
# True
关于python - NumPy 的 : Finding the tranformation matrix given 2 sets of 4 points in 3D euclidian coordinates,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57991865/
我有一个 合作伙伴集合,我正在使用 pymongo 来检索数据 当我使用 MongoDB 查询集合时,我看到以下结果 db.partner.find({'unique_key': 'c89dbe313
嗨,我正在尝试在一个 find 命令中查找所有 js 和 css 文件。我尝试了以下所有方法但徒劳无功: find WebContent -name "*.[jc]ss?" find WebConte
我使用以下 find 命令查找并显示所有具有输入文本模式的文件。 找 。 -type f -print|xargs grep -n "模式" 我有很多项目文件夹,每个文件夹都有自己的名为“Makefi
我在Windows环境中使用Gnuwin32二进制文件。 当我想查找某种类型的文件时(例如PDF),我通常运行: find . -iname '*.pdf' -print 这在任何UNIX系统上均可完
我使用的是 Julia 编程语言,我知道你可以通过以下方式使用 find 函数: a = [ 1 2 3 4 3 5 3 6 7 8 9 3 ] find(a .== 3) 它将返回:3,5,7,12
jsperf's link 我不是 jQuery 专家(甚至不是一个好的用户),我没有研究它的整个源代码(只有一小部分不能帮助我解决这个问题)。 有人可以为我解释一下吗? 最佳答案 这个: $p.fi
我应该如何在 CentOS 7 中修复这个错误? [jalal@goku HW4]$ git clone https://github.com/pathak22/pyflow.git Cloning
是否可以更改传递给 find 中的 exec 的参数?例如,我需要以不同的名称复制文件:*.txt -> *.new.txt现在我正在为两个命令执行此操作: find /root/test -name
我想通过cleartool find 命令找到*.cs 和*.cpp 文件。但它失败了。 cleartool find "M:\test_view\code" -name "*.cs *.cpp"
我正在使用 PyMongo,看到有人建议使用 find()[:] 而不是 find()。很好奇有什么区别? 最佳答案 [:] 制作列表的浅拷贝,因此对对象的引用是相同的。我查看了 Pymongo 文档
我正在处理文件和目录,以在每个目录中查找最近修改的文件。我的代码可以工作,但作为 Ruby 的新手,我无法正确处理错误。 我使用 Find.find 获取递归目录列表,为每个目录调用我自己的函数 ne
/usr/bin/ld: cannot find -ldlib /usr/bin/ld: cannot find -lcblas /usr/bin/ld: cannot find -llapack 在
我有一些数据文件的一系列索引文件,它们基本上采用这种格式 索引文件:asdfg.log.1234.2345.index 数据文件:asdfg.log 这个想法是搜索所有索引文件。如果值 XXXX 出现
我有一个 find我运行以查找名称包含 foo 的文件的命令. 我想跳过 .git目录。下面的命令有效 除了 它打印一个 烦人 .git任何时候它跳过 .git目录: find . ( -name .
我有以下想做的事情: find . -maxdepth 6 \( -name \*.tar.gz -o -name bediskmodel -o -name src -o -name ciao -o
当我在表中查找隐藏字段时,我看到了两个隐藏字段。但是,我想通过 ID 进一步细化这两个字段。我注意到,当我使用“包含”在整个表上使用 find 时,我得到了 2 个字段。但是,如果我对隐藏字段的查找结
我正在使用下面的命令生成文件列表及其 m5sum。问题是某些文件或文件夹的名称中有空格。我将如何处理这些? find -type f -name \* | xargs md5sum 最佳答案 尝试:
我正在使用下面的命令生成文件列表及其 m5sum。问题是某些文件或文件夹的名称中有空格。我将如何处理这些? find -type f -name \* | xargs md5sum 最佳答案 尝试:
我有一个使用正则表达式查找文件的脚本。代码如下: find $dir | grep "$regex" 脚本运行有点慢,我想优化一下。搜索需要一些时间来执行,我想从中获得更好的性能。我试过这种尝试: f
这令人沮丧。我认为问题出在 api 响应返回的对象上。也许它是在字符串中,所以我所做的就是复制“postman”的响应并将其直接粘贴到js上。这样我就可以确定它在对象/数组中。但结果还是同样的错误。
我是一名优秀的程序员,十分优秀!