rework graphic opbect and coordinate transformation
This commit is contained in:
57
geometry.py
57
geometry.py
@@ -219,7 +219,6 @@ class geometry:
|
||||
return
|
||||
AA=np.ndarray((len(meas), 2, 2), np.float)
|
||||
K=np.array(tuple(meas.keys()), np.float)
|
||||
self._lut_pix2pos=(K, AA)
|
||||
for i, (k, v) in enumerate(meas.items()):
|
||||
m=np.array(v) # measurements
|
||||
if m.shape[0]<3:
|
||||
@@ -238,6 +237,14 @@ class geometry:
|
||||
AA[i]=aa.reshape(2, -1)
|
||||
# bx_coefs = np.polyfit(nbx[0], nbx[1], 3)
|
||||
# np.poly1d(bx_coefs)
|
||||
|
||||
if np.diff(K).min()<0: #zoom need to be from lowest to highest ordered
|
||||
_log.debug('resorting')
|
||||
s=K.argsort()
|
||||
K=K[s]
|
||||
AA=AA[s] #resort A if needed
|
||||
self._lut_pix2pos=(K, AA)
|
||||
|
||||
_log.debug('least square data:\nK:{}\nAA:{}'.format(K, AA))
|
||||
|
||||
def autofocus(self):
|
||||
@@ -410,30 +417,30 @@ if __name__=="__main__":
|
||||
(-3.2, -6.8, 675.10991143017, 790.3040145281),
|
||||
(-3.2, -6.72, 638.98580653116, 59.3803912957)]}
|
||||
measure=\
|
||||
{1: [(6.4190000000000005, 6.907, 696.2976073449591, 227.76776138682274),
|
||||
(5.719, 6.807, 410.67447894055806, 284.44919082240665),
|
||||
(5.719, 5.207, 434.78681995014756, 938.5631353309454),
|
||||
(6.619, 5.207, 808.7345059175318, 927.4590367789931)],
|
||||
200: [(6.619, 6.607, 940.264899030901, 187.39774454408854),
|
||||
(5.519, 6.607, 272.1925062601967, 219.8977706369289),
|
||||
(5.519, 5.407, 298.31361407848783, 941.97432810785),
|
||||
(6.619, 5.407, 969.4645435773624, 920.3295993015843)],
|
||||
400: [(6.719, 6.707, 1099.5956451604673, 46.46696479882394),
|
||||
(5.719, 6.707, 91.88845211350781, 99.00912182475837),
|
||||
(5.719, 5.807, 122.49326406274122, 998.8073593766618),
|
||||
(6.719, 5.807, 1137.5074440945523, 963.4302060882611)],
|
||||
600: [(6.619, 6.807, 1068.8592966662907, 106.9592377596037),
|
||||
(6.019, 6.807, 75.47928488084321, 151.1144445833613),
|
||||
(6.019, 6.307, 103.13064811335389, 977.5525209662414),
|
||||
(6.619, 6.307, 1104.9406638931132, 939.9675773457886)],
|
||||
800: [(6.619, 6.307, 1160.5691045813528, 202.93697492698996),
|
||||
(6.219, 6.307, 65.05964829488164, 253.28864950246646),
|
||||
(6.219, 6.107, 88.00366601279788, 797.1538427010806),
|
||||
(6.619, 6.107, 1180.6517090746024, 753.0303703110591)],
|
||||
1000: [(6.519, 6.267, 1087.8134573150567, 183.90222416155348),
|
||||
(6.319, 6.267, 160.59872007696185, 229.55456266733404),
|
||||
(6.319, 6.107, 190.50887289109403, 963.1404158981525),
|
||||
(6.519, 6.107, 1116.3595117455784, 925.6445737503763)]}
|
||||
{1000: [(-0.7310599999999997, 0.643119999999999, 1068.294887300626, 37.80427622442167),
|
||||
(-0.8105999999999997, 0.6437299218749977, 325.69398272322496, 66.36584947739863),
|
||||
(-0.8073999999999999, 0.548, 394.71778475125257, 954.1547514240993),
|
||||
(-0.7257699218749997, 0.5511799999999984, 1155.1696726117643, 900.6018015747674)],
|
||||
800: [(-0.7087599999999997, 0.6409199999999983, 1056.3942317785522, 65.17578392519127),
|
||||
(-0.8374999999999998, 0.6427399999999998, 354.2555559762018, 79.45657055167973),
|
||||
(-0.8393599999999997, 0.4836299999999992, 378.0568670203493, 955.3448169763066),
|
||||
(-0.6977599999999998, 0.487619999999999, 1159.9299348205936, 906.5521293358044)],
|
||||
600: [(-0.6560399999999997, 0.6448999999999997, 1112.3273127322987, 61.60558726856914),
|
||||
(-0.8914799999999998, 0.6495299218750006, 324.5039171710175, 67.55591502960601),
|
||||
(-0.8760799999999997, 0.3893999999999978, 407.80850582553353, 930.3534403799518),
|
||||
(-0.6621199999999997, 0.39789999999999964, 1128.988230463202, 873.2302938739978)],
|
||||
400: [(-0.6044999999999998, 0.6441200000000008, 1074.2452150616627, 63.98571837298388),
|
||||
(-0.9739299218749998, 0.6475599999999995, 310.2231305445289, 73.50624279064286),
|
||||
(-0.9546199999999997, 0.22334999999999855, 398.28798140787467, 926.7832437233297),
|
||||
(-0.5859199999999999, 0.23333999999999833, 1144.4590826418978, 880.3706871872422)],
|
||||
200: [(-0.4556199999999997, 0.6560399999999991, 1119.4677060455429, 44.9446695376659),
|
||||
(-1.0542399999999998, 0.6175399999999991, 381.6270636769714, 108.01814380465672),
|
||||
(-1.0568399999999998, -0.05702000000000044, 413.7588335865705, 932.7335714843665),
|
||||
(-0.47519999999999984, -0.03876000000000022, 1136.1286237764461, 881.5607527394494)],
|
||||
1: [(-0.3154599999999996, 0.6150199999999987, 1112.3273127322987, 78.26650499947237),
|
||||
(-1.1583899218749996, 0.5868999999999996, 425.65948910864427, 129.43932374438944),
|
||||
(-1.2067399218749997, -0.3514000000000015, 400.6681125122893, 905.3620637835969),
|
||||
(-0.3347399999999998, -0.36506000000000133, 1136.1286237764461, 880.3706871872422)]}
|
||||
|
||||
|
||||
obj.update_pix2pos(measure)
|
||||
|
||||
Reference in New Issue
Block a user