What is the cheapest way to detect and identify vehicles entering a gate in real time?

I want to detect and identify each of the vehicles passing through a gate.

I have the live video feed of the gate which I initially thought to process and detect the number plates with the help of OpenCV or any other graphics library freely available. The problem is, the size of number plates may vary very widely, and the language the number plates are written with(Bengali) does not have a good OCR performance at all.

The next idea was to put a QR code in the windshield of the vehicles. (Yes the vehicles supposed to enter the area are private and enlisted vehicles). But I am not confident that I will be able to detect and identify all the QR codes in real time with 100% accuracy, as the QR codes might get pixelated due to low resolution of video.

So can anyone suggest any other cheap way we can adopt to detect and identify the vehicles? Can NFC or any other cheap sensors be used for this purpose?

I am assuming that it is a narrow gate so all the vehicles come through at around the same point, you could reposition the camera so that it is focused on where the license plate is normally when they come in, but having only done ocr on english I do not know if this will improve detection much, qr codes are much easier to detect, but I would suggest somthing simpler like a 1D qr code (depending on the amount of information to encode) just add some alignment bits to the front and back with data in the middle, you could detect that from further away more easily.

Edit: As you stated you wanted a more robust sensor based approach, I did some digging and This site claims wih passive tags you can read out to aroud 40 feet with directional antennas, allowing you to simply put tags on the inside of the windsheild and read them with a directional antenna from above pherphas giving you around 10ft between the antenna and the trucks.

• Thanks for the suggestion. That's an improved idea than what I was trying. I still want to know what cheap sensor based options I might have... – Thunderstruck Jun 3 '15 at 15:50

If you're looking for sensor-based, you can do pretty much anything. Passive sensors (RFID tags) are, in my experience, only reliable over very short distances; 1 meter or less. Additionally, RFID tags work best when the reader is located normal to the face of the tag. That is, if you glued the tag to a windshield, a reader on the side of the car is the worst place you could put it. You want the tag "broadside" to the reader to get the best signal strength (again, range is a big issue), which would mean either put the reader 1m in front of the windshield or put the tag on the driver/passenger window.

You could do RF, over something like XBEE, or you could do infrared like a TV remote. Anything that's not passive, which again is essentially only RFID, requires power. This means batteries, which could (would) be drained quickly if they are constantly transmitting, or splicing into the vehicle power wiring, which could (would) be costly and time consuming.

What are your requirements? What's your intended range? How many vehicles are you servicing? Do you have a budget? Can you splice in to vehicle wiring? Do you need automation, and if so, what degree of automation?

For a sensor-based system, the easiest solution would be a garage door opener or similar. This would require a small transmitter in every vehicle, where the driver pushes a button to send a signal to open the gate. You could also just put a keypad at the gate, where the driver has to enter a passcode.

Basically, any transmitter that could run on batteries should only run intermittently, requiring interaction from the driver. Any transmitter that emits constantly will need vehicle power. I believe that you will find that any passive transmitter is simply not feasible due to the range requirement. Also, RFID readers are expensive, much more so than the garage door openers, but probably less than interfacing with vehicle wiring.

If you're insistent on a totally passive system, I would look at simply upgrading the security camera. This would provide you the higher resolution you need to do OCR. At that point, see my solution above of bumper stickers if license plate reading is not feasible.

Know that, whatever the system, there will be failures, and you will always need a gate operator on standby to handle the failures (guests, bad transmitter, battery died, dirty sticker, OCR didn't register, etc. etc.)

• Intended range- ~2 Meter; Number of vehicles- ~500; Budget- <$4 per vehicle; Number of Receivers- 2; Can I splice in to vehicle wiring : No; Automation needed: Yes; Summary of Requirement: Identify and log the entry time of all the vehicles entering the warehouse, Identify the vehicle loaded on the Weigh Pad/Scale, Identify and log the exit time of the vehicle. -- Currently I am focusing on RFID based solution since it's cheap, and more reliable than Video. Garage door opener idea is good, but I need to detect the vehicle on Scaling pad too, I'm not sure I'd be allowed to install one there. – Thunderstruck Jun 4 '15 at 15:49 • If you could get the driver to do work, are keypads not acceptable? Everyone could enter a passcode to "unlock" the system, then a truck-specific ID to register. One keypad at the gate, one at the scales. RFID readers are about 500 dollars each, and you need two; this eats about 2 dollars per truck (assuming that ~4$/vehicle is total system cost). RFID tags run 2-3 dollars each, putting you either at or over budget. If you can get data from the scale, keypad entry logs start time, when the weight comes off logs the exit time. – Chuck Jun 4 '15 at 15:57
• Not to mention I think you may still have issues with range. 2 meters sounds trivial but is pushing it for passive RFID. I would suggest heavy testing before company-wide rollout, and again, readers are about 500 dollars, plus tags for testing. – Chuck Jun 4 '15 at 15:58
• @Thunderstruck, please edit the information from your comment into your question. – James Waldby - jwpat7 Jun 21 '15 at 6:53

If you can run OCR okay with your cameras (you cite resolution as problematic for QR code reading), then I would suggest you make bumper stickers. As they are installed on bumpers and not windshields, you can make them (essentially) as large as you need, in whatever character set you need, in whatever contrasting colors you need, and bumpers are all generally the same height and orientation, where windshields can vary a lot more.

• I am not sure putting something on Bumper is a good idea since they're prone to rain and dust etc and would get torn pretty soon I guess. The vehicles I'm talking about are mainly long range trucks traveling thousands of kilometers a month. I am looking for some sensor based solutions mainly, since the attempts to video processing is probably never going to be ~100% – Thunderstruck Jun 3 '15 at 15:49

How much work are you looking to put into this?

sparkfun offers these lovely transmitters for just \$4/ea and recievers for just \$5 each, paired with an ATTiny you can do just about anything :O

My suggested implementation would be the following:

Near the gate of your complex you would have a receiver paired with an ATTiny, this will be your detector, and you will be getting your data from this node.

In each vehicle, a voltage regulator will step the 12v of the vehicle down to a usable 3.3v, which will power the ATTiny. Once every second or so, power on the transmitter via a transistor, and broadcast a vehicle specific identification for a split second.

This circuit could run at all times (would draw verry little current relatie the the capacity of the vehicle battery), or could be triggered off of the ignition, and will only be broadcasting when the vehicle is running, or maybe even a switch in the cabin - up to you.