OpenALPR Webhook Processor for IP Cameras

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
This is Text Over lay disabled.

{"method":"system.multicall","params":[{"method":"configManager.setConfig","params":{"name":"ChannelTitle","table":[{"Name":"LPR 1 (TE-121)"}],"options":[]},"id":382,"session":"416eaad9e266a4cea830c6ec143f7ab0"},{"method":"configManager.setConfig","params":{"name":"VideoWidget","table":[{"ChannelTitle":{"BackColor":[0,0,0,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[148,7511,1773,7928],"TextAlign":2},"Covers":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[0,0,1024,1024]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[1024,1024,2048,2048]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[2048,2048,3072,3072]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[3072,3072,4096,4096]}],"CustomTitle":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5319,7445,7929,7862],"Text":"Test","TextAlign":2},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""}],"FontSize":32,"FontSizeExtra1":32,"FontSizeExtra2":32,"FontSizeExtra3":32,"FontSizeScale":1,"FontSizeSnapshot":32,"OSDMobileState":{"BackColor":[0,1,1,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[6295,920,7929,1351]},"PTZCoordinates":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZDirection":{"BackColor":[0,1,1,128],"DisplayTime":5,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZOSDMenu":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZOSDMenuViaApp":{"BackColor":[0,1,1,128],"DisplayTime":60,"EncodeBlend":true,"EncodeBlendExtra1":true,"EncodeBlendExtra2":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[281,1477,2897,1542]},"PTZPreset":{"BackColor":[0,1,1,128],"DisplayTime":5,"EncodeBlend":false,"FrontColor":[255,255,255,3],"PreviewBlend":false,"Rect":[475,1442,475,1442]},"PTZZoom":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PictureTitle":{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"Name":"osd.bmp","PreviewBlend":false,"Rect":[0,0,128,128]},"PtzPattern":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PtzRS485Detect":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"Temperature":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320],"TemperatureUnit":"Centigrade"},"TimeTitle":{"BackColor":[0,0,0,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[5319,352,7929,769],"ShowWeek":false,"WeekPosition":"Right"},"UserDefinedTitle":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""}],"VoltageStatus":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[541,3320,541,3320]},"WideHeightRatio":0}],"options":[]},"id":383,"session":"416eaad9e266a4cea830c6ec143f7ab0"}],"id":384,"session":"416eaad9e266a4cea830c6ec143f7ab0"}:


Now the text overlay enabled.

{"method":"system.multicall","params":[{"method":"configManager.setConfig","params":{"name":"ChannelTitle","table":[{"Name":"LPR 1 (TE-121)"}],"options":[]},"id":385,"session":"416eaad9e266a4cea830c6ec143f7ab0"},{"method":"configManager.setConfig","params":{"name":"VideoWidget","table":[{"ChannelTitle":{"BackColor":[0,0,0,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[148,7511,1773,7928],"TextAlign":2},"Covers":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[0,0,1024,1024]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[1024,1024,2048,2048]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[2048,2048,3072,3072]},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[3072,3072,4096,4096]}],"CustomTitle":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[5319,7445,7929,7862],"Text":"Test","TextAlign":2},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[5321,7450,7931,7868],"Text":""}],"FontSize":32,"FontSizeExtra1":32,"FontSizeExtra2":32,"FontSizeExtra3":32,"FontSizeScale":1,"FontSizeSnapshot":32,"OSDMobileState":{"BackColor":[0,1,1,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[6295,920,7929,1351]},"PTZCoordinates":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZDirection":{"BackColor":[0,1,1,128],"DisplayTime":5,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZOSDMenu":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PTZOSDMenuViaApp":{"BackColor":[0,1,1,128],"DisplayTime":60,"EncodeBlend":true,"EncodeBlendExtra1":true,"EncodeBlendExtra2":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[281,1477,2897,1542]},"PTZPreset":{"BackColor":[0,1,1,128],"DisplayTime":5,"EncodeBlend":false,"FrontColor":[255,255,255,3],"PreviewBlend":false,"Rect":[475,1442,475,1442]},"PTZZoom":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PictureTitle":{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"Name":"osd.bmp","PreviewBlend":false,"Rect":[0,0,128,128]},"PtzPattern":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"PtzRS485Detect":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320]},"Temperature":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[541,3320,541,3320],"TemperatureUnit":"Centigrade"},"TimeTitle":{"BackColor":[0,0,0,128],"EncodeBlend":true,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[5319,352,7929,769],"ShowWeek":false,"WeekPosition":"Right"},"UserDefinedTitle":[{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""},{"BackColor":[0,0,0,128],"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":false,"Rect":[148,352,1773,769],"Text":""}],"VoltageStatus":{"BackColor":[0,1,1,128],"DisplayTime":0,"EncodeBlend":false,"FrontColor":[255,255,255,0],"PreviewBlend":true,"Rect":[541,3320,541,3320]},"WideHeightRatio":0}],"options":[]},"id":386,"session":"416eaad9e266a4cea830c6ec143f7ab0"}],"id":387,"session":"416eaad9e266a4cea830c6ec143f7ab0"}:
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
I think dahua might have an easier way actually, after a bit of searching:

 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
Once you have the code updated for dahua cams let us know. I would love to try this hope this is not too dificult for me to run as I have never dealt with docker.. I have a dedicated Windows 10 box for BI will be running this on it
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
Added some more information to the screen, also made the information clear out after 5 seconds.
1609522129953.png
 
Last edited:

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
The webhook payload includes a cropped image of the license plate. i spend today trying to figure out how to get an image overlayed on the camera. it looks like Hikvision doesn't support it. Dahua does but you have to turn off the text overlay in order to display an image overlay. Blue Iris allows image overlays but I can't find anything in the API to push images.

