Dedicated License Plate Cam project

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
its not supposed to filter IR, it filters everything BUT IR.. so it lets all the visible red thru.. can hardly tell its there.

going to rewire it again this weekend with a 12v relay on the alarm output, so I can turn the IR on/off and not overheat the box in the day.. also going to drill some more vent holes, it was pretty hot tonight when I opened it back up for adjustments..
 

pozzello

Known around here
Joined
Oct 7, 2015
Messages
2,270
Reaction score
1,117
its not supposed to filter IR, it filters everything BUT IR.. so it lets all the visible red thru.
i thought the point was to filter out the visible red and let the IR thru,
so that the visible red is not visible and people won't detect it...

if it doesn't do that, then why bother?
maybe the camera you took the picture with isn't representing what the human eye see there...
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
Guess what the R is in IR? RED!

that is IR you see, the filter was so I didn't have a giant white 3 bulb IR spotlight visible from a 2nd, larger hole durring the day.. merely aesthetics, it filters out visible light so its BLACK.. but still lets the IR spotlight shine through.. with the front of the birdhouse also black, from any appreciable distance neither the camera or IR can be seen in the day.

camera shows exactly what my eyes see when looking at it... but with a 5 degree focus on it, you have to be in the FOV to see red, so its a tiny lil window.. the IR light is on in both images above, but once you move a few degrees off center its no longer visible.

I was going to originally do 940nm light so it'd be entirely invisible, but that'd of not given me enough IR for this distance.. not at this power level.. 850 is visible at the emitter as the red glow.
 
Last edited by a moderator:

SyconsciousAu

Getting comfortable
Joined
Sep 13, 2015
Messages
872
Reaction score
825
going to rewire it again this weekend with a 12v relay on the alarm output, so I can turn the IR on/off and not overheat the box in the day.. also going to drill some more vent holes, it was pretty hot tonight when I opened it back up for adjustments..
Does that one not have a photocell, or does the filter cause the photocell to think it is dark constantly? Does your camera have an output for camera led IR switching, so the illuminator comes on when the camera shifts to night mode? I only have older Dahua box cams. I would have to use something like a photocell on the alarm in to activate the alarm out and switch the relay. I can't see any other way of doing it in the firmware based on camera day night mode.

camera shows exactly what my eyes see when looking at it... but with a 5 degree focus on it, you have to be in the FOV to see red, so its a tiny lil window.. the IR light is on in both images above, but once you move a few degrees off center its no longer visible.
I'd also suspect that to someone who wasnt looking for it, it would be a discreet red glow that appeared for less than a second as they were driving past. The field of view at 5 degrees is only 5.25m (About 18ft) at 60m (200ft).
 
Last edited by a moderator:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
it does have a photocell, its on the body and not the front.. so it thinks its always dark inside the birdhouse.. if it was on the front I suspect the filter would totally mess it up too.

I use dahua api w/my home automation system to switch my cameras from day/night at sunset, I'll just have it trigger the alarm output the same time it goes to switch it to night.. piece o cake, for me at least.. I read the alarm inputs into my automation system already.

but yeah if you were replicating this to a Tee, you'd need to either be fine with IR always being on and visible.. or come up with another solution.

Ive considered getting a acrylic rod, drilling a skylite for it and creating a 'optic' bridge to the photocell.. might work.
 
Last edited by a moderator:

SyconsciousAu

Getting comfortable
Joined
Sep 13, 2015
Messages
872
Reaction score
825
I use dahua api w/my home automation system to switch my cameras from day/night at sunset, I'll just have it trigger the alarm output the same time it goes to switch it to night.. piece o cake, for me at least.. I read the alarm inputs into my automation system already.
That makes more sense. I was reading that as you were using the camera's alarm output to do the switching. Does your home automation use a photocell or is it time based? If the latter I can see that causing you some issues with your plate cam. Running at 1/500 you need a lot more light to get a good image, as opposed to your other cams running auto exposure, and you may not have that level of light well before sunset. I can see the potential that the camera may not produce useful images for a short period in the afternoon just before sunset. You might get the same issue during periods of heavy overcast too. Might be worth considering letting that camera select day night mode itself.

or come up with another solution.
The photocell to the alarm input triggering the relay on the alarm output seems like the simplest method to achieve that. The Dahua firmware provides a capability for day/night to be switched from an external source as well. It doesnt seem like a difficult task to set up an adjustable photocell that switches the camera to night, and turns on your IR below about 10 lux.


Ive considered getting a acrylic rod, drilling a skylite for it and creating a 'optic' bridge to the photocell.. might work.
That seems like an excellent idea, especially if the camera was switching on auto. It would be off for most of the day but turn on relatively early in the evening still.
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
automation system calculates sunset, I can fudge that either direction.. so have it switch say 30mins before sunset or whatever.. its nice because I can have entirely separate profiles for day/night.. figure out the average time before/after sunset/sunrise and just rock it, even if it went auto I could time the IR pretty well.. works alot better than I thought it would, and its nice having all your cams switch consistently.. i could hook a light sensor up to automation system if i need

