I have a rail line right under my apartment, so I built a small computer vision app running on a Rasperry Pi which records each train passing, and tries to stitch an image of it.
Have you considered getting a line scan camera for sharper and higher resolution images? I took some train scans with one: https://daniel.lawrence.lu/photos/
Technically, the photo could be twice the resolution, since the length of the line scan sensor is 4096. It consists of two lines, RGRGRG and GBGBGB. By interpolating the red and blue channels, it would be possible to get images 4096 pixels tall. The challenge is that the two green channels apparently have quite different sensitivity and also each pixel has some variation in sensitivity, which also seems to drift with temperature and settings, so it's quite annoying to calibrate everything properly haha.
I'm a big fan of Wes Anderson's aesthetics and would love to shoot that funicular train from Grand Budapest Hotel (which actually exists --- the Buda Hill funicular) using my line scan camera.
Wow, the pictures look amazing!
Yes, the look of line scan images were an inspiration for this project. But of course, I also tried to keep BOM costs down and so ended up with a RP4 + RPi Camera.
The RPi HQ camera is a nice step up from the regular RPi camera while being not too expensive too. Incidentally, I also have a project using that [0] but unfortunately no trains where I live.
Have you tried the opposite direction? Sitting on the train with the line feed and taking a picture of outside? Like say, a panorama view of the entire run-length of the line, distorted in proportion to the trains turns and accelerations.
I love how the line scan camera’s horizontal background makes it look like the trains are moving impossibly fast. Not only are the images sharp & high res, it has a great aesthetic and implies you were tracking an action shot.
I remember seeing your photographs on Wikimedia Commons and wondering how you did them - now I know! I always assumed that you just used a very quick shutter with an f-stop of zero :)
When the train is moving at a constant speed, you can just scale the image manually to make it just right. If it's moving at a non-constant speed, you can apply a spline or similar to remove the distortion.
This is such a cool project! I live right next to a busy road and for a long time have wanted to do something like this that would count the vehicles passing. I've always been curious how many cars pass on a given day and I feel like the hardest part now adays would be getting the right camera angle so if cars are occupying all 3 lanes they aren't counted incorrectly. From there I just need to detect cars as they pass and count them.
It's really cool to see it used like this! The resulting images are really neat as well!
Given the type of trains that are passing (it seems no IC/IR), along with their precise timing and direction, I'm sure it is easy to figure out where exactly you are living.
Especially in Switzerland where the trains actually go on time :P But anyway does it really matter? It'll still be hard to identify the actual apartment.
I wonder if there's open data or an open API for the schedule or location information. That way, you could include information on which train is which.
This is close to what I've always wanted to build; a camera watching the road next to me that records the speed of the vehicle traveling by. I should have everything needed from a simple camera setup, but I've not bothered actually doing it.
Same here, I have a Pi 3 but I want to have this outside in the balcony, the question that always stops me is how to power it and what camera do I meed?
My plan was to stick the Pi inside, and power both it and the camera with Power over Ethernet (external-rated PoE cameras are a dime-a-dozen on Alibaba and friends).
I even got so far as to get it working with Zoneminder to dump out the clips that had motion, but didn't get further.
Could you show average speed vs car manufacturer? Or vs car type (compact, European luxury, minivan, truck). I've always wondered if this is correlated.
This is cool. How do you calculate the speed of the train?
I'm assuming you are measuring how far a certain feature of the train takes to get from one point of the frame to the other. Similar to how police catch people speeding by measuring how long road markings take to pass in a given frame.
Sounds interesting id love to know how you do it. Is the speed calculated based on the noise of the wheels going over a track join? Then you can work out the length/speed based on the time it takes etc. Are the train types/images random or calculated some how?
There is a parameter which tells the program how many pixels there are per meter. From this you can compute the length after stitching. Using framerate, you can compute the speed in the same way.
They're swiss trains, I guess we have enough wealth to make sure that our trains are clean. The interior is also almost always clean, except early morning on weekends (drunk people).
From time to time I see a train with graffiti on it, but usually they remove such things very fast.
When you say "right under my apartment", where exactly do you mean? Because I also have a train line going underground very near my apartment but it's not directly under. Could I capture such images? And I'm on the 4th floor.
I got confused at first too. What he means is "somewhere outside on the ground level while my apt is not on the ground level, there are trains passing by which I can see from my apt". You need line of sight.
This is not mysterious tech deriving images from sound traveling through the floor. You will be out of luck with your underground subway.
If you have the schedule and the sound I'm sure you could make a cam with translucent ground. You should be able to figure out where it is, which model and how long it is. Who knows, maybe the orchestra of break sounds (it has many) is unique enough to spot which it is exactly.
The camera is pointing at the car. The train is moving past the car. The images of the whole train are made by stitching together lots of photos, all containing the bit of the train in front of the car as it moves past it.
From what I can see, they're not actually duplicated, I would suggest taking a closer look at the windows. But I do agree that it's quite hard to see the difference.
The trains look very clean from the outside. I do wonder how loud is it, to live so near the tracks.
I also live right next to a train line in CH (that has exactly the same kind of rolling stock passing by as the ones captured by jo-m). These are modern commuter trains (no cargo and long distance trains), and are a lot less loud than you'd expect. A somewhat busy street nearby would be an order of magnitude more annoying.
It has a frontend at https://trains.jo-m.ch/.
Edit: it's currently raining and the rain drops are disturbing the images a bit.