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

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
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

trempa92

Getting comfortable
Joined
Mar 26, 2020
Messages
952
Reaction score
306
Location
Croatia,Zagreb
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.
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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
 

trempa92

Getting comfortable
Joined
Mar 26, 2020
Messages
952
Reaction score
306
Location
Croatia,Zagreb
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
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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.)
 

trempa92

Getting comfortable
Joined
Mar 26, 2020
Messages
952
Reaction score
306
Location
Croatia,Zagreb
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 :)
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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).
 

The Automation Guy

Known around here
Joined
Feb 7, 2019
Messages
1,457
Reaction score
2,902
Location
USA
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.
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
Thanks - I'm raising it tonight and will update the post to confirm it that helps.
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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).

 

Parley

Known around here
Joined
Dec 19, 2015
Messages
5,849
Reaction score
17,054
Location
Cypress, California
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:

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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.
 

ciaran

n3wb
Joined
Sep 14, 2023
Messages
8
Reaction score
5
Location
Ireland
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)
 
Top