How to capture a still image of a stopped vehicle day & night with DS-2CD2T47G2-L

ciaran

n3wb
Sep 14, 2023
8
5
Ireland
DS-2CD2T47G2-L
Firmware version: V5.7.10 build 220830

I've been really struggling with this camera, with earlier ones line crossing detection seemed to work well for me but not with this one. I want to capture a still of a vehicle entering a driveway, the vehicles naturally pause in front of an electric gate. I want to capture a still image of the vehicle's licence plate, check it against a list of authorise licence plate numbers and if it's authorised trigger a relay that opens the gate. I've documented the technical configuration on GitHub here using an AWS cloud-hosted solution GitHub - ciaran-finnegan/License-Plate-Recognition-Notifier: "License Plate Recognition Notifier" AWS Lambda function for recognising plates, sending notifications, and making calls to GSM gate opening relays, this turned out to be slow and expensive so I've moved it to a Raspberry Pi running locally (happy to share code if anyone is interested).

I've tried many combinations of settings with Line Crossing Detection (vehicle) Motion Detection (vehicle) and Intrusion Detection (vehicle) but can't seem to reliably trigger an alert in different lighting conditions (day/night) without too many false positives (each licence plate lookup uses up some of my free quota of lookups).

I've attached a few sample photos of my setup and the sort of images I've been capturing, any advice on what configuration is likely to work most consistently would be greatly appreciated!
 

Attachments

  • _01_20230914200758687_MD_WITH_TARGET.jpg
    _01_20230914200758687_MD_WITH_TARGET.jpg
    344.7 KB · Views: 34
  • 192.168.0.29_01_20230913191047923_INTRUSION_DETECTION copy 8 (1).jpg
    192.168.0.29_01_20230913191047923_INTRUSION_DETECTION copy 8 (1).jpg
    162.9 KB · Views: 33
  • _01_20230914200815913_MD_WITH_TARGET.jpg
    _01_20230914200815913_MD_WITH_TARGET.jpg
    301.8 KB · Views: 33
  • Motion Detection.JPG
    Motion Detection.JPG
    313.3 KB · Views: 32
  • Like
Reactions: mat200
Thats why ANPR exists

Line crossing and intrussion detection algorithm dont work well with low installations, even with propper heights it will still have false positive alarms.

Ghosting can be avoided if you ramp up the shutter speed. But your image will become much darker.
 
Thank you, my other cameras were mounted higher, I wanted to mount the camera lower in this case to capture the licence plate better. Do you think I'll have better results with an Intrusion Detection configuration like the one below or will I have the same issues with the algorithm struggling to detect a vehicle because my camera is mounted too low? (which now I think of it makes sense because they probably trained it with imagery from cameras that are mounted higher)

1694764020142.png
 
Best case scenario would be for you to acquire ANPR camera something like DS-2CD7A26G0/P-IZHS 2.8-12mm. This camera detects Licence plates and gives you a representation in Image + xml data of plates.

Since you do not have ANPR camera and working with min/max values to calibrate Vehicle detection in order to snap photo. I would suggest making a MIN value a lot smaller and MAX value a bit bigger than what would have been the size of a car/truck within the area you want the picture taken from

What min and max values are is important as they take part in camera calibration and effectivness on detection.
Good thing with upper instalations you can even create a few areas of detection and each will have its own min/max values, meaning min value will be corresponding to its area.Lets take an example from your image, car at the entrance is alot smaller than at 2-3m from camera, therefor you can calibrate parameters to trigger better. Resulting in less false positive alarms.

Hopefully you understood what i tried to say, since english isnt my native language.

Cheers
 
Hi, I understand, thank you, and will try those suggestions!

(This is just a personal / hobby project and I'd like to release an open-source project that helps people cost-effectively implement a solution like this so a professional ANPR camera like DS-2CD7A26G0/P-IZHS is just outside my budget currently.)
 
If so, a different approuch would be to take SETUP rtsp stream PLAY rtsp stream fetch frames where your OCR can read, save that frame. It is approach that takes time to develop but if you have time, it is free :)
 
I spent a lot of money on this Hikvsion camera to take advantage of object recognition in hardware so I'd love to keep trying to work out a way to get it to work, there are so many people using these devices, I'm hoping it's possible to generate an alert when it detects a vehicle, it must be a very common requirement. But you are correct, if I can't my backup plan would be to use a cheaper camera and do the object recognition in software, though that's less efficient both in terms of network traffic and resource utilisation on the device that's doing the object recognition (I'm trying to use a Raspberry Pi to keep costs down).
 
Thank you, my other cameras were mounted higher, I wanted to mount the camera lower in this case to capture the licence plate better.

I think in your case, the lower camera angle is actually contributing to the problems. Not only does the intrusion detection not work as well, the height is making the car headlights glare on the camera lens. You should experiment with mounting it higher. It might help solve both problems you are experiencing. I'd try putting it at about 8' to see if that helps.
 
Just an update that raising the height of the camera seems to have helped, I need to test for a few more days to confirm it's working well in different light conditions. Thanks for the helpful suggestions.

I've created a GitHub repository for a Raspberry Pi variant of my original solution which ran on AWS and used a GSM Gate Controller and Twilio API. The Raspberry Pi variant with a Relay Hat is a lot faster and should be cheaper over time (AWS solution was probably going to cost around $5 per month to run).

 
Looks like you are getting a lot of glare from the headlights. See what your HLC setting is under Configuration/Image/Back Light Settings/ HLC. Turn it on and maybe set it to around 50 for openers. Adjust it from there as needed. That setting helps when I am looking right into the headlights with my LPR cameras.

Edit: Raising the camera most likely cut down on some of the glare.
 
Last edited:
Looks like you are getting a lot of glare from the headlights. See what your HLC setting is under Configuration/Image/Back Light Settings/ HLC. Turn it on and maybe set it to around 50 for openers. Adjust it from there as needed. That setting helps when I am looking right into the headlights with my LPR cameras.

Edit: Raising the camera most likely cut down on some of the glare.
Have tried that, I'll post an update when I've tested for a few nights, thanks.
 
  • Like
Reactions: Parley
Hi folks, just an update on this, raising the camera worked well, thanks for all the suggestions, I introduced some 'fuzzy matching' in the software to compensate for bad reads which tend to happen at night and when it's raining. The gate controller (AWS and Raspberry Pi versions) and a web application to manage it are all open source for anyone that wants to experiment with them.

Gate Controller (Raspberry Pi with Relay Device)

Web Application for Management and Access Logging

AWS version of the Gate Controller (requires a GSM Gate Opening Relay device)