seeing-things / track

Automates tracking of targets with a telescope using ephemeris (TLE files) and/or optical tracking.
MIT License
8 stars 0 forks source link

Improve computer vision detection of dim targets #56

Closed bgottula closed 6 years ago

bgottula commented 7 years ago

The current feature detection algorithms struggle with very dim targets. Improve detection of dim targets.

Also look into whether it is really necessary to apply an adaptive threshold to a greyscale image prior to using the SimpleBlobDetector. I don't know that either of those steps are actually necessary. Thresholding the input to the blob detector may actually be interfering with how it is intended to work.

bgottula commented 7 years ago

Confirmed that the conversion to greyscale and the adaptive threshold were unnecessary and removed them. Added trackbars for most of the blob detector parameters so that they can be adjusted in real time. I tried to choose defaults that seem reasonable but these need to be confirmed using actual targets.

bgottula commented 7 years ago

The new arrangement did not work well at all. I didn't have time to play with it much, but I could not get even brighter targets like Polaris to detect correctly even when fiddling with all of the trackbars. Had to revert to the old ways to do anything useful.

bgottula commented 6 years ago

Some videos of a few stars taken using the Logitech webcam through the guide scope to use as input material for testing the algorithm: stars.zip

bgottula commented 6 years ago

Significant improvements to dim target detection were made. The most important change was replacing the adaptiveThreshold function with the regular threshold function where the threshold is set to be just higher than the background noise level of the grayscale image. This new approach was tested with the stars.zip videos captured earlier and with some other video files of satellites tracked on 6 Mar 2018. Results were very good. The only case I observed that consistently produced a missed detection was when the number of pixels above the threshold is very small (3 and below). When this occurred the SimpleBlobDetector did not recognize them as a blob for any set of parameters I tried, including setting the minimum area to 0 and disabling the area filter. This may be a limitation of the algorithm applied in the blob detector. In any case the situation is much improved from before and should be good enough in most cases.

I also took the opportunity to improve target selection when multiple targets are identified. Rather than picking the first keypoint from the list, the OpticalErrorSource now uses the keypoint that is nearest to the center of the frame. The thought is that when optical tracking is converged the desired target will be near the center of the frame already, so it seems reasonable to assume that any passing stars or other bright objects are more likely to be further from frame center than the desired target.