1 | initial version |
There are two possible general approaches to this. The normal OpenCV adaptive background subtraction methods are effective for still frames. You could try blurring algorithms or combinations of erode-dilate if you have problems with the grid lines, but that could also be solved with judicious thresholding settings.
The other approach is to search for background subtraction for video. Many texts cover this. It's normal to track moving objects, so you should be able to find algorithms that deal with position shifts.
If you are always using grid lines in the background, you could conceivably detect vertical and horizontal lines (via Hough or whatever), and try to use the locations for alignment. I'd expect that approach to be more pain than it's worth though.