BOOL
ErrorAnalysis(
INT32 cCalibrationPoints, //@PARM The number of calibration points
INT32 *pScreenXBuffer, //@PARM List of screen X coords displayed
INT32 *pScreenYBuffer, //@PARM List of screen Y coords displayed
INT32 *pUncalXBuffer, //@PARM List of X coords collected
INT32 *pUncalYBuffer //@PARM List of Y coords collected
)
{
int i;
UINT32 maxErr, err;
INT32 x,y;
INT32 dx,dy;
UINT32 errThreshold = MAX_POINT_ERROR; // Can be overridden by registry entry
UINT32 status, ValType, ValLen;
HKEY regKey;
// See if there is a Maximum Calibration Error specified in the registry
status = RegOpenKeyEx(
HKEY_LOCAL_MACHINE,
__TEXT("HARDWARE\\DEVICEMAP\\TOUCH"),
0,
0,
®Key);
if ( status == ERROR_SUCCESS )
{
ValLen = sizeof(errThreshold);
status = RegQueryValueEx(
regKey,
__TEXT("MaxCalError"),
NULL,
&ValType,
(PUCHAR)&errThreshold,
&ValLen);
// We don't care what happened. Either we have a new value or we have the default value.
RegCloseKey(regKey);
}
RETAILMSG(1,(__TEXT("Maximum Allowed Error %d:\r\n"), //2010--3--6 XQH 读取注册表里面的"MaxCalError"=dword:7项
errThreshold));
DEBUGMSG(1,(__TEXT("Calibration Results:\r\n")));
maxErr = 0;
DEBUGMSG(1,(__TEXT(" Screen => Mapped\r\n")));
//==============================================================================================================
for(i=0; i maxErr)
{
maxErr = err;
}
}
//==============================================================================================================
DEBUGMSG(1,(__TEXT("Maximum error (square of Euclidean distance in screen units) = %u\r\n"),
maxErr
));
if( maxErr < (errThreshold * errThreshold) )
{
return TRUE;
}
else
{
RETAILMSG(1,(__TEXT("Maximum error %u exceeds calibration threshold %u\r\n"),
maxErr, errThreshold
));
return FALSE;
}
}
复制代码
看这段代码的意思应该是把修正后的坐标简单地除于4就是LCD的像素坐标值了.
详情回复
发表于 2010-3-8 10:32