it would be really cool if I could have motion detection turn on the IR in time, then it could be off mostly and just come on when a car comes through at night.. it'd have to be very sensitive tho :D

wired the IR light up to the alarm output, works perfectly.. alarm on = IR on, alarm off = ir off :)

I have 1 12v barrel plug unused right now, for a future outdoor pir motion sensor.. the wiring harness is just a PoE 12v splitter with a 4 way splitter, and powered mic, modified slightly.. everything is cleanly soldered or tinned

and now that I have an IR light and a mic, I can confirm this camera does have an IR cut filter.. im experimenting in HDR mode instead of BLC, seems to work better and ive lowered 3d noise down to 20.. optically image is alot cleaner.

drilled 3 half inch holes onto the far side bottom panel in a triangle pattern (2 at lower corners and one in middle), then cut the triangle top of the front panel off about an inch so it has air vents in the bottom and top for natural circulation.. need to pickup some screen mesh and form them into the air vents, dont want this turning into a wasp nest.
 

Attachments

Last edited by a moderator:

pozzello

Known around here
Joined
Oct 7, 2015
Messages
2,270
Reaction score
1,117
Guess what the R is in IR? RED!
of course i know that. the limit of human vision is around 750nm. the IR light supposedly operates around 850nm.
of course, that may well be the center of it's bell curve of power distribution, and it's clearly emitting enough light
at 750nm or below to be visible to the naked eye, like most other IR lights...

If one had a filter with sharp enough drop off around 800nm, one could block the visible portion entirely while
still letting the beyond-visible IR through for night operation of the sensor.

I guess that filter just doesn't have a sharp enough cut off for that, despite the specs that seem to show otherwise.
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
the spec I read said it basically let everything higher than 750nm through, was not a choice for any specific wavelength.. you want something like what they use in thermal cameras, blocks out everything but very specific IR signatures.. expensive stuff I suspect.

i just wanted an opaque cover to fill the 2" dia hole that didnt hurt the IR output.. the spotlight was not discrete sticking through a hole in the front, but now it completely hidden when its off in the day, thats all I had hope'd and expected out of it.

the dahua black face bird-house alpr :p
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
@SyconsciousAu, you nailed it earlier asking me about ABF.. at night to re-focus plates; I have to bring the focus way in, the drift is too high.

soo, when my automation system goes to switch it to night mode, and turns the IR on its also going to have to change focus.. I cant use auto focus at night without a test plate out there, so this is what i found:

http://192.168.42.26/cgi-bin/devVideoInput.cgi?action=getFocusStatus
Code:
status.Focus=0.475207
status.FocusMotorSteps=968
status.Status=Normal
status.Zoom=0.000000 
status.ZoomMotorSteps=0
and http://192.168.42.26/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.75&zoom=0

moved it way out of focus, so I sent:

http://192.168.42.26/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.475207&zoom=0

and it came right back to where it was!!!

here is how I do my switching:
Code:
-- ALPR Day/Night Video Profile Switching
if (mins == timeofday['SunsetInMinutes'] + 60) then
        print("Switching ALPR Camera to Night Profile.")
        commandArray[1]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=2' }
        commandArray[2]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.495868&zoom=0' }
        commandArray[3]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInExposure[0][0].Backlight=1' }
        commandArray[4]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[0].Mode=1' }
elseif (mins == timeofday['SunriseInMinutes'] - 60) then
        print("Switching ALPR Camera to Day Profile.")
        commandArray[1]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1' }
        commandArray[2]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.475207&zoom=0' }
        commandArray[3]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInExposure[0][0].Backlight=0' }
        commandArray[4]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[0].Mode=0' }
end
here is where you'll find the latest version of my profile switching script: https://github.com/nayrnet/domoticz-scripts/blob/master/lua/script_time_ipc.lua
 
Last edited by a moderator:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
This is how I calculate my needed FPS, first I setup a mask that will catch my plates.. then I take an image with no plates and run it through alpr and see how long it takes to see there is no plate:

Code:
alpr --clock galileo-cam1-1461522229042.jpg
Total Time to process image: 79.6974ms.
No license plates found.
This tells me that I can scan ~12.65fps without plates, and then once a plate appears I use my plate benchmark to test


Code:
# alpr --clock galileo-cam1-1461522361417.jpg 
Total Time to process image: 139.38ms.
so Ive found there is a hidden sweet spot, where you can make a small enough capture slice to get passing plates.. and its very fast looking through that tiny slice.. but you need higher FPS to pull this off.

the smaller your capture zone the more likely all your vehicles will be captured in the exact same position, this mask below is what I used for the above numbers and its still wide enough its getting me 2 shots on average of every passing car.
 

Attachments

Last edited by a moderator:

SyconsciousAu

Getting comfortable
Joined
Sep 13, 2015
Messages
872
Reaction score
825
@SyconsciousAu, you nailed it earlier asking me about ABF.. at night to re-focus plates; I have to bring the focus way in, the drift is too high.
I have to leave my old Dahua in Black and White 24/7 to get over that focus shift issue. It is good to hear that the auto back focus will reliably and repeatably return to a focus position.

