There were some issues with some of the classification tests I ran on the chessboard pictures from last week (you can find pictures here). The ones that were taken from a distance of a couple of meters or less, classified into the correct directories. But the ones that were taken from far away had this strange error that stopped the analysis and left the pictures were they were (in an un-detected state).
On further study I found out that the reason for the error was that the chessboard points were being inexplicably scattered all over the chessboard. That is, even though the algorithm had found the chessboard it placed the corners in strange places. It even calculated a chessboard that did not comply with the initial size given.
I followed the error until the cornerSubPix function call. The initial findChessboardCorners call was doing its job; but when I tried to further increase accuracy with cornerSubPix, the calculation went wrong for chessboards that were “small”. After some reading to the opencv documentation and a little experimentation, I found out that the culprit was the winSize argument cornerSubPix. I don’t know exactly what this argument defines; but if it’s too big, it will damage the calculations made by findChessboardCorners. To solve the problem I decreased the argument from 11 to 5.
I believe that this argument defines some sort of window size. If two points manage to fit in one window -because the window is too big, or because the squares are too small (far away)-, then the calculations in cornerSubPix damage what findChessboardCorners calculated. I’m also guessing that decreasing this argument will make the algorithm more complex. But all this is just a hunch.
In any case; after making the change to the ilac source I re-ran the test on the images that were left undetected in the previous experiment. All but three of the remaining pictures went into their respective class directory. There were two images where the chessboard could not be found. This is because the picture is taken from very far away (5 meters or more). I was expecting the algorithm to fail at these distances and was not surprised. Moreover, we are worried about the accuracy at around 2 meters.
There was one case that misclassified the image. Though the chessboard was found, the id was miscalculated. I think this was due to the distance of the picture. Since the chessboard was so far away from the camera image plane, the number of pixels that made up a square were too small to serve as an accurate calculator. I’m assuming that this happens only with pictures taken from afar and will ignore this for now.