remote-run-everything 2.0.7__py3-none-any.whl → 2.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- remote_run_everything/__init__.py +1 -0
- remote_run_everything/binocular/ba_front.py +72 -0
- remote_run_everything/binocular/back_tool.py +123 -0
- remote_run_everything/binocular/cam_tool.py +26 -0
- remote_run_everything/binocular/front_tool.py +39 -0
- remote_run_everything/binocular/relative_pos.py +142 -0
- remote_run_everything/tools/common1.py +22 -3
- {remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/METADATA +40 -2
- {remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/RECORD +12 -7
- {remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/WHEEL +0 -0
- {remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/licenses/LICENSE +0 -0
- {remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/top_level.txt +0 -0
|
@@ -14,3 +14,4 @@ from remote_run_everything.nosql.no_sql import Nosql
|
|
|
14
14
|
from remote_run_everything.nosql.no_sql_pg import NosqlPg
|
|
15
15
|
from remote_run_everything.nosql.no_sql_mysql import NosqlMysql
|
|
16
16
|
from remote_run_everything.vsconf.core import VsConf
|
|
17
|
+
from remote_run_everything.binocular.relative_pos import RelativePos
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from remote_run_everything.binocular.back_tool import BackTool
|
|
3
|
+
from remote_run_everything.binocular.front_tool import FrontTool
|
|
4
|
+
from remote_run_everything.binocular.cam_tool import CamTool
|
|
5
|
+
|
|
6
|
+
# 4.213158 0.669677 -3.907534 -0.750835 60 0 -60
|
|
7
|
+
# 内方位元素:f,x0,y0 单位mm
|
|
8
|
+
|
|
9
|
+
class BaFront:
|
|
10
|
+
def __init__(self, f1, f2, s1, s2, angle1, angle2, u1, v1, u2, v2):
|
|
11
|
+
# 内方位元素:f,x0,y0 单位mm
|
|
12
|
+
self.f1 = f1
|
|
13
|
+
self.f2 = f2
|
|
14
|
+
# 左右像片外方位元素 单位mm
|
|
15
|
+
self.S1 = s1
|
|
16
|
+
self.S2 = s2
|
|
17
|
+
self.angle1 = angle1
|
|
18
|
+
self.angle2 = angle2
|
|
19
|
+
self.u1 = u1
|
|
20
|
+
self.v1 = v1
|
|
21
|
+
self.u2 = u2
|
|
22
|
+
self.v2 = v2
|
|
23
|
+
self.ftool = FrontTool()
|
|
24
|
+
self.btool1 = BackTool(self.f1, u1, v1)
|
|
25
|
+
self.btool2 = BackTool(self.f2, u2, v2)
|
|
26
|
+
self.max_step = 1000000
|
|
27
|
+
|
|
28
|
+
def first_cpt(self):
|
|
29
|
+
# 计算基线分量,L.R为左右像片线元素
|
|
30
|
+
B = self.S2 - self.S1
|
|
31
|
+
R1 = CamTool().calcR(*self.angle1)
|
|
32
|
+
R2 = CamTool().calcR(*self.angle2)
|
|
33
|
+
XYZ1 = self.ftool.coordinate(R1, self.u1, self.v1, self.f1) # 左片像空间辅助坐标
|
|
34
|
+
XYZ2 = self.ftool.coordinate(R2, self.u2, self.v2, self.f2) # 右片像空间辅助坐标
|
|
35
|
+
N = self.ftool.genN(B, XYZ1, XYZ2)
|
|
36
|
+
XYZ = self.ftool.xyz(self.S1, XYZ1, N)
|
|
37
|
+
# CamTool().view_pcd(gp)
|
|
38
|
+
return XYZ
|
|
39
|
+
|
|
40
|
+
def refine(self, XYZ, which):
|
|
41
|
+
X = XYZ[:, 0]
|
|
42
|
+
Y = XYZ[:, 1]
|
|
43
|
+
Z = XYZ[:, 2]
|
|
44
|
+
if which == 1:
|
|
45
|
+
btool = self.btool1
|
|
46
|
+
X0, Y0, Z0 = self.S1.tolist()
|
|
47
|
+
phi, omega, kappa = self.angle1
|
|
48
|
+
else:
|
|
49
|
+
btool = self.btool2
|
|
50
|
+
X0, Y0, Z0 = self.S2.tolist()
|
|
51
|
+
phi, omega, kappa = self.angle2
|
|
52
|
+
for i in range(self.max_step):
|
|
53
|
+
L = btool.genL(X, Y, Z, phi, omega, kappa, X0, Y0, Z0)
|
|
54
|
+
A, B = btool.genAB(X, Y, Z, phi, omega, kappa, X0, Y0, Z0)
|
|
55
|
+
dxyz = btool.genDxyz(B, L)
|
|
56
|
+
|
|
57
|
+
# ex[dxs,dys,dzs,dphi,domega,dkappa]
|
|
58
|
+
X += dxyz[0]
|
|
59
|
+
Y += dxyz[1]
|
|
60
|
+
Z += dxyz[2]
|
|
61
|
+
|
|
62
|
+
limit = 0.00001
|
|
63
|
+
if np.abs(dxyz[0]) < limit or np.abs(dxyz[1]) < limit or np.abs(dxyz[2]) < limit:
|
|
64
|
+
err = np.mean(np.abs(dxyz))
|
|
65
|
+
return XYZ, err
|
|
66
|
+
|
|
67
|
+
def refine_all(self, XYZ):
|
|
68
|
+
xyz1, err1 = self.refine(XYZ, 1)
|
|
69
|
+
xyz2, err2 = self.refine(XYZ, 2)
|
|
70
|
+
xyz = (xyz1 + xyz2) / 2
|
|
71
|
+
return xyz, (err1 + err2) / 2
|
|
72
|
+
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"""
|
|
2
|
+
后方交会代码
|
|
3
|
+
作者:Dash
|
|
4
|
+
version:0.1
|
|
5
|
+
without any optimization
|
|
6
|
+
"""
|
|
7
|
+
import numpy as np
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BackTool(object):
|
|
11
|
+
def __init__(self, f, u, v):
|
|
12
|
+
self.f = f
|
|
13
|
+
self.u = u
|
|
14
|
+
self.v = v
|
|
15
|
+
self.max_step = 1000000
|
|
16
|
+
|
|
17
|
+
def init_param(self, X, Y, Z, scale):
|
|
18
|
+
n = len(X)
|
|
19
|
+
# initial line paras
|
|
20
|
+
Z0 = scale * self.f + (1 / n) * np.sum(Z)
|
|
21
|
+
X0 = (1 / n) * np.sum(X)
|
|
22
|
+
Y0 = (1 / n) * np.sum(Y)
|
|
23
|
+
return X0, Y0, Z0
|
|
24
|
+
|
|
25
|
+
def genL(self, X, Y, Z, phi, omega, kappa, X0, Y0, Z0):
|
|
26
|
+
R = CamTool().calcR(phi, omega, kappa)
|
|
27
|
+
a1, a2, a3, b1, b2, b3, c1, c2, c3 = [i for l in R.tolist() for i in l]
|
|
28
|
+
L = []
|
|
29
|
+
for j in range(len(self.u)):
|
|
30
|
+
numerator_x = self.f * (a1 * (X[j] - X0) + b1 * (Y[j] - Y0) + c1 * (Z[j] - Z0))
|
|
31
|
+
numerator_y = self.f * (a2 * (X[j] - X0) + b2 * (Y[j] - Y0) + c2 * (Z[j] - Z0))
|
|
32
|
+
denomanator = (a3 * (X[j] - X0) + b3 * (Y[j] - Y0) + c3 * (Z[j] - Z0))
|
|
33
|
+
lx = self.u[j] + numerator_x / denomanator
|
|
34
|
+
ly = self.v[j] + numerator_y / denomanator
|
|
35
|
+
L.append(lx)
|
|
36
|
+
L.append(ly)
|
|
37
|
+
L = np.array(L,dtype=np.float32)
|
|
38
|
+
return L
|
|
39
|
+
|
|
40
|
+
def genAB(self, X, Y, Z, phi, omega, kappa, X0, Y0, Z0):
|
|
41
|
+
R = CamTool().calcR(phi, omega, kappa)
|
|
42
|
+
a1, a2, a3, b1, b2, b3, c1, c2, c3 = [i for l in R.tolist() for i in l]
|
|
43
|
+
num_of_samples = len(self.u)
|
|
44
|
+
|
|
45
|
+
a11 = np.zeros(num_of_samples, dtype=np.float32)
|
|
46
|
+
a12 = np.zeros(num_of_samples, dtype=np.float32)
|
|
47
|
+
a13 = np.zeros(num_of_samples, dtype=np.float32)
|
|
48
|
+
|
|
49
|
+
a14 = np.zeros(num_of_samples, dtype=np.float32)
|
|
50
|
+
a15 = np.zeros(num_of_samples, dtype=np.float32)
|
|
51
|
+
a16 = np.zeros(num_of_samples, dtype=np.float32)
|
|
52
|
+
|
|
53
|
+
a21 = np.zeros(num_of_samples, dtype=np.float32)
|
|
54
|
+
a22 = np.zeros(num_of_samples, dtype=np.float32)
|
|
55
|
+
a23 = np.zeros(num_of_samples, dtype=np.float32)
|
|
56
|
+
a24 = np.zeros(num_of_samples, dtype=np.float32)
|
|
57
|
+
a25 = np.zeros(num_of_samples, dtype=np.float32)
|
|
58
|
+
a26 = np.zeros(num_of_samples, dtype=np.float32)
|
|
59
|
+
|
|
60
|
+
for j in range(num_of_samples):
|
|
61
|
+
z_bar = a3 * (X[j] - X0) + b3 * (Y[j] - Y0) + c3 * (Z[j] - Z0)
|
|
62
|
+
a11[j] = (a1 * self.f + a3 * self.u[j]) / z_bar
|
|
63
|
+
a12[j] = (b1 * self.f + b3 * self.u[j]) / z_bar
|
|
64
|
+
a13[j] = (c1 * self.f + c3 * self.u[j]) / z_bar
|
|
65
|
+
a14[j] = (self.v[j] * np.sin(omega)) - (self.u[j] * (
|
|
66
|
+
self.u[j] * np.cos(kappa) - self.v[j] * np.sin(kappa)) / self.f + self.f * np.cos(
|
|
67
|
+
kappa)) * np.cos(omega)
|
|
68
|
+
a15[j] = -self.f * np.sin(kappa) - (self.u[j] / self.f) * (
|
|
69
|
+
self.u[j] * np.sin(kappa) + self.v[j] * np.cos(kappa))
|
|
70
|
+
a16[j] = self.v[j]
|
|
71
|
+
|
|
72
|
+
a21[j] = (a2 * self.f + a3 * self.v[j]) / z_bar
|
|
73
|
+
a22[j] = (b2 * self.f + b3 * self.v[j]) / z_bar
|
|
74
|
+
a23[j] = (c2 * self.f + c3 * self.v[j]) / z_bar
|
|
75
|
+
a24[j] = -self.u[j] * np.sin(omega) - (self.v[j] / self.f) * (
|
|
76
|
+
(self.u[j] * np.cos(kappa) - self.v[j] * np.sin(kappa)) - self.f * np.sin(
|
|
77
|
+
kappa)) * np.cos(omega)
|
|
78
|
+
a25[j] = -self.f * np.cos(kappa) - (self.v[j] / self.f) * (
|
|
79
|
+
self.u[j] * np.sin(kappa) + self.v[j] * np.cos(kappa))
|
|
80
|
+
a26[j] = -self.u[j]
|
|
81
|
+
|
|
82
|
+
A = np.zeros((2 * num_of_samples, 6), dtype=np.float32)
|
|
83
|
+
B = np.zeros((2 * num_of_samples, 3), dtype=np.float32)
|
|
84
|
+
for j in range(num_of_samples):
|
|
85
|
+
A[2 * j:2 * j + 2, :] = np.array([
|
|
86
|
+
[a11[j], a12[j], a13[j], a14[j], a15[j], a16[j]],
|
|
87
|
+
[a21[j], a22[j], a23[j], a24[j], a25[j], a26[j]]
|
|
88
|
+
], dtype=np.float32)
|
|
89
|
+
B[2 * j:2 * j + 2, :] = np.array([
|
|
90
|
+
[-a11[j], -a12[j], -a13[j]],
|
|
91
|
+
[-a21[j], -a22[j], -a23[j]]
|
|
92
|
+
], dtype=np.float32)
|
|
93
|
+
return A, B
|
|
94
|
+
|
|
95
|
+
def genT_noba(self, A, L):
|
|
96
|
+
|
|
97
|
+
AtA = np.dot(A.T, A)
|
|
98
|
+
inverse_AtA = np.linalg.inv(AtA)
|
|
99
|
+
print(333, inverse_AtA)
|
|
100
|
+
combine = np.dot(inverse_AtA, A.T)
|
|
101
|
+
X = np.dot(combine, L)
|
|
102
|
+
return X
|
|
103
|
+
|
|
104
|
+
def genT(self, A, B, L):
|
|
105
|
+
N11 = A.T @ A
|
|
106
|
+
N12 = A.T @ B
|
|
107
|
+
N21 = B.T @ A
|
|
108
|
+
N22 = B.T @ B
|
|
109
|
+
M1 = A.T @ L
|
|
110
|
+
M2 = B.T @ L
|
|
111
|
+
right = M1 - N12 @ np.linalg.inv(N22) @ M2
|
|
112
|
+
left = N11 - N12 @ np.linalg.inv(N22) @ N21
|
|
113
|
+
print("begin inv")
|
|
114
|
+
left_inv = np.linalg.inv(left)
|
|
115
|
+
print("inv", left_inv)
|
|
116
|
+
t = np.dot(left_inv, right)
|
|
117
|
+
return t
|
|
118
|
+
|
|
119
|
+
def genDxyz(self, B, L):
|
|
120
|
+
inverse_BtB = np.linalg.inv(np.dot(B.T, B))
|
|
121
|
+
combine = np.dot(inverse_BtB, B.T)
|
|
122
|
+
X = np.dot(combine, L)
|
|
123
|
+
return X
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
class CamTool:
|
|
5
|
+
def calcR(self, phi, omega, kappa):
|
|
6
|
+
a1 = np.cos(phi) * np.cos(kappa) - np.sin(phi) * np.sin(omega) * np.sin(kappa)
|
|
7
|
+
a2 = -np.cos(phi) * np.sin(kappa) - np.sin(phi) * np.sin(omega) * np.cos(kappa)
|
|
8
|
+
a3 = -np.sin(phi) * np.cos(omega)
|
|
9
|
+
b1 = np.cos(omega) * np.sin(kappa)
|
|
10
|
+
b2 = np.cos(omega) * np.cos(kappa)
|
|
11
|
+
b3 = -np.sin(omega)
|
|
12
|
+
c1 = np.sin(phi) * np.cos(kappa) + np.cos(phi) * np.sin(omega) * np.sin(kappa)
|
|
13
|
+
c2 = -np.sin(phi) * np.sin(kappa) + np.cos(phi) * np.sin(omega) * np.cos(kappa)
|
|
14
|
+
c3 = np.cos(phi) * np.cos(omega)
|
|
15
|
+
arr = np.array([[a1, a2, a3], [b1, b2, b3], [c1, c2, c3]])
|
|
16
|
+
return arr
|
|
17
|
+
|
|
18
|
+
def intrisinc(self,path):
|
|
19
|
+
path=os.path.abspath(path)
|
|
20
|
+
return np.loadtxt(path, delimiter=',')
|
|
21
|
+
def cx_cy(self,path):
|
|
22
|
+
ins=self.intrisinc(path)
|
|
23
|
+
return ins[0, 2],ins[1, 2]
|
|
24
|
+
def fx(self,path):
|
|
25
|
+
ins=self.intrisinc(path)
|
|
26
|
+
return ins[0,0]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# 4.213158 0.669677 -3.907534 -0.750835 60 0 -60
|
|
5
|
+
# 内方位元素:f,x0,y0 单位mm
|
|
6
|
+
|
|
7
|
+
class FrontTool:
|
|
8
|
+
def coordinate(self, R, u, v, f): # 计算所求点的像空间辅助坐标系,xyz--> XYZ,R为旋转矩阵,P所求点像空间坐标,f为主距
|
|
9
|
+
XYZ = []
|
|
10
|
+
for i in range(len(u)):
|
|
11
|
+
xyz = np.array([[u[i]], [v[i]], [-f]])
|
|
12
|
+
XYZ.append(np.dot(R, xyz))
|
|
13
|
+
return XYZ
|
|
14
|
+
|
|
15
|
+
def projection_index(self, B, XYZ1, XYZ2): # 投影系数计算
|
|
16
|
+
bu = B[0]
|
|
17
|
+
bw = B[2]
|
|
18
|
+
u1 = XYZ1[0]
|
|
19
|
+
w1 = XYZ1[2]
|
|
20
|
+
u2 = XYZ2[0]
|
|
21
|
+
w2 = XYZ2[2]
|
|
22
|
+
N1 = (bu * w2 - bw * u2) / (u1 * w2 - u2 * w1)
|
|
23
|
+
N2 = (bu * w1 - bw * u1) / (u1 * w2 - u2 * w1)
|
|
24
|
+
return [N1[0], N2[0]]
|
|
25
|
+
|
|
26
|
+
def genN(self, B, XYZ1, XYZ2):
|
|
27
|
+
N = []
|
|
28
|
+
for i in range(len(XYZ1)):
|
|
29
|
+
N.append(self.projection_index(B, XYZ1[i], XYZ2[i]))
|
|
30
|
+
return N
|
|
31
|
+
|
|
32
|
+
def xyz(self, S1, XYZ1, N):
|
|
33
|
+
l = []
|
|
34
|
+
for i in range(len(XYZ1)):
|
|
35
|
+
XYZ = XYZ1[i].reshape((3,))
|
|
36
|
+
# 地面控制点坐标计算
|
|
37
|
+
res = S1 + N[i][0] * XYZ
|
|
38
|
+
l.append(res)
|
|
39
|
+
return np.array(l)
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Created on Fri Apr 24 12:23:35 2020
|
|
4
|
+
@author: 陨星落云
|
|
5
|
+
"""
|
|
6
|
+
import numpy as np
|
|
7
|
+
from numpy import linalg
|
|
8
|
+
from remote_run_everything.binocular.cam_tool import CamTool
|
|
9
|
+
import copy
|
|
10
|
+
from remote_run_everything.binocular.ba_front import BaFront
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class RelativePos:
|
|
14
|
+
def __init__(self, pathl,pathr,unitl,unitr):
|
|
15
|
+
self.pathl=pathl
|
|
16
|
+
self.pathr=pathr
|
|
17
|
+
self.unitl=unitl
|
|
18
|
+
self.unitr=unitr
|
|
19
|
+
self.cam=CamTool()
|
|
20
|
+
self.f=self.cam.fx(self.pathl)*self.unitl
|
|
21
|
+
self.fi = 0
|
|
22
|
+
self.omega = 0
|
|
23
|
+
self.kapa = 0
|
|
24
|
+
self.u_bv = 0
|
|
25
|
+
self.r_bw = 0
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def rel_one(self, l0, r0):
|
|
29
|
+
cxcyl = self.cam.cx_cy(self.pathl)
|
|
30
|
+
cxcyr = self.cam.cx_cy(self.pathr)
|
|
31
|
+
# 像素坐标换相平面坐标 输入同名像素点 [(u,v),]
|
|
32
|
+
l = self.uv_process(self.unitl, cxcyl[0], cxcyl[1], copy.deepcopy(l0))
|
|
33
|
+
r = self.uv_process(self.unitr, cxcyr[0], cxcyr[1], copy.deepcopy(r0))
|
|
34
|
+
# 后方交汇 改写右边-->左边的旋角,u,v,返回使用到的像素点index
|
|
35
|
+
new_match = self.back_intersect(l, r)
|
|
36
|
+
if new_match is None:
|
|
37
|
+
print("can not solve relative pos")
|
|
38
|
+
return None
|
|
39
|
+
a1 = [0, 0, 0]
|
|
40
|
+
a2 = [self.fi, self.omega, self.kapa]
|
|
41
|
+
S1 = np.array([0., 0., 0.])
|
|
42
|
+
S2 = np.array([1, self.u_bv, self.r_bw])
|
|
43
|
+
l = l[new_match, :]
|
|
44
|
+
r = r[new_match, :]
|
|
45
|
+
fl=self.cam.fx(self.pathl)*self.unitl
|
|
46
|
+
fr=self.cam.fx(self.pathr)*self.unitr
|
|
47
|
+
f = BaFront(fl, fr, S1, S2, a1, a2, l[:, 0], l[:, 1], r[:, 0],
|
|
48
|
+
r[:, 1])
|
|
49
|
+
# 前方交汇
|
|
50
|
+
pcd = f.first_cpt()
|
|
51
|
+
d = {"pcd": pcd, "T": S2, "angle": a2, "match": new_match
|
|
52
|
+
# "match": np.concatenate([i['l'][new_match, :], i['r'][new_match, :]], axis=1),
|
|
53
|
+
}
|
|
54
|
+
return d
|
|
55
|
+
|
|
56
|
+
def uv_process(self, unit, cx, cy, l):
|
|
57
|
+
l[:, 0] = unit * (l[:, 0] - cx)
|
|
58
|
+
l[:, 1] = unit * (cy - l[:, 1])
|
|
59
|
+
return l
|
|
60
|
+
|
|
61
|
+
def cptaq(self, i, l, r):
|
|
62
|
+
# 计算旋转矩阵
|
|
63
|
+
R = CamTool().calcR(self.fi, self.omega, self.kapa)
|
|
64
|
+
# 比例尺 怎么都无所谓
|
|
65
|
+
bu = l[0][0] - r[0][0]
|
|
66
|
+
bv = bu * self.u_bv
|
|
67
|
+
bw = bu * self.r_bw
|
|
68
|
+
# 左片相对摄影测量坐标
|
|
69
|
+
u1 = l[i][0]
|
|
70
|
+
v1 = l[i][1]
|
|
71
|
+
w1 = -self.f
|
|
72
|
+
# 计算相对摄影测量坐标
|
|
73
|
+
mr = np.dot(R, np.array([r[i][0], r[i][1], -self.f]))
|
|
74
|
+
# 右片相对摄影测量坐标
|
|
75
|
+
u2 = mr[0]
|
|
76
|
+
v2 = mr[1]
|
|
77
|
+
w2 = mr[2]
|
|
78
|
+
# 计算N1,N2
|
|
79
|
+
N1 = (bu * w2 - bw * u2) / (u1 * w2 - u2 * w1)
|
|
80
|
+
N2 = (bu * w1 - bw * u1) / (u1 * w2 - u2 * w1)
|
|
81
|
+
# 计算每个点Q
|
|
82
|
+
Q = N1 * v1 - N2 * v2 - bv
|
|
83
|
+
a = -u2 * v2 * N2 / w2
|
|
84
|
+
b = -N2 * (w2 + v2 * v2 / w2)
|
|
85
|
+
c = u2 * N2
|
|
86
|
+
d = bu
|
|
87
|
+
e = -v2 * bu / w2
|
|
88
|
+
return np.array([a, b, c, d, e]), Q
|
|
89
|
+
|
|
90
|
+
def back_intersect(self, l, r):
|
|
91
|
+
n = l.shape[0]
|
|
92
|
+
countx, countj = (0, 0)
|
|
93
|
+
# 误差方程参数
|
|
94
|
+
# 右片相对相空间坐标,相对摄影测量坐标
|
|
95
|
+
# 迭代运算
|
|
96
|
+
while True:
|
|
97
|
+
Al = []
|
|
98
|
+
Ll = []
|
|
99
|
+
new_match = []
|
|
100
|
+
|
|
101
|
+
# 计算每个点参数,组成法方程矩阵
|
|
102
|
+
for i in range(n):
|
|
103
|
+
ai, Q = self.cptaq(i, l, r)
|
|
104
|
+
if np.isnan(Q):
|
|
105
|
+
continue
|
|
106
|
+
new_match.append(i)
|
|
107
|
+
Al.append(ai)
|
|
108
|
+
Ll.append(Q)
|
|
109
|
+
# A[i, :] = ai
|
|
110
|
+
# L[i] = Q
|
|
111
|
+
# 求解X
|
|
112
|
+
A = np.array(Al)
|
|
113
|
+
L = np.array(Ll)
|
|
114
|
+
try:
|
|
115
|
+
inv = linalg.inv(np.dot(A.T, A))
|
|
116
|
+
except:
|
|
117
|
+
return None
|
|
118
|
+
X = np.dot(np.dot(inv, A.T), L)
|
|
119
|
+
# 累加五参数
|
|
120
|
+
self.fi += X[0]
|
|
121
|
+
self.omega += X[1]
|
|
122
|
+
self.kapa += X[2]
|
|
123
|
+
self.u_bv += X[3]
|
|
124
|
+
self.r_bw += X[4]
|
|
125
|
+
# 循环次数+
|
|
126
|
+
countx += 1
|
|
127
|
+
# 判断是否收敛
|
|
128
|
+
if countx > 1000:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
if (np.abs(X) < 0.00003).all():
|
|
132
|
+
print("五参数", self.fi, self.omega, self.kapa, self.u_bv, self.r_bw)
|
|
133
|
+
# 精度评定
|
|
134
|
+
V = np.dot(A, X.T) - L
|
|
135
|
+
c1 = np.sqrt(np.dot(V.T, V) / n)
|
|
136
|
+
print("相对定向精度:", c1)
|
|
137
|
+
print("相对定向迭代次数:", countx)
|
|
138
|
+
print("新的配对长度:", len(new_match))
|
|
139
|
+
return new_match
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import jinja2, requests, os
|
|
2
1
|
import pandas as pd
|
|
3
|
-
import base64
|
|
4
|
-
import os, signal, glob, arrow, uuid, hashlib
|
|
2
|
+
import jinja2, os,base64,struct, glob, arrow, uuid, hashlib
|
|
5
3
|
|
|
6
4
|
|
|
7
5
|
class Common1:
|
|
@@ -98,6 +96,27 @@ class Common1:
|
|
|
98
96
|
hex_string = hashlib.md5(s.encode("UTF-8")).hexdigest()
|
|
99
97
|
return str(uuid.UUID(hex=hex_string))
|
|
100
98
|
|
|
99
|
+
def ascii2hex(self,l):
|
|
100
|
+
tu = [i.replace("0x", "") for i in l]
|
|
101
|
+
tu = [self.prefix_zero(2, i) for i in tu]
|
|
102
|
+
return "".join(tu)
|
|
103
|
+
|
|
104
|
+
def ascii2int(self,l,big):
|
|
105
|
+
s=self.ascii2hex(l)
|
|
106
|
+
b = bytes.fromhex(s)
|
|
107
|
+
if big:
|
|
108
|
+
return int.from_bytes(b, byteorder='big')
|
|
109
|
+
return int.from_bytes(b, byteorder='little')
|
|
110
|
+
|
|
111
|
+
def ascii2float(self,l,big):
|
|
112
|
+
s=self.ascii2hex(l)
|
|
113
|
+
if big:
|
|
114
|
+
return struct.unpack('>f', bytes.fromhex(s))[0]
|
|
115
|
+
return struct.unpack('<f', bytes.fromhex(s))[0]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
101
120
|
|
|
102
121
|
if __name__ == '__main__':
|
|
103
122
|
g = Common1()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: remote_run_everything
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.8
|
|
4
4
|
Summary: Deploy Tools
|
|
5
5
|
Author-email: Wang Qi <wangmarkqi@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -27,7 +27,7 @@ from remote_run_everything import cherrypy_in_daemon,ByHttpServer
|
|
|
27
27
|
cherrypy_in_daemon(ByHttpServer,8888,"/deploy")
|
|
28
28
|
|
|
29
29
|
# 上推代码
|
|
30
|
-
from remote_run_everything import ByHttp
|
|
30
|
+
from remote_run_everything import ByHttp ,BySftp
|
|
31
31
|
def test_up():
|
|
32
32
|
host = "http://x.x.x.x:8888/deploy"
|
|
33
33
|
local = "D://project/demand/shop"
|
|
@@ -35,6 +35,13 @@ def test_up():
|
|
|
35
35
|
db = "D://wq/temp/shop.db"
|
|
36
36
|
bh = ByHttp(host, local, remote, db)
|
|
37
37
|
bh.up(['node_modules', ".pyc", ".idea"])
|
|
38
|
+
def test_up2():
|
|
39
|
+
host = "http://x.x.x.x:8888/deploy"
|
|
40
|
+
local = "D://project/demand/shop"
|
|
41
|
+
remote = "/data/mypy/shop"
|
|
42
|
+
db = "D://wq/temp/shop.db"
|
|
43
|
+
by=BySftp(host,22,'root','pwd',local,remote,db)
|
|
44
|
+
by.up(['node_modules', ".pyc", ".idea", ".pdf", ".docx", ".pickle", ".png", ".jpg",".venv","target","dist","build"])
|
|
38
45
|
|
|
39
46
|
# 下拉代码
|
|
40
47
|
def test_down():
|
|
@@ -94,6 +101,7 @@ db.drop_db()
|
|
|
94
101
|
```
|
|
95
102
|
## 进程管理
|
|
96
103
|
```python
|
|
104
|
+
import os
|
|
97
105
|
class ProcessManage:
|
|
98
106
|
# nosql is instance of Nosql or Nosqlmysql or Nqsqlpg
|
|
99
107
|
def __init__(self, nosql):
|
|
@@ -107,3 +115,33 @@ class ProcessManage:
|
|
|
107
115
|
self.col.insert_one(dic)
|
|
108
116
|
|
|
109
117
|
```
|
|
118
|
+
## 缓存装饰器
|
|
119
|
+
```python
|
|
120
|
+
from remote_run_everything import cache_by_1starg,cache_by_name,cache_by_rkey,cache_by_nth_arg
|
|
121
|
+
@cache_by_name("asdf", 1)
|
|
122
|
+
def test_dec():
|
|
123
|
+
print("运行了函数!!!!!!!!!!!!!!!!")
|
|
124
|
+
return {"a": "adaf"}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 关系型 数据库
|
|
130
|
+
```python
|
|
131
|
+
from remote_run_everything import Crud,CrudeDuck
|
|
132
|
+
# 详情参见类方法
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 双目测距
|
|
136
|
+
```python
|
|
137
|
+
from remote_run_everything.binocular.relative_pos import RelativePos,CamTool
|
|
138
|
+
import numpy as np
|
|
139
|
+
unit=0.006240084611316764
|
|
140
|
+
l=[[3838.36767578125, 50.56350326538086], [2636.24072265625, 88.38832092285156], [511.72705078125, 95.95327758789062], [2303.57666015625, 107.30072784423828], [2159.92626953125, 111.08320617675781], [2001.15478515625, 114.86569213867188], ]
|
|
141
|
+
r=[[3743.86083984375, 31.651092529296875], [2424.54541015625, 65.69342803955078], [231.98681640625, 69.47590637207031], [2076.76025390625, 84.6058349609375], [1921.76904296875, 88.38832092285156], [1759.21728515625, 92.1707992553711]]
|
|
142
|
+
l=np.array(l)
|
|
143
|
+
r=np.array(r)
|
|
144
|
+
path="./nik_insinc.txt"
|
|
145
|
+
dic = RelativePos(path,path,unit,unit).rel_one(l, r)
|
|
146
|
+
print (dic)
|
|
147
|
+
```
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
remote_run_everything/__init__.py,sha256=
|
|
1
|
+
remote_run_everything/__init__.py,sha256=gcBibYtmhA7LmV_wV2HVyAb69zFDDPzrwE_s8IQxWCE,885
|
|
2
|
+
remote_run_everything/binocular/ba_front.py,sha256=wDCW5tycvaCAEau_vxhoyUEuB_9HhUMibbxr1c1SoNk,2592
|
|
3
|
+
remote_run_everything/binocular/back_tool.py,sha256=eUGdkwE4TMm-hmjs4puVM-iy_iyJJuPEqdZWQxKvOGc,4873
|
|
4
|
+
remote_run_everything/binocular/cam_tool.py,sha256=ASZ2opsrnjhlvV7N6hn9axUjWIeQskR3t44a8oRpppw,1032
|
|
5
|
+
remote_run_everything/binocular/front_tool.py,sha256=lDFSvD0LBayfQLp08llhpBHwxNdCX6fypWz0dMdq6qs,1236
|
|
6
|
+
remote_run_everything/binocular/relative_pos.py,sha256=FX6pwXgK_JViPa1cjbHOYEYG3JFzorSNocHe7FG45JI,4732
|
|
2
7
|
remote_run_everything/db/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
8
|
remote_run_everything/db/backup.py,sha256=_mDUNQo1q6Gc75-diwadrooZsdV89KGG9mIcS4rmcBQ,1152
|
|
4
9
|
remote_run_everything/db/crud_sqlalchemy.py,sha256=cDyDGHwE-1TUBZrXMVDTjIa4Z0ZUQvM9m9sk-eIwaSM,5192
|
|
@@ -16,13 +21,13 @@ remote_run_everything/nosql/no_sql_pg.py,sha256=XCrEnHKp5RVHPOyPOMICY2PnvNMkkIID
|
|
|
16
21
|
remote_run_everything/nosql/no_sql_tool.py,sha256=xRu7vsDgr3JQNSo6CLNTtNNxlg4fl-Q7_vw4y9lklWI,2590
|
|
17
22
|
remote_run_everything/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
23
|
remote_run_everything/tools/common.py,sha256=UozWsdBwf7mGnvv5hLiaIfalhDaSaMjDOBjky8mo2w8,1747
|
|
19
|
-
remote_run_everything/tools/common1.py,sha256=
|
|
24
|
+
remote_run_everything/tools/common1.py,sha256=ClMooqv3GF-9mmsQmJK3V6E6p4i9MLrKCp_1TcQ2h3I,4211
|
|
20
25
|
remote_run_everything/tools/decorators.py,sha256=SIacNAs7afgkU0D09J-s-YscCVnxSG8Qj9vSL4VzCHw,1988
|
|
21
26
|
remote_run_everything/tools/sqlacodegen_go_struct.py,sha256=0xWJVCjFyEF2VjC1aGo6DmIqEQQ0Q46CfBAb9FSCUuE,3237
|
|
22
27
|
remote_run_everything/vsconf/conf_txt.py,sha256=nhFuKLlts-sCIBmfr0IKv1pP-qPUvQQrsRRg21q5Gd4,2418
|
|
23
28
|
remote_run_everything/vsconf/core.py,sha256=HmSEzXjGPY7R64rwfAV024YxMHwmBkLin6lGace4U0M,833
|
|
24
|
-
remote_run_everything-2.0.
|
|
25
|
-
remote_run_everything-2.0.
|
|
26
|
-
remote_run_everything-2.0.
|
|
27
|
-
remote_run_everything-2.0.
|
|
28
|
-
remote_run_everything-2.0.
|
|
29
|
+
remote_run_everything-2.0.8.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
30
|
+
remote_run_everything-2.0.8.dist-info/METADATA,sha256=uih3-Spo0KtwmUquIAD1NysIwA6-sdF--NIgoeXiWTM,4606
|
|
31
|
+
remote_run_everything-2.0.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
32
|
+
remote_run_everything-2.0.8.dist-info/top_level.txt,sha256=1TUcAqPgSwiVBqUHz-1pZFXvRpr9cudEYlmfw_mztRY,22
|
|
33
|
+
remote_run_everything-2.0.8.dist-info/RECORD,,
|
|
File without changes
|
{remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{remote_run_everything-2.0.7.dist-info → remote_run_everything-2.0.8.dist-info}/top_level.txt
RENAMED
|
File without changes
|