我正在使用opencv构建一个眼动追踪系统,使用MAC内置摄像头可以在第一部分很好地工作:鼠标选择ROI。但是当我使用罗技相机时,鼠标选择不再准确。 这是鼠标调用:
static void onMouse( int event, int x, int y, int, void* )
{
if( selectObject )
{
selection.x = MIN(x, origin.x);
selection.y = MIN(y, origin.y);
selection.width = std::abs(x - origin.x);
selection.height = std::abs(y - origin.y);
selection &= Rect(0, 0, image.cols, image.rows);
}
switch( event )
{
case EVENT_LBUTTONDOWN:
origin = Point(x,y);
selection = Rect(x,y,0,0);
selectObject = true;
break;
case EVENT_LBUTTONUP:
selectObject = false;
if( selection.width > 0 && selection.height > 0 )
trackObject = -1; // Set up CAMShift properties in main() loop
break;
}
}
和回调:
setMouseCallback( "IMG", onMouse, 0 );
使用罗技相机,点程序集始终高于我的实际点击点。我可以知道原因吗?