OpenCV 4.53, C++, VS 2017, Win10
I have a findHomography situation that I cannot explain. The findHomography is becoming increasingly inaccurate as the points move to the left of the camera view of the screen.
Previously I had a chessboard of 8, 4 internal corners and used findChessboardCorners. I am now using a chessboard of 13, 6 and using findChessboardCornersSB and yet I am still seeing the same anomaly.
I am projecting the chessboard on to a 2nd monitor and the camera is facing that 2nd monitor. In this case the 2nd monitor is 1280 X 720, the chessboard jpg is resized to 1280 X 720 from it’s original 1920 X 1080. A namedWindow is created and properties set with code below
cv::namedWindow("GameBoard", CV_WINDOW_NORMAL | CV_WINDOW_KEEPRATIO); cv::setWindowProperty("GameBoard", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN); resizeWindow("GameBoard", rSecondary.Width(), rSecondary.Height()); moveWindow("GameBoard", rSecondary.left, rSecondary.top);
To find the chessboard corners in the camera view and then the Mat of the chessboard jpg I have:
bool patternfound = findChessboardCornersSB(mCameraImage, boardSize, vImage, CALIB_CB_EXHAUSTIVE | CALIB_CB_ACCURACY); patternfound = findChessboardCornersSB(mToScreenChessBoard, boardSize, vObject, CALIB_CB_EXHAUSTIVE | CALIB_CB_ACCURACY);
I then create the Homograph with:
mHomoToScreen = findHomography(vImage, vObject, CV_RANSAC);
A point in the camera view is then translated with:
newImage_point.push_back(Point2f(cvpKeypoint.x, cvpKeypoint.y)); // keypoint seen by camera and discovered in ShowBlob perspectiveTransform(newImage_point, newObject_point, mHomoToScreen); cvpHomoKeypoint = cvPoint(newObject_point.x, newObject_point.y);
What I am seeing is that the points in the camera view from the right 2/3rds of the camera view translate to points on the 2nd screen very accurately. However, as the points move to the left of the camera view, the more they move into the 1st third of the frame the more inaccurate they become. The inaccuracy is that the actual point in the camera view will progressively translate to something more and more to the right of where it should be on the 2nd screen as the point in the camera view moves to the left edge. My guess is that the worst translated point is about 20 pixels to the right of where the point should be out of a total of 1280 pixels of screen width.
Does anyone have an opinion of what would cause an inaccuracy but only to the left of the screen?