1 | initial version |
There are two problems. One is the background IR that isn't from your signal. The second is the reflections of your signal that are false positives.
If your environment doesn't change very fast you can use a simple background subtraction algorithm to remove that. MOG2 or one of the other subtraction algorithms in opencv should handle that.
For false positives you can be more proactive. You know that your stick doesn't jump from one place to another instantly or move too far between frames. Use a Kalman filter to track its motion and exclude any measurements beyond a certain distance from where it is. This should be independent of size, so you don't have to worry about that.