I think I found an workaround but it's more complicated than I would like.

1. Create windows share on Blue Iris folder, put a dummy plate.jpg file in folder.
2. Set up the image overlay on the camera, use the plate.jpg file.
3. When the service gets a new plate, it sends the image to that windows share, overwriting plate.jpg with the new plate
4. Blue Iris starts showing the new plate image on the display.

1609551405928.png

I have seen the ability to change DIO bits which can be used to show/hide the image in the Blue Iris api also.
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
The webhook payload includes a cropped image of the license plate. i spend today trying to figure out how to get an image overlayed on the camera. it looks like Hikvision doesn't support it. Dahua does but you have to turn off the text overlay in order to display an image overlay. Blue Iris allows image overlays but I can't find anything in the API to push images.

I think I found an workaround but it's more complicated than I would like.

1. Create windows share on Blue Iris folder, put a dummy plate.jpg file in folder.
2. Set up the image overlay on the camera, use the plate.jpg file.
3. When the service gets a new plate, it sends the image to that windows share, overwriting plate.jpg with the new plate
4. Blue Iris starts showing the new plate image on the display.

View attachment 78577

I have seen the ability to change DIO bits which can be used to show/hide the image in the Blue Iris api also.
Nice, That does look pretty darn cool ) I think I even watch how to run docker last night and have manage to pull down image but again I have dahua cam this is just me trying to understand how docker run atleast lol

1609551838501.png


Anyhow thank you much!! For sharing your code and making this. This looks really nice what it does.
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
I have added dahua support, it needs testing and only works with cameras that can set the text overlay using the URL pattern http://x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
I have added dahua support, it needs testing and only works with cameras that can set the text overlay using the URL pattern http://x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=
Awesome! Thank you for adding that support for the cam. I have never used docker I just pulled the latest copy now in docker.1609602828762.png

So is the next step should be running this in order to make it work ?

1609602743697.png

Since not sure if this is where the info needs to be populated. This is after I click run and under options.

1609603401847.png

Or Where do I add my camera info basically and oepnalpr info somewhere else.. the line basically..


Code:
http://x.x.x.x/cgi-bin/configManager.cgi?action=setConfig&VideoWidget[0].CustomTitle[1].Text=
 
Last edited:

biggen

Known around here
Joined
May 6, 2018
Messages
2,572
Reaction score
2,856
If I'm not mistaken you have to create a directory app and then under that create the file called appsettings.json with your camera information using the ConfigurationExamples as a guide. There is also a typo in the docker run file I believe. There needs to be a space at the end of this line -v /app/appsettings.json:/appsettings.json\ between the last .json extension and the next backslash \. So it should look like -v /app/appsettings.json:/appsettings.json \

I'm in the process of doing this now.
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
Sorry, Have never done docker stuff. So learning curve for me probably. Am I creating this directory under 1609603624003.png or from cmd
docker mkdir openalprwebhook ?
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,572
Reaction score
2,856
Yeah the folder just needs to be in the same directory your run the docker command from. Of if you put the entire command in to a single file for easier running, the app folder just needs to be in that same directory you run that file from. So you could create a directory under Docker called web_hook, then go inside that and create an app directory. Create your appsettings.json inside that app folder with your correct camera information. Then go up one directory back to the web_hook directory and run the docker command from there.
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,572
Reaction score
2,856
My question is where does the Webhook come from? Is it coming from the local agent running inside my LAN or from their web/cloud service. I see if you login into the OpenALPR Login with my account and then go to Configuration->Webhooks you can specify the URL you want them sent. I'm assuming that is back to my container running this service which would necessitate port forwarding to the container.

Is this correct, @mlapaglia?
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
My question is where does the Webhook come from? Is it coming from the local agent running inside my LAN or from their web/cloud service. I see if you login into the OpenALPR Login with my account and then go to Configuration->Webhooks you can specify the URL you want them sent. I'm assuming that is back to my container running this service which would necessitate port forwarding to the container.

Is this correct, @mlapaglia?
Just guessing this maybe coming from local

Since under my account in cloud it says..

1609605026846.png
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,572
Reaction score
2,856
I'm also not sure what the OpenAlprCameraId is that is located inside appsettings.json exactly and where I find it in the OpenALPR website. Is it the friendly name of the camera?
 

tech101

Known around here
Joined
Mar 30, 2015
Messages
1,476
Reaction score
2,132
Location
SF BayArea, USA
I'm also not sure what the OpenAlprCameraId is that is located inside appsettings.json exactly and where I find it in the OpenALPR website. Is it the friendly name of the camera?
I beleive if you go to yoru openalpr account go to Dashboard---Under Cameras---View Details---Click Configure for your Server Name Click Configure on the camera in question ---

You should see the ID there..

1609605875693.png
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
I have started a setup guide here mlapaglia/OpenAlprWebhookProcessor

Yes, if you are using the cloud based solution you will need to open up a port in your router for cloud.openalpr.com to be able to post results to the service. I'm running it locally so I just use my local IP address.
 

biggen

Known around here
Joined
May 6, 2018
Messages
2,572
Reaction score
2,856
I'm using their "Watchmen" service so I do have the agent running locally but it still sends all the screen caps and stuff to their cloud so it can be viewed from a browser any where.
 

mlapaglia

Getting comfortable
Joined
Apr 6, 2016
Messages
849
Reaction score
506
I believe with the homeowner plan you cannot have the watchman service send data to anything besides the cloud, you will need to use the webhook page to send notifications.
 
Top