Ask Your Question

Object Tracking At Night

asked 2017-11-26 21:28:28 -0500

Haselmaier gravatar image

Has anyone ever done any object tracking at night when the object to be tracked is just a light?

I'm building an application that looks for trains traveling down a railroad track. The track is on an angle relative to the camera. When trains are coming toward the camera, with the bright light of the lead locomotive, contour detection and subsequent tracking works really well.

However when the train is going in the other direction (quartering away from the camera) the lead locomotive's light is not as bright....and the tracker loses the object after just a few frames.....which is an insufficient amount of data for me to confirm there is a train there.

I've played with increasing the contrast, as well as different Background Subtraction algorithms, but none of those experiments resulted in better results.

Does this type of issue ring true with anyone here?



edit retag flag offensive close merge delete


Can you show an example image of a train coming towards and one going away from the camera?

Tetragramm gravatar imageTetragramm ( 2017-11-26 21:54:21 -0500 )edit

(I'm new to this forum platform. It's not obvious how (or if) images can be placed in a comment.

I put a couple of images on a page on my website:



Haselmaier gravatar imageHaselmaier ( 2017-11-26 22:46:37 -0500 )edit

did you try other trackers, like the MEDIANFLOW one ? (kcf is somewhat infamous for losing targets)

berak gravatar imageberak ( 2017-11-27 03:56:26 -0500 )edit

Unfortunately, yes, I've already tried other tracking methods. (I'll re-try MEDIANFLOW, though, based on your comment.)

I have an opportunity to reposition the camera such that I can reduce the "quartering away" angle for trains going right-to-left. I think there is a place where I could move the camera to the left, along with angling it more toward the track. Maybe if I can get the light a bit brighter it will help with the tracking.

Haselmaier gravatar imageHaselmaier ( 2017-11-27 08:14:43 -0500 )edit

do you have a short video sample?

sturkmen gravatar imagesturkmen ( 2017-11-27 08:55:33 -0500 )edit

I will have some video samples in the next day or two. I've moved the camera to get a more direct (less obtuse) angle of view on the tracks. I'll see if that changes things.

Haselmaier gravatar imageHaselmaier ( 2017-11-27 22:14:43 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-11-29 23:02:28 -0500

Haselmaier gravatar image

I'm going to add an update as an "Answer" - as I think I may have gotten this resolved.

I moved my camera so that it got a more direct view of the railroad tracks. Prior to moving the camera the view was more "obtuse" or "glancing". This obtuse angle cause a night image that was hard for the tracker to track.

On this page on my website I've placed a video that was recorded with this new camera placement. As you can see I have a better light signature for OpenCV to track.



edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-26 21:27:39 -0500

Seen: 522 times

Last updated: Nov 29 '17