here is how I do my switching:
Code:
-- ALPR Day/Night Video Profile Switching
if (mins == timeofday['SunsetInMinutes'] + 60) then
        print("Switching ALPR Camera to Night Profile.")
        commandArray[1]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=2' }
        commandArray[2]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.495868&zoom=0' }
        commandArray[3]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInExposure[0][0].Backlight=1' }
        commandArray[4]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[0].Mode=1' }
elseif (mins == timeofday['SunriseInMinutes'] - 60) then
        print("Switching ALPR Camera to Day Profile.")
        commandArray[1]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInMode[0].Config[0]=1' }
        commandArray[2]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/devVideoInput.cgi?action=adjustFocus&focus=0.475207&zoom=0' }
        commandArray[3]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&VideoInExposure[0][0].Backlight=0' }
        commandArray[4]={ ['OpenURL'] = uservariables['camLogin'] .. '@alpr/cgi-bin/configManager.cgi?action=setConfig&AlarmOut[0].Mode=0' }
end
Im not a coder so am probably reading that wrong but it reads like you shift to your day profile 60mins before sunrise (elseif (mins == timeofday['SunriseInMinutes'] - 60) then) and your night profile 60 minutes after sunset (if (mins == timeofday['SunsetInMinutes'] + 60) then)

here is where you'll find the latest version of my profile switching script: https://github.com/nayrnet/domoticz-scripts/blob/master/lua/script_time_ipc.lua
Cheers:applouse:
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
good catch, realized that this morning when it didn't fire off as expected lol.. just copied and pasted code from the other cameras and didn't spend too much thought on making sure logic was right.. and of course it was not. its Lua so its very easy to read, even for non coders.. I just run these through Domoticz, it calculates sunrise/sunset and fires off the scripts every min.. as you can see it also updates my temp OSD's, manages my PTZ Idle Presets externally with additional logic, and switches all my outdoor cams from day/night all at the same time.

switched over to evening mode today all on its own, worked well..

not much traffic at night this time of year, sunsets so late most people are home.. but im getting pretty decent results at night, some plates from front are less likely to be read correctly at night.. mostly because of dirt/age/damage. but I can still manually read them if needed.. all rear plate reads are great.. it seems my focal point shifts and the area of focus becomes smaller.

I'll work on a time lapse video of 24h of plate captures here in a few days when I have everything as dialed in as I can get it.
 

Attachments

Last edited by a moderator:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
bumped the resolution up past 1080p, now I am sending it 2304 × 1296 video and night time read accuracy went up dramatically.. now the smallest plates are ~90px high and the big ones are 180px or so, oncoming plates are in the high 80% accuracy at night, away plates are in the 90's and in the day both ways its now basically 95% or better, if it dont nail it on the first guess in the day its more likely than not due to some external factor I cant do anything about.

this camera has a bug, wont send rtsp >1080p.. the video plays in VLC, at wrong resolution and looks all corrupted.. alprd wont even connect... Luckily the http axis cgi URL does work >1080p, and since it dont use UDP it actually seems to be working better.

I am glad I went with a 4MP camera instead of a 2MP camera, I was not too thrilled with the accuracy of reading oncoming plates at night.. but now thats changed and I am getting the results I had wanted.
 
Last edited by a moderator:

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
I think these shots illustrate the power of that IR spotlight, thanks @pozzello for finding this for me.. at full focus its a bright fucker thats painful to look into for more than a few moments.

the target is approx 60ft away from the light source, this thing is a jewl for LPR use.. your not going to find anything with a tighter beam and more power for $60/shipped
 

Attachments

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
another bit of information concerning anyone wanting to do LPR over distance, with high shutter speeds weather is more of a problem than you may expect..

today is a very very light snow, not even registering on any of my other cameras as visible.. yet the LPR camera is struggling, not much I can do about it due to the distances I am covering.. with rain/snow more distance is going to equal more 'noise' on your plate readability, its seems obvious but if your in a situation that requires extremely high accuracy in a place with frequent precipitation, this would be an Achilles heel in any long distance deployments.

luckily, durring poor weather events the likely hood of criminal activity goes down dramatically..
 

Attachments

Last edited by a moderator:

smoothie

Pulling my weight
Joined
Dec 19, 2015
Messages
223
Reaction score
178
This thread has been very informative. Eventually I would like to setup 2 dedicated LPR cameras but I am still a ways off from that stage. I will have to burn some calories to figure out where to place the cams and indeed which cams to choose for this task.
 

nayr

IPCT Contributor
Joined
Jul 16, 2014
Messages
9,326
Reaction score
5,325
Location
Denver, CO
considering what ive seen avilable commercially, you can get better performance for less money if you do the work your self, I mean hell a trail cam designed for LPR costs more than twice what this cost me and I dont think it'd last very long strapped to the light pole out front before someone with a mask cut it off.

thats what this thread is here for, to combine experience and knowledge so people can farm for info.. I been thinking of asking for an LPR subforum so we could concentrate all the discussions in one place and also break out big threads like this.. those commercial entities have an invested interest in keeping the details and nessicary experience to them selves.. and that sucks for us DIY types.
 
Top