Scene Analysis - Discerning Train Detection

Discussion in 'Home Automation' started by Haselsmasher, Jul 23, 2016.

Share This Page

  1. Haselsmasher

    Haselsmasher n3wb

    Jul 7, 2016
    Likes Received:
    I'm not sure where to post this question - so I'll try here.

    I have line of sight to a railroad track that runs somewhat close to my house.

    I'm trying to capture the event when a train goes by. But the critical thing is the meaning of a train going one way vs the other is required for what I'm trying to do. (Basically I live outside of my town. And when a train is headed toward town I want to send alerts to subscribers of the fact a train is coming. The train's tracks, literally, go right through the middle of town. So a train coming through is very disruptive.)

    So it's important to know not only that a train is going through the camera's field of view, but I have to know which direction it is traveling. Trains heading out of town will be ignored.

    I'm using iSpy and with it's motion detection targeting and settings I've been able to get a pretty good setting that will capture a train going by. But any ideas how I could figure out which direction?


  2. tangent

    tangent Known around here

    May 12, 2016
    Likes Received:
    Line crossing would be the most obvious solution, in some cases you can specify the direction. Some cameras have that function built in. I'm not sure which software packages have line crossing but you could always upgrade your cam if needed.

    A pair of Photo Electric sensors outside the railroad easement / property would work two. The order the sensors trip would tell you the direction. But you'd want to be careful you don't get in trouble if you attempt this sort of thing.

    In a perfect world, it might be possible to get the railway to implement some smart signage that makes some noise and says something like train arriving in 19 minutes after if goes by some sensor. We don't live in a perfect world :(
    Last edited by a moderator: Jul 24, 2016
  3. IpCamUser

    IpCamUser n3wb

    Nov 23, 2015
    Likes Received:
    Blue Iris allows you to define zones and trigger alerts by the direction of movement from one zone to another.

    here is the section from the online help that describes this:

    ]Use the Object crosses zones rule to require that an object move between zones before triggering. The simplest requirement is A>B which means the object must move from zone A to B. You may also use the syntax A-B as shorthand for A>B, B>A, meaning the object must move between these zones, but the order is not important. You can also specify a more complicated movement, such as AB>C, meaning the object must have been in both A and B before moving to C.
  4. nayr

    nayr Known around here

    Jul 16, 2014
    Likes Received:
    Denver, CO
    I agree with Tanget, line cross is what you want..

    Here is a sample, this one is detecting crossing in both directions but you remove one of those arrows and then its only triggering for one direction.

    the key to line-cross is to have enough image before the line that it can correctly detect the moving object before it crosses the line.. so for example if your train is traveling from left to right and you put the line on the left side of the image it probably wont detect the train until its already crossed the line, but if you put it on the right side of the image it will detect the train crossing the image, then the line.. if you want it to work in both directions it almost always has to be in the middle of the image... especially with fast moving objects like cars and trains.
    Last edited by a moderator: Jul 31, 2016