Results 1 to 1 of 1

Thread: Problem with QT embedded and touchscreen calibration.

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    92
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem with QT embedded and touchscreen calibration.

    Hello,

    After look for a lot of information in the net, now my touchscreen works properly with QT, but now I have tried to calibrate it and I can not do it.

    There is a function called "Calibrate::sanityCheck()" that return me all time false but I do not understand why is the reason.

    This is the source code:

    Qt Code:
    1. bool Calibrate::sanityCheck()
    2. {
    3. #ifdef QWS
    4. QPoint tl = cd.devPoints[QWSPointerCalibrationData::TopLeft];
    5. QPoint tr = cd.devPoints[QWSPointerCalibrationData::TopRight];
    6. QPoint bl = cd.devPoints[QWSPointerCalibrationData::BottomLeft];
    7. QPoint br = cd.devPoints[QWSPointerCalibrationData::BottomRight];
    8.  
    9. // not needed anywhere .. just calculate it, so it's there
    10. cd. devPoints [QWSPointerCalibrationData::Center] = QRect ( tl, br ). normalize ( ). center ( );
    11.  
    12. int dlx = QABS( bl. x ( ) - tl. x ( ));
    13. int dly = QABS( bl. y ( ) - tl. y ( ));
    14. int drx = QABS( br. x ( ) - tr. x ( ));
    15. int dry = QABS( br. y ( ) - tr. y ( ));
    16. int dtx = QABS( tr. x ( ) - tl. x ( ));
    17. int dty = QABS( tr. y ( ) - tl. y ( ));
    18. int dbx = QABS( br. x ( ) - bl. x ( ));
    19. int dby = QABS( br. y ( ) - bl. y ( ));
    20.  
    21. int dl = (int) ::sqrt (( dlx * dlx ) + ( dly * dly )); // calculate vector lengths for all sides
    22. int dr = (int) ::sqrt (( drx * drx ) + ( dry * dry ));
    23. int dt = (int) ::sqrt (( dtx * dtx ) + ( dty * dty ));
    24. int db = (int) ::sqrt (( dbx * dbx ) + ( dby * dby ));
    25.  
    26. // Calculate leeway for x/y (we do not care if diff1/diff2 is for x or y here !)
    27. int diff1 = QABS( dl - dr );
    28. int avg1 = ( dl + dr ) / 2;
    29. int diff2 = QABS( dt - db );
    30. int avg2 = ( dt + db ) / 2;
    31.  
    32. // Calculate leeway for "real" vector length against "manhattan" vector length
    33. // This is a check, if the rect is rotated (other then 0/90/180/270)
    34. // It needs to be performed only for the triange (bl, tl, tr)
    35. int diff3 = QABS(( dlx + dly + dtx + dty ) - ( dl + dt ));
    36. int avg3 = (( dlx + dly + dtx + dty ) + ( dl + dt )) / 2;
    37.  
    38. if (( diff1 > ( avg1 / 20 )) || // 5% leeway
    39. ( diff2 > ( avg2 / 20 )) ||
    40. ( diff3 > ( avg3 / 20 )))
    41. return false;
    42. else
    43. return true;
    44. #else
    45. return true;
    46. #endif
    47. }
    To copy to clipboard, switch view to plain text mode 

    Values of diff1, avg1, diff2, avg2, diff3, avg3:
    diff1 = 5
    avg1 = 591 -->> diff1 > avg1/20 -- 5 > 29

    diff2 = 11
    avg2 = 386 -->> diff2 > avg2/20 -- 11 > 19

    diff3 = 364
    avg3 = 1168 -->> diff3 > avg3/20 -- 364 > 58
    Then, my problem is diff3 and avg3.

    Any advice??
    Best regards.
    Last edited by jpn; 5th July 2008 at 19:38. Reason: changed [quote] to [code] tags

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.