ALT Linux Bugzilla
– Attachment 9230 Details for
Bug 39762
[PATCH] порт пересчёта координат из matrix_calibrator.pl
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
патч по мотивам matrix_calibrator
transformation_matrix.patch (text/plain), 2.50 KB, created by
Michael Shigorin
on 2021-03-05 15:51:41 MSK
(
hide
)
Description:
патч по мотивам matrix_calibrator
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2021-03-05 15:51:41 MSK
Size:
2.50 KB
patch
obsolete
>--- xinput_calibrator.orig/src/calibrator.cpp 2021-01-21 05:52:42.096387477 +0300 >+++ xinput_calibrator/src/calibrator.cpp 2021-01-21 11:11:20.368336089 +0300 >@@ -144,6 +144,58 @@ > return false; > } > >+// Transformation matrix >+// from http://support.fccps.cz/download/adv/frr/matrix_calibrator/matrix_calibrator.htm >+ >+ // get the average left/right X and upper/lower Y >+ float x0x = ( clicked.x[UL] + clicked.x[LL] ) / 2.0 / width; >+ float x0y = ( clicked.y[UL] + clicked.y[LL] ) / 2.0 / height; >+ float x1x = ( clicked.x[UR] + clicked.x[LR] ) / 2.0 / width; >+ float x1y = ( clicked.y[UR] + clicked.y[LR] ) / 2.0 / height; >+ float y0x = ( clicked.x[UL] + clicked.x[UR] ) / 2.0 / width; >+ float y0y = ( clicked.y[UL] + clicked.y[UR] ) / 2.0 / height; >+ float y1x = ( clicked.x[LL] + clicked.x[LR] ) / 2.0 / width; >+ float y1y = ( clicked.y[LL] + clicked.y[LR] ) / 2.0 / height; >+//printf ("ZZ: %f %f %f %f %f %f %f %f\n", x0x,x0y, x1x,x1y, y0x,y0y, y1x,y1y); >+ >+ //get the difference right-left X and lower-upper Y >+ float dxx=x1x-x0x; >+ float dxy=x1y-x0y; >+ float dyx=y1x-y0x; >+ float dyy=y1y-y0y; >+//printf ("ZZ: Ds %f %f %f %f\n",dxx,dxy,dyx,dyy); >+ >+/* Calculation equations: >+ 1. x0x * a + x0y * b + c = 1/8 (the left point equation) >+ 2. x1x * a + x1y * b + c = 7/8 (the right point equation) >+ 3. a / b = dxx / dxy (tg alfa) >+ Subtract 1. from 2.: >+ 4. (x1x - x0x) * a + (x1y - x0y) * b = 6/8 >+ 5. dxx * a + dxy * b = 6/8 >+ Isolate (b) from 3.: >+ 6. b = a * dxy / dxx >+ Substitute (b) in 5.: >+ 7. dxx * a + dxy * a * dxy / dxx = 6/8 >+ Isolate (a) from 7.: >+ 8. a * (dxx + dxy^2 / dxx) = 6/8 >+ 9. a * (dxx^2 + dxy^2) / dxx = 6/8 >+ 10. a = 6/8 * dxx / (dxx^2 + dxy^2) !RESULT! >+ Analogically for (b): >+ 11. b = 6/8 * dxy / (dxx^2 + dxy^2) !RESULT! >+ We will get (c) substituting (a) and (b) in 1. >+ For (d), (e) and (f) we use the same solution analogically. >+*/ >+ >+ //calculate the special sauce coefficients >+ float a = 6.0/8 * (dxx / (dxx*dxx + dxy*dxy)); >+ float b = 6.0/8 * (dxy / (dxx*dxx + dxy*dxy)); >+ float c = 1.0/8 - a*x0x - b*x0y; >+ float d = 6.0/8 * (dyx / (dyx*dyx + dyy*dyy)); >+ float e = 6.0/8 * (dyy / (dyx*dyx + dyy*dyy)); >+ float f = 1.0/8 - d*y0x - e*y0y; >+ >+ printf ("ZZ: TransformationMatrix %f %f %f %f %f %f 0 0 1\n", a, b, c, d, e, f); >+ > // new axis origin and scaling > // based on old_axys: inversion/swapping is relative to the old axis > XYinfo new_axis(old_axys);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 39762
: 9230