AN-1021: 基于MMSE的触摸屏应用多点校准算法 (Rev. 0)

AN-1021
ᆌᆩԴऻ
One Technology Way t P.O. Box 9106 t Norwood, MA 02062-9106, U.S.A. t Tel: 781.329.4700 t Fax: 781.461.3113 t www.analog.com
एᇀMMSE‫ةڦ‬ఄೡᆌᆩ‫ۅܠ‬ၯጚ໙݆
ፕኁǖNing Jia
०঻
၄‫پ‬ยԢ‫ܠ‬ᅜᅂৗೡत‫ة‬ఄೡरຍፕྺᆩࢽহ௬ăᅺഄ०
‫ࠓڦڇ‬ሰࢅዚ໯ዜኪ‫֡ڦ‬ፕᇱ૙Lj‫ۉ‬ፆ๕‫ة‬ఄೡ๟঄൱‫ׯ‬
Ԩ႙ยऺ‫ڦ‬๯჋ă඗ܸLj‫ۉ‬ፆ๕‫ة‬ఄೡ٪ሞ‫ڦ‬ऐႁ‫ܔ‬ഋဃ
ֶत໫‫ݣ‬ᅺጱLjᆖၚକ‫ة‬ఄೡׂิ‫ڦ‬XĂYፖՔăᅺُLj࢔
వॽ‫ة‬ఄೡ‫ڦ‬ፖՔᇑഄࢫ၂๖ೡ)ᅂৗೡ‫ྜ*ڪ‬ඇ‫ܔ‬ഋăࡤ
ᆶ‫ة‬ఄೡ‫ڦ‬ፌዕׂ೗‫้׍؜‬LjՂႷ๯ံኴႜၯጚ໙݆ă
ኍ‫ةܔ‬ఄೡ‫ڦ‬ঢ়‫ۆ‬ၯጚ໙݆๟ᅃዖएᇀෙ߲֖ቷ‫ڦۅ‬ෙ‫ۅ‬
ၯጚ໙݆ăኄዖঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ၳ୲ߛĂၳࡕࡻLj‫ړڍ‬
‫ة‬ఄೡড‫้ٷ‬LjႠీড‫گ‬ăԨᆌᆩԴऻኍ‫ۉܔ‬ፆ๕‫ة‬ఄ
ೡLj༵‫؜‬କᅃዖएᇀፌၭ਩‫ݛ‬ဃֶ(MMSE)‫ۅܠڦ‬ၯጚ໙
݆Lj֑ᆩෙ߲ᅜฉ‫֖ڦ‬ቷ‫ۅ‬ăຕბླྀ‫ํࢅڞ‬ᄓ਩ኤ௽LjԨ
໙݆‫ڦ‬৛‫܈‬ᆫᇀঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ă
Rev. 0
Information furnished by Analog Devices is believed to be accurate and reliable. However, no
responsibility is assumed by Analog Devices for its use, nor for any infringements of patents or other
rights of third parties that may result from its use. Specifications subject to change without notice. No
license is granted by implication or otherwise under any patent or patent rights of Analog Devices.
Trademarks and registered trademarks are the property of their respective owners.
One Technology Way, P.O. Box 9106, Norwood, MA 02062-9106, U.S.A.
Tel: 781.329.4700
www.analog.com
Fax: 781.461.3113
©2009 Analog Devices, Inc. All rights reserved.
Rev. 0 | Page 1 of 12
AN-1021
ᆌᆩԴऻ
ణ୤
०঻ ................................................................................................... 1
๖૩ ................................................................................................... 7
ຕბᇱ૙ .......................................................................................... 3
঳ஃ ................................................................................................... 8
ঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ ................................................................ 4
‫پ‬ஓኴႜ ........................................................................................... 8
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆ ................................................ 4
Պஓ ................................................................................................... 9
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ݴڦ‬ဆ ................................... 6
֖੊࿔၅ ........................................................................................ 11
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ڦ‬օየ ................................... 6
Rev. 0 | Page 2 of 12
AN-1021
ᆌᆩԴऻ
ຕბᇱ૙
཮1໯๖ࢤ෥ᇶႚ‫ڦ‬૙ၙዐ႐ྺO)ᇱ‫*ۅ‬Lj૙ၙӷ০ྺRă
्ۨ޿ࢤ෥ᇶႚ‫پ‬՗‫ڦ‬๟‫ة‬ఄೡူ‫ݛ‬ᅂৗೡ໯၂๖‫཮ڦ‬
ၟăઢ෥ྈᇶ՗๖ᆩࢽᄂጣᅂৗೡ໯๖ࢤ෥ᇶႚ৊ႜ‫ة‬ఄ
้Lj‫ة‬ఄೡׂิ‫ڦ‬ᅃፇ‫཮)ۅ‬ዐྺੲቧ‫ڦ‬၂๖*ăᅺُLj๴
‫ۉ‬ፆ๕‫ة‬ఄೡԨวऐႁ‫ܔ‬ഋဃֶࢅ໫‫ݣ‬ᅺጱ‫ڦ‬ᆖၚLjዘࠓ
ࢫ‫཮ڦ‬ၟሞ߳ፖՔዡฉ਩ᅜփཞ‫ڦ‬ᅺጱ჉ገĂೝᅎࢅ໫
‫ݣ‬ăၯጚ໙݆௬ଣ‫ڦ‬཈቟๟සࢆॽ‫ة‬ఄೡׂิ‫ڦ‬ፖՔገ࣑
‫ׯ‬৛ඓ‫پ‬՗໯๖཮ၟ‫ڦ‬ᅃፇፖՔă
ྺକՍᇀ‫ॆٷ‬૙঴ᅜฉ‫ݴ‬ဆLjփ‫्ݟ‬ยP’(x’, y’)ྺ‫ة‬ఄೡ኱থ
ׂิ‫ڦ‬ፖՔLjഄ‫ڪ‬ॏटፖՔ՗‫ٳ‬๕P’(Rcos θ0, Rsin θ0)ăଷྔ्
ยLjᇑP’(x’, y’)‫ܔ‬ᆌ‫ڦ‬૙ၙፖՔྺP(x, y)ă६ᇀP’(x’, y’)ᇑP(x, y)‫ڦ‬
࠲ဣLj੗‫ڥ‬ǖ
P(x, y) = P(KXRcos(θ0 + θ) + TX, KYRsin(θ0 + θ) + TY)
਍ෙঙࡧຕLj
cos(θ0 + θ) = cosθ0 cosθ − sinθ0 sinθ
त
sin(θ0 + θ) = sinθ0 cosθ + cosθ0 sinθ
੗‫ڥ‬ᅜူ‫ײݛ‬๕ǖ
⎧ x' = R cos θ 0
⎨ y ' = R sin θ
0
⎩
P (x , y )
⎧ x = K X R cos(θ 0 + θ ) + T X = K X R(cos θ 0 cos θ − sin θ 0 sin θ ) + T X
⎨ y = K R sin (θ + θ ) + T = K R(sin θ cos θ − cos θ sin θ ) + T
Y
0
Y
Y
0
0
Y
⎩
P(x, y)
ሶᆶ
O
O
⎧ x = cos θK X x'− sin θK X y '+T X
⎨ y = cos θK y '− sin θK x'+T
Y
Y
Y
⎩
ഄዐǖ
θĂKXĂKYĂTXࢅTY਩ྺ‫׉‬ຕă
08183-001
ยǖ
cosθKX = KX1
཮ 1. ‫ة‬ఄೡဃֶ
−sinθKX = KX2
ย٪ሞᅃ‫ۅ‬Ljഄ૙ၙፖՔྺP(x, y)Lj൐‫ة‬ఄೡׂิ‫ڦ‬ፖՔ
ྺP’(x’, y’)ă)P‫ۅ‬࿋ᇀࢤ෥ᇶႚฉLjᇑഄ‫ܔ‬ᆌ‫ڦ‬P’‫ۅ‬ሶ࿋ᇀ
ઢ෥ྈᇶฉă*ยP’(x’, y’) ჉ገθঙ‫܈‬Lj඗ࢫሞXࢅYዡ‫ݴ‬՚
໫‫ݣ‬KXࢅKYLj‫ݴ‬՚ೝᅎTXࢅTYLj੗ᅜ࣮‫ڟ‬ഄ૙ၙፖՔP(x,
y)ăၯጚ໙݆‫ڦ‬ణ‫ڦ‬๟ऺ໙ဣຕθĂKXĂKYĂTXࢅTYă඗
ࢫ੗૧ᆩኄၵဣຕ‫ةܔ‬ఄೡ኱থׂิ‫ڦ‬ፖՔ৊ႜၯጚă
TX = KX3
sinθKY = KY1
cosθKY = KY2
TY = KY3
ሶമຎ‫ײݛ‬๕੗߀ႀྺǖ
⎧ x = KX 1 x'+ KX 2 y '+ KX 3
⎨ y = KY y '+ KY y '+ KY
1
2
3
⎩
੗૧ᆩᅜฉ‫ײݛ‬๕ઠၯጚP’(x’, y’)Ljܸٗ‫ڟڥ‬P(x, y)ă‫ܔ‬ᇀXዡ
ࢅYዡܸჾLj߳‫ײݛ‬๕ዐ਩ࡤᆶෙ߲࿄ኪဣຕă
Rev. 0 | Page 3 of 12
AN-1021
ᆌᆩԴऻ
ঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆!
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆
ཚࡗฉຎ‫ݴ‬ဆLj࿢்‫ڟڥ‬କXዡईYዡ‫ڦ‬ၯጚ‫ײݛ‬๕ă‫ܔ‬ᇀ
X ዡई Y ዡLj߳‫ײݛ‬๕਩ࡤᆶෙ߲࿄ኪဣຕăᅺُLjසࡕ
੗इ‫ڥ‬ෙ߲փ၎࠲֖ቷ‫ڦۅ‬႑တLjሶ੗ࠓॺ‫؜‬၍Ⴀ‫ײݛ‬
ፇLjཚࡗ঴‫ײݛ‬ઠइ‫ڥ‬࿄ኪဣຕ‫ڦ‬঴ă
ยෙ߲֖ቷ‫ڦۅ‬૙ၙፖՔྺ(x0, y0)Ă(x1, y1) ࢅ (x2, y2)Ljഄ‫ܔ‬
ᆌ‫֑ڦ‬ᄣፖՔྺ(x’0, y’0)Ă(x’1, y’1) ࢅ (x’2, y’2)LjሶXዡࢅYዡ
‫ײݛڦ‬๕‫ݴ‬՚ྺ
૧ᆩঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆‫ڦڟڥ‬ဣຕLj੗ᅜॽෙ߲֖ቷ‫ۅ‬ၯ
ጚ‫ڟ‬૙ၙ࿋ዃă඗ܸLj‫ܔ‬ᇀփሞ֖ቷ‫޹ۅ‬ৎ‫ڦ‬ഄ໱‫ۅ‬Ljၯ
ጚႠీփฯ૙ၙLj‫ةړ‬ఄೡ၎‫ܔ‬ড‫้ٷ‬ᆮഄසُă๖૩և
‫ํڦݴ‬ᄓ঳ࡕཞᄣኤํକኄ߲࿚༶ăᅺُLj੗੊୯૧ᆩෙ
߲ᅜฉ‫֖ڦ‬ቷ‫ۅ‬Ljᅜइ‫ڥ‬ፌॅၯጚဣຕă
⎧ x0 = KX 1 x0' + KX 2 y 0' + KX 3
⎪
'
'
⎨ x1 = KX 1 x1 + KX 2 y1 + KX 3
'
⎪ x2 = KX 1 x2 + KX 2 y 2' + KX 3
⎩
ยᆶN + 1߲֖ቷ‫(ۅ‬N + 1 > 3)Ljഄ૙ၙፖՔྺ(x0, y0)Ă(x1,
y1)…(xN, yN)Lj൐ഄ‫ܔ‬ᆌ‫֑ڦ‬ᄣፖՔྺ(x’0, y’0)Ă(x’1, y’1)…
(x’N, y’N)Ljሶ၎ᆌ‫ײݛڦ‬๕සူǖ
⎧ x0 = KX 1 x0' + KX 2 y0' + KX 3
⎪
'
'
⎪ x1 = KX 1 x1 + KX 2 y1 + KX 3
⎨
M
⎪
⎪⎩ x N = KX 1 x N' + KX 2 y N' + KX 3
त
⎧ y0 = KY1 x0' + KY2 y0' + KY3
⎪
'
'
⎨ y1 = KY1 x1 + KY2 y1 + KY3
⎪ y = KY x ' + KY y ' + KY
1 2
2 2
3
⎩ 2
त
⎧ y0 = KY1 x0' + KY2 y0' + KY3
⎪
'
'
⎪ y1 = KY1 x1 + KY2 y1 + KY3
⎨
M
⎪
'
⎪⎩ y N = KY1 x N + KY2 y N' + KY3
एᇀُLj੗ॽᅜฉຎ‫߀ײݛ‬ႀྺਈንఇ๕ǖ
⎡ x0'
⎢ '
⎢ x1
⎢ x2'
⎣
y0' 1⎤ ⎡ KX 1 ⎤ ⎡ x0 ⎤
⎥
y1' 1⎥ • ⎢⎢ KX 2 ⎥⎥ = ⎢⎢ x1 ⎥⎥
y2' 1⎥⎦ ⎢⎣ KX 3 ⎥⎦ ⎢⎣ x2 ⎥⎦
⎡ x0'
⎢ '
⎢ x1
⎢ x2'
⎣
y0' 1⎤ ⎡ KY1 ⎤ ⎡ y0 ⎤
⎥
y1' 1⎥ • ⎢⎢ KY2 ⎥⎥ = ⎢⎢ y1 ⎥⎥
'
y2 1⎥⎦ ⎢⎣ KY3 ⎥⎦ ⎢⎣ y2 ⎥⎦
ጀᅪLj߳‫ײݛ‬ፇዐ‫ײݛڦ‬ຕ(N + 1)਩‫ٷ‬ᇀ࿄ኪဣຕ‫߲ڦ‬ຕ
(3)ă
त
੗९Lj࿢்‫ڦ‬ణ‫ڦ‬๟໙‫؜‬๢ࢇඇև(N + 1)߲֖ቷ‫ڦۅ‬ፌॅ
ၯጚဣຕăइ‫ڥ‬ፌॅဣຕ‫݆ݛڦ‬๟ፏთMMSEࡀሶăኄኟ
๟ኄዖ໙݆‫ྺ׬‬एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ڦ‬ᇱᅺ໯ሞă
ᅜXዡྺ૩Ljۨᅭᅃ߲ణՔࡧຕ
ሞُए‫إ‬ฉLj੗ᅜཚࡗ঴‫ײݛ‬໙‫؜‬ၯጚဣຕKX1ĂKX2Ă
KX3ĂKY1ĂKY2 ࢅ KY3ă
ཚࡗၩᇮ݆൱‫ڦڥ‬঳ࡕසူǖ
'
'
'
'
'
'
'
'
k = ( x0 − x2 )( y1 − y2) − (x1 − x2 )( y0 − y2 ) ሶ
ย!!!!!!!!!!!!!!!!!!
KX 1 =
KX 2 =
KX 3 =
KY1 =(
KY2 =
N
i =0
ഄዐLjFXྺ֖ቷ‫ڦۅ‬ဃֶೝ‫ࢅݛ‬ă
( x0 − x2 )( y1' − y2 ' ) − ( x1 − x2 )( y0' − y2' )
k
( x1 − x2 )( x1' − x2 ' ) − ( x0 − x2 )( x1' − x2' )
k
'
0
'
2 1
'
1 2
y (x x − x x ) +(y1' x0' x2 − x2' x0)+ (y2' x1' x0 − x0' x1)
k
y0 − y2)( x1' − x2 ') − ( y1 − y2
k
)( y
'
0
− y2' )
( y1 − y2 )(x0' − x2 ') −( y0 − y2 )(x1' − x2' )
KY3 =
(
FX = ∑ KX 1 xi' + KX 2 yi' + KX 3 − xi
k
y0'( x2' y1 − x1' y2 )+ (y1' x0' y2 − x2' y0) +(y2' x1' y0 − x0' y1)
k
Rev. 0 | Page 4 of 12
)
2
AN-1021
ᆌᆩԴऻ
KX1ĂKX2ࢅKX3‫ڦ‬ፌॅဣຕኸ๑ణՔࡧຕFXፌၭ‫ڦ‬ఫၵဣ
ຕăᅺُLj੗๑ᆩᅜူ‫ײݛ‬๕ǖ
ཚࡗၩᇮ݆൱‫ڦڥ‬঳ࡕසူǖ
ย
⎧ ∂FX
=0
⎪
⎪ ∂KX 1
⎪ ∂FX
=0
⎨
⎪ ∂KX 2
⎪ ∂FX = 0
⎪ ∂KX
3
⎩
न
N
⎧ ∂FX
=
2 xi' KX 1 xi' + KX 2 yi' + KX 3 − xi = 0
∑
⎪
∂
KX
i
0
=
1
⎪
N
⎪ ∂FX
= ∑ 2 yi' KX 1 xi' + KX 2 yi' + KX 3 − xi = 0
⎨
⎪ ∂KX 2 i=0N
⎪ ∂FX
'
'
⎪ ∂KX = ∑ 2 KX 1 xi + KX 2 yi + KX 3 − xi = 0
i =0
3
⎩
(
)
(
)
(
i =0
N
∑y
i =0
N
'2
i
∑y
i =0
'
i
⎡ KY1 ⎤
⎢ KY2 ⎥
⎢ KY ⎥
⎣ 3⎦
b1 =
∑y
∑y
, b = ∑ yi ,
2
c0 =
∑x x
∑x
c1 =
∑yx
∑y
, c = ∑ xi ,
2
d0 =
∑x y ,
∑x
d1 =
∑yx
∑y
, d = ∑ yi
2
'
i
'
i
,
'
i
' '
i i
'
i
'
i i
'
i
,
'2
i
'
i
'
i i
'
i
'
i i
'
i
a2 =
'
i
N
'
N
'
N
'
N
⎡ a0
⎢a
⎢ 1
⎢⎣a2
b0 1⎤ ⎡ KX 1 ⎤ ⎡c0 ⎤
b1 1⎥⎥ • ⎢⎢ KX 2 ⎥⎥ = ⎢⎢ c1 ⎥⎥
b2 1⎥⎦ ⎢⎣ KX 3 ⎥⎦ ⎢⎣c2 ⎥⎦
⎡a0
⎢a
⎢ 1
⎣⎢a2
b0 1⎤ ⎡ KY1 ⎤ ⎡d 0 ⎤
b1 1⎥⎥ • ⎢⎢ KY2 ⎥⎥ = ⎢⎢ d1 ⎥⎥
b2 1⎥⎦ ⎢⎣ KY3 ⎦⎥ ⎣⎢d 2 ⎦⎥
փవ݀၄Ljᅜฉ‫ײݛ‬ፇ‫߭ڦ‬๕ᇑമ௬ঢ়‫ۆ‬ෙ‫ۅ‬໙݆‫ײݛڦ‬ፇ
၎ཞǖ
⎡
' ⎤
⎤
xi' ⎥
⎢ ∑ xi xi ⎥
∑
i =0
⎡ KX 1 ⎤
⎢ iN=0
⎥
⎥
N
⎢ y' x ⎥
⎢
⎥
'⎥
=
BX
y
,
,
KX = ⎢ KX 2 ⎥
i i
∑
i
⎢∑
⎥
⎥
i =0
i =0
⎢ N
⎥
⎥
⎢⎣ KX 3 ⎥⎦
⎢ ∑ xi ⎥
N ⎥
⎢⎣ i =0 ⎥⎦
⎥⎦
, BY=
∑x y
∑x
'
i
'
i
त
N
⎡ x0'
⎢ '
⎢ x1
⎢ x2'
⎣
y0' 1⎤ ⎡ KX 1 ⎤ ⎡ x0 ⎤
⎥
y1' 1⎥ • ⎢⎢ KX 2 ⎥⎥ = ⎢⎢ x1 ⎥⎥
y2' 1⎥⎦ ⎢⎣ KX 3 ⎥⎦ ⎢⎣ x2 ⎥⎦
⎡ x0'
⎢ '
⎢ x1
⎢ x2'
⎣
y0' 1⎤ ⎡ KY1 ⎤ ⎡ y0 ⎤
⎥
y1' 1⎥ • ⎢⎢ KY2 ⎥⎥ = ⎢⎢ y1 ⎥⎥
y2' 1⎥⎦ ⎢⎣ KY3 ⎥⎦ ⎢⎣ y2 ⎥⎦
त
एᇀُLj੗ॽ߳‫ײݛ‬๕߀ႀྺਈንఇ๕3t,9#9Ljժ੗
ཚࡗ൱঴മຎ‫ײݛ‬ፇ໙‫؜‬ፌॅဣຕ,93−1t#9ă
ᇑXዡૌຼLjย
KY=
b0 =
'
i
i =0
)
N
∑x y ,
∑y
एᇀُLj੗ॽ‫ײݛ‬ፇ3t,9#9ࢅ3t,:#:‫ݴ‬՚߀ႀྺ
ย
∑ xi' yi'
a1 =
'
i
N
N
⎧⎛ N ' 2 ⎞
⎛ N ' '⎞
⎛ N '⎞
' '
⎪⎜ ∑ xi ⎟ KX 1 + ⎜ ∑ xi yi ⎟ KX 2 + ⎜ ∑ xi ⎟ KX 3 = ∑ xi xi
i
i
i
i
=
=
=
=
0
0
0
0
⎝
⎠
⎝
⎠
⎝
⎠
⎪
N
⎛ N '⎞
⎛ N '⎞
⎪⎛ N ' ' ⎞
' '
⎨ ⎜ ∑ xi yi ⎟ KX 1 + ⎜ ∑ yi ⎟ KX 2 + ⎜ ∑ yi ⎟ KX 3 = ∑ yi xi
i =0
⎠
⎝ i =0 ⎠
⎝ i =0 ⎠
⎪ ⎝ i =0
N
⎪
⎛ N '⎞
⎛ N '⎞
⎜ ∑ xi ⎟ KX 1 + ⎜ ∑ yi ⎟ KX 2 + N ⋅ KX 3 = ∑ xi
⎪
i =0
⎝ i =0 ⎠
⎝ i =0 ⎠
⎩
N
∑x
∑x ,
∑x
ഄዐLj!!!՗๖
Σ•
∑•
ᅜฉ‫ײݛ‬๕੗०ࣅྺ
⎡ N '2
⎢ ∑ xi
⎢ Ni=0
R = ⎢∑ xi' yi'
⎢ i =0
⎢ N
⎢ ∑ xi'
⎢⎣ i=0
'2
i
a0 =
⎡N ' ⎤
⎢∑ xi y i ⎥
⎢ i N= 0
⎥
⎢ y' y ⎥
∑
i i
⎢ i =0
⎥
⎢ N
⎥
⎢ ∑ yi ⎥
⎣⎢ i = 0
⎦⎥
඗ࢫन੗ཚࡗ൱঴‫ײݛ‬ፇ3 t ,: #:Lj໙‫؜‬:ዡ‫ڦ‬ፌॅဣ
ຕ,:3−1t#:ă
Rev. 0 | Page 5 of 12
AN-1021
ᆌᆩԴऻ
ሞُए‫إ‬ฉLj੗૧ᆩ၎ཞ‫ࠅڦ‬๕ऺ໙ဣຕ‫ڦ‬঳ࡕă
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ڦ‬օየ
ย
ྜ‫ׯ‬एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ူڦ‬ଚօየǖ
1. ჋ስN +1 (N + 1 > 3)߲֖ቷ‫(ۅ‬x0, y0)Ă(x1, y1)…(xN,
yN)ă
2. ‫ةڟڥ‬ఄೡׂิ‫֖ڦ‬ቷ‫֑ڦۅ‬ᄣፖՔ(x’0, y’0)Ă(x’1, y’1)
…(x’N, y’N)ă
3. ૧ᆩԨᆌᆩԴऻߴ‫ࠅڦ؜‬๕Lj໙‫؜‬ၯጚဣຕKXࢅ!
!
KYăԈઔᅜူࠅ๕ǖ
k = (a0 − a2 )(b1 − b2 )− (a1 − a2 )(b0 − b2 )
ሶ
KX 1 =
KX 2 =
(c0 − c2 )(b1 − b2 )− (c1 − c2 )(b0 − b2 )
k
(c1 − c2 )(a0 − a2 )− (c0 − c2 )(a1 − a2 )
k = (a0 − a2 )(b1 − b2 )− (a1 − a2 )(b0 − b2 )
k
(c0 − c2 )(b1 − b2 )− (c1 − c2 )(b0 − b2 )
KX 1 =
b (a c − a c )+ b1 (a0c2 − a2c0 )+ b2 (a1c0 − a0c1 )
KX 3 = .0 2 1 1 2
k
k
KX 2 =
KY1
(d − d 2 )(b1 − b2 )− (d1 − d 2 )(b0 − b2 )
= 0
KX 3 =
KY2
(d − d 2 )(a0 − a2 )− (d 0 − d 2 )(a1 − a2 )
= 1
k
k
KY1 =
b (a d − a d )+ b1 (a0 d 2 − a2 d 0 )+ b2 (a1d 0 − a0 d1 )
KY3 = .0 2 1 1 2
k
KY2 =
एᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ݴڦ‬ဆ
ཚࡗऺ໙a0Ăa1Ăa2Ǘb0Ăb1Ăb2Ǘc0Ăc1Ăc2ࢅd0Ăd1Ăd2੗
ᅜ݀၄Lj੗ॽa0Ăa1Ăa2‫ړ‬ፕएᇀෙዖփཞ‫ڦ݆ݛ‬x’i‫ेڦ‬඄
ೝ਩ኵLj੗ॽb0Ăb1Ăb2ੂፕएᇀෙዖփཞ‫ڦ݆ݛ‬y’i‫ेڦ‬඄
ೝ਩ኵăૌຼ‫ں‬Lj੗ॽc0Ăc1Ăc2‫ړ‬ፕएᇀෙዖփཞ‫ڦ݆ݛ‬
xi‫ेڦ‬඄ೝ਩ኵLjd0Ăd1Ăd2ሶ੗๫ྺएᇀෙዖփཞ‫ڦ݆ݛ‬
yi‫ेڦ‬඄ೝ਩ă
KY3 =
4.
ᆯᇀፌዕ‫ײݛ‬ፇᇑമ௬ঢ়‫ۆ‬ෙ‫ۅ‬໙݆‫ײݛڦ‬ፇਏᆶ၎ཞ߭
๕LjᅺُLj੗ॽएᇀMMSEࡀሶ‫ڦ‬໙݆๫ྺଷᅃዖෙ‫ۅ‬໙
݆ă඗ܸLjएᇀMMSE‫ڦ‬໙݆‫ڦ‬൶՚ሞᇀLjഄ֑ᆩ‫ڦ‬փ๟
ඪࢆ֖ቷ‫ڦۅ‬኱থ႑တLjܸ๟֖ቷ‫ेڦۅ‬඄ೝ਩႑တă࣑
ჾኮLjံᄲ໙‫؜‬N + 1߲኱থ֑ᄣ‫(ۅ‬x’0, y’0)Ă(x’1, y’1)…(x’N,
y’N)‫ڦ‬ෙ߲े඄ೝ਩‫(ۅ‬a0, b0)Ă(a1, b1)Ă(a2, b2)ăኄෙ߲े඄
ೝ਩‫ܔۅ‬ᆌ‫ڦ‬૙ၙፖՔྺ(c0, d0)Ă(c1, d1)ࢅ(c2, d2)ă੗९Lj
एᇀMMSE‫ڦ‬໙݆‫ڪ‬ၳᇀ‫ܔ‬ኄෙ߲े඄ೝ਩‫ܸۅ‬ჾ‫ڦ‬ঢ়‫ۆ‬
ෙ‫ۅ‬໙݆ă
Rev. 0 | Page 6 of 12
(c1 − c2 )(a0 − a2 )− (c0 − c2 )(a1 − a2 )
k
b.0 (a2c1 − a1c2 )+ b1 (a0c2 − a2c0 )+ b2 (a1c0 − a0c1
k
(d 0 − d 2 )(b1 − b2 )− (d1 − d 2 )(b0 − b2 )
k
(d1 − d 2 )(a0 − a2 )− (d 0 − d 2 )(a1 − a2 )
k
b.0 (a2 d1 − a1d 2 )+ b1 (a0 d 2 − a2 d 0 )+ b2 (a1d 0 − a0 d1 )
k
ሞኟ‫֡׉‬ፕዐLj૧ᆩၯጚဣຕ(KX, KY)ࢅူଚ‫ײݛ‬๕
ऺ໙P’(x’, y’)‫ڦ‬ၯጚ‫ۅ‬ă
⎧ x = KX 1 x ' + KX 2 y ' + KX 3
⎨
'
'
⎩ y = KY1 x + KY2 y + KY3
)
AN-1021
ᆌᆩԴऻ
๖૩
থူઠ‫ڦ‬ෙ߲ํᄓ‫ݴ‬՚֑ᆩঢ়‫ۆ‬ෙ‫ۅ‬໙݆ĂएᇀMMSE‫ڦ‬࿵
‫ۅ‬໙݆ࢅएᇀMMSE‫ڦ‬৵‫ۅ‬໙݆ǖ
1
2
3
ঢ়‫ۆ‬ෙ‫ۅ‬໙݆჋ስෙ߲֖ቷ‫ۅ‬Ljन཮2ዐ‫ۅڦ‬1Ă‫ۅ‬6ࢅ‫!ۅ‬
8ă၎ᆌ‫ڦ‬ၯጚဣຕྺǖ
KX1=+1.011238LjKX2=−0.003952LjKX3=−24.638760
KY1=+0.009894LjKY2=+1.005168LjKY3=−130.112700
૧ᆩᅜฉဣຕLjၯጚࢫ‫ڦ‬঳ࡕଚᇀ՗1ዐă
एᇀMMSE‫ڦ‬࿵‫ۅ‬໙݆჋ስ࿵߲֖ቷ‫ۅ‬Ljन཮2ዐ‫!ۅڦ‬
1Ă‫ۅ‬3Ă‫ۅ‬5Ă‫ۅ‬7ࢅ‫ۅ‬9ă၎ᆌ‫ڦ‬ၯጚဣຕྺǖ
KX1= +1.009899, KX2 = −0.002260, KX3 = −23.715720
KY1=+0.008494, KY2= +1.006247, KY3 = −121.821000
૧ᆩᅜฉဣຕLjၯጚࢫ‫ڦ‬঳ࡕଚᇀ՗2ዐă
एᇀMMSE‫ڦ‬৵‫ۅ‬໙݆჋ስ৵߲֖ቷ‫ۅ‬Ljन཮2ዐ‫!ۅڦ‬
1Ă‫ۅ‬2Ă‫ۅ‬3Ă‫ۅ‬4Ă‫ۅ‬5Ă‫ۅ‬6Ă‫ۅ‬7Ă‫ۅ‬8ࢅ‫ۅ‬9ă၎ᆌ‫!ڦ‬
ၯጚဣຕྺǖ
KX1= +1.011161, KX2 = −0.001887, KX3 = −25.777180
KY1=+0.009718, KY2= +1.006107, KY3 = −126.258100
૧ᆩᅜฉဣຕLjၯጚࢫ‫ڦ‬঳ࡕଚᇀ՗3ዐă
!
5
6
7
8
9
!
!
!
08183-002
4
཮ 2. ჋ስ֖ቷ‫ۅ‬
ස཮2໯๖Ljٗ‫ة‬ఄೡฉ჋ስକ৵߲‫ۅ‬ăഄ૙ၙፖՔྺ
(3931, 3849)Ă(2047, 3849)Ă(164, 3849)Ă(3931, 2047)Ă
(2047, 2047)Ă(164, 2047)Ă(3931, 246)Ă(2047, 246) ࢅ (164,
246)ă‫ة‬ఄೡׂิ‫ܔڦ‬ᆌ֑ᄣፖՔྺ(3927, 3920)Ă(2054,
3936)Ă(193, 3943)Ă(3911, 2119)Ă(2054, 2127)Ă(195,
2164)Ă(3915, 331)Ă(2050, 354)ࢅ(189, 371)ă၂඗Lj૙ၙፖ
Քᇑ‫ܔ‬ᆌ‫֑ڦ‬ᄣፖՔኮक़٪ሞट‫ڦٷ‬ဃֶă
!
!
!
!
!
՗1. ঢ়‫ۆ‬ෙ‫ۅ‬໙݆‫ڦ‬঳ࡕ
Point (X, Y)
૙ၙፖՔ
֑ᄣፖՔ
ၯጚፖՔ
ဃֶ
ဃֶೝ‫ࢅݛ‬
1
(3931, 3849)
(3927, 3920)
(3931, 3849)
(0, 0)
(276, 650)
2
(2047, 3849)
(2054, 3936)
(2037, 3846)
(−10, −3)
3
(164, 3849)
(193, 3943)
(155, 3835)
(−9, −14 )
4
(3931, 2047)
(3911, 2119)
(3922, 2039)
(−9, −8 )
5
(2047, 2047)
(2054, 2127)
(2044, 2028)
(−3, −19 )
6
(164, 2047)
(195, 2164)
(164, 2047)
(0, 0)
7
(3931, 246)
(3915, 331)
(3933, 242)
(+2, −4 )
8
(2047, 246)
(2050, 354)
(2047, 246)
(0, 0)
9
(164, 246)
(189, 371)
(165, 244)
(+1, −2)
1
2
3
4
5
6
7
8
9
(3931, 3849)
(3927, 3920)
(3933, 3856)
(2, 7)
(159, 418)
(2047, 3849)
(2054, 3936)
(2042, 3856)
(−5, +7)
(164, 3849)
(193, 3943)
(162, 3847)
(−2, −2 )
(3931, 2047)
(3911, 2119)
(3921, 2044)
(−10, −3 )
(2047, 2047)
(2054, 2127)
(2046, 2036)
(−1, −11)
(164, 2047)
(195, 2164)
(168, 2057)
(4, 10)
(3931, 246)
(3915, 331)
(3929, 245)
(−2, −1)
(2047, 246)
(2050, 354)
(2046, 252)
(−1, +6)
(164, 246)
(189, 371)
(166, 253)
(+2, +7)
1
2
3
4
5
6
7
8
9
(3931, 3849)
(3927, 3920)
(3938, 3856)
(7, 7)
(110, 363)
(2047, 3849)
(2054, 3936)
(2044, 3854)
(−3, +5)
(164, 3849)
(193, 3943)
(162, 3842)
(−2, −7)
(3931, 2047)
(3911, 2119)
(3925, 2044)
(−6, −3)
(2047, 2047)
(2054, 2127)
(2047, 2034)
(0, −13)
(164, 2047)
(195, 2164)
(167, 2053)
(3, 6)
(3931, 246)
(3915, 331)
(3932, 245)
(+1, −1)
(2047, 246)
(2050, 354)
(2046, 250)
(−1, +4)
(164, 246)
(189, 371)
(165, 249)
(+1,+3)
՗2. एᇀMMSE‫ڦ‬࿵‫ۅ‬໙݆‫ڦ‬঳ࡕ
Point (X, Y˅
૙ၙፖՔ
֑ᄣፖՔ
ၯጚፖՔ
ဃֶ
ဃֶೝ‫ࢅݛ‬
՗3. एᇀMMSE‫ڦ‬৵‫ۅ‬໙݆‫ڦ‬঳ࡕ
Point (X, Y˅
૙ၙፖՔ
֑ᄣፖՔ
ၯጚፖՔ
ဃֶ
ဃֶೝ‫ࢅݛ‬
Rev. 0 | Page 7 of 12
AN-1021
ᆌᆩԴऻ
঳ஃ!
‫پ‬ஓኴႜ!
සമຎํᄓ঳ࡕ໯๖Lj࿮ஃ֑ᆩనዖၯጚ໙݆LjၯጚፖՔ
਩ᇺᇺᆫᇀ኱থ֑ᄣፖՔăଷྔLjཚࡗԲডෙዖํᄓLj੗
‫؜ڥ‬ᅜူ঳ஃ
ᅜCᇕჾՊႀ‫ڦ‬ၯጚ໙݆‫پ‬ஓ९“Պஓ”և‫ݴ‬ăᆶෙ߲֖ቷ
‫้ۅ‬Lj‫پ‬ஓኴႜঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ăᆶෙ߲ᅜฉ‫֖ڦ‬ቷ‫ۅ‬
้Lj‫پ‬ஓኴႜएᇀMMSE‫ۅܠڦ‬ၯጚ໙݆ă‫پ‬ஓᅙཚࡗ
ADuC7026֪๬)ADuC7026๟ADIࠅິ‫؜‬೗‫ڦ‬ᅃ੼MCUׂ
೗*ăෙ߲๖૩ํᄓ‫ڦ‬঳ࡕ਩֑ᆩ޿‫پ‬ஓऺ໙‫ڟڥ‬ă
!
!
!
!
!
!
!
!
!
!
ঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ᆶዺᇀॽෙ߲֖ቷ‫ۅ‬ၯጚ‫ڟ‬૙ၙ࿋!
ዃăଷྔLj‫ܔ‬ᇀ੍ৎෙ߲֖ቷ‫ۅڦۅ‬LjഄႠీ՗၄‫!ݥ‬
‫ࡻ׉‬ă඗ܸLj‫ܔ‬ᇀփሞ֖ቷ‫޹ۅ‬ৎ‫ۅڦ‬Ljঢ়‫ۆ‬ෙ‫ۅ‬ၯ!
ጚ໙݆‫ڦ‬՗၄փฯ૙ၙăኄዖ໙݆‫ڦ‬ဃֶೝ‫ࢅݛ‬๟֪!
๬໯ᆩෙዖ໙݆ዐፌ‫ڦٷ‬ăᅺُLj‫ܔ‬ᇀ‫ة‬ఄೡ؅٫၎!
‫ܔ‬ড‫ڦٷ‬ᆌᆩLjঢ়‫ۆ‬ෙዖၯጚ໙݆ժ‫ڦࡻݥ‬჋ስă
‫ܔ‬ᇀగၵ‫)ۅ‬থৎ֖ቷ‫*ۅڦۅ‬LjएᇀMMSE‫ۅܠڦ‬ၯ!
ጚ໙݆‫ڦ‬՗၄փසঢ়‫ۆ‬ෙ‫ۅ‬ၯጚ໙݆ă඗ܸLj৽ኝ߲!
‫ة‬ఄೡઠੂLjएᇀMMSE‫ۅܠڦ‬ၯጚ໙݆‫ڦ‬ဃֶೝ‫!ݛ‬
ࢅၭᇀঢ়‫ۆ‬ෙ‫ۅ‬໙݆Ljᅺྺ໲૧ᆩକෙ߲ᅜฉ֖ቷ‫!ۅ‬
‫ڦ‬႑တăᅺܸLjጺ༹ܸჾLjഄႠీᆫᇀঢ়‫ۆ‬ෙ‫ۅ‬໙݆ă
‫ܔ‬ᇀएᇀMMSE‫ۅܠڦ‬ၯጚ໙݆Lj๑ᆩ‫֖ڦ‬ቷ‫ۅ‬ሁ!
‫ܠ‬LjႠీሁॅă
ํᄓ঳ࡕᇑຕბླྀ‫ڞ‬၎‫ࢇޙ‬ă
Rev. 0 | Page 8 of 12
AN-1021
ᆌᆩԴऻ
Պஓ
#define N
algorithm
9
// number of reference points for calibration
signed short int ReferencePoint[N][2];
// ideal position of reference points
signed short int SamplePoint[N][2];
// sampling position of reference points
double KX1, KX2, KX3, KY1, KY2, KY3;
// coefficients for calibration algorithm
void Do_Calibration(signed short int *Px, signed short int *Py) // do calibration for point
(Px, Py) using the calculated coefficients
{
*Px=(signed short int)(KX1*(*Px)+KX2*(*Py)+KX3+0.5);
*Py=(signed short int)(KY1*(*Px)+KY2*(*Py)+KY3+0.5);
}
int Get_Calibration_Coefficient()
algorithm: KX1, KX2, KX3, KY1, KY2, KY3
// calculate the coefficients for calibration
{
int i;
int Points=N;
double a[3],b[3],c[3],d[3],k;
if(Points<3)
{
return 0;
}
else
{
if(Points==3)
{
for(i=0; i<Points; i++)
{
a[i]=(double)(SamplePoint[i][0]);
b[i]=(double)(SamplePoint[i][1]);
c[i]=(double)(ReferencePoint[i][0]);
d[i]=(double)(ReferencePoint[i][1]);
}
}
else if(Points>3)
{
for(i=0; i<3; i++)
{
a[i]=0;
b[i]=0;
c[i]=0;
d[i]=0;
}
for(i=0; i<Points; i++)
Rev. 0 | Page 9 of 12
AN-1021
ᆌᆩԴऻ
{
a[2]=a[2]+(double)(SamplePoint[i][0]);
b[2]=b[2]+(double)(SamplePoint[i][1]);
c[2]=c[2]+(double)(ReferencePoint[i][0]);
d[2]=d[2]+(double)(ReferencePoint[i][1]);
a[0]=a[0]+(double)(SamplePoint[i][0])*(double)(SamplePoint[i][0]);
a[1]=a[1]+(double)(SamplePoint[i][0])*(double)(SamplePoint[i][1]);
b[0]=a[1];
b[1]=b[1]+(double)(SamplePoint[i][1])*(double)(SamplePoint[i][1]);
c[0]=c[0]+(double)(SamplePoint[i][0])*(double)(ReferencePoint[i][0]);
c[1]=c[1]+(double)(SamplePoint[i][1])*(double)(ReferencePoint[i][0]);
d[0]=d[0]+(double)(SamplePoint[i][0])*(double)(ReferencePoint[i][1]);
d[1]=d[1]+(double)(SamplePoint[i][1])*(double)(ReferencePoint[i][1]);
}
a[0]=a[0]/a[2];
a[1]=a[1]/b[2];
b[0]=b[0]/a[2];
b[1]=b[1]/b[2];
c[0]=c[0]/a[2];
c[1]=c[1]/b[2];
d[0]=d[0]/a[2];
d[1]=d[1]/b[2];
a[2]=a[2]/Points;
b[2]=b[2]/Points;
c[2]=c[2]/Points;
d[2]=d[2]/Points;
}
k=(a[0]-a[2])*(b[1]-b[2])-(a[1]-a[2])*(b[0]-b[2]);
KX1=((c[0]-c[2])*(b[1]-b[2])-(c[1]-c[2])*(b[0]-b[2]))/k;
KX2=((c[1]-c[2])*(a[0]-a[2])-(c[0]-c[2])*(a[1]-a[2]))/k;
KX3=(b[0]*(a[2]*c[1]-a[1]*c[2])+b[1]*(a[0]*c[2]-a[2]*c[0])+b[2]*(a[1]*c[0]a[0]*c[1]))/k;
KY1=((d[0]-d[2])*(b[1]-b[2])-(d[1]-d[2])*(b[0]-b[2]))/k;
KY2=((d[1]-d[2])*(a[0]-a[2])-(d[0]-d[2])*(a[1]-a[2]))/k;
KY3=(b[0]*(a[2]*d[1]-a[1]*d[2])+b[1]*(a[0]*d[2]-a[2]*d[0])+b[2]*(a[1]*d[0]a[0]*d[1]))/k;
return Points;
}
}
Rev. 0 | Page 10 of 12
AN-1021
ᆌᆩԴऻ
֖੊࿔၅
Vidales, Carlos E. “How to Calibrate Touch Screens, Embedded Systems Design.”Embedded.com, May 31, 2002. Embedded Systems
Design.May 27, 2009.
Rev. 0 | Page 11 of 12
AN-1021
ᆌᆩԴऻ
ጀ๥
©2009 Analog Devices, Inc. All rights reserved. Trademarks and
registered trademarks are the property of their respective owners.
AN08183-0-7/09(0)
Rev. 0 | Page 12 of 12