meraki-mqtt-alpr: A program that uses MV to do people, vehicle and ALPR

PhilipDAth
Kind of a big deal
Kind of a big deal

meraki-mqtt-alpr: A program that uses MV to do people, vehicle and ALPR

I've done it.

 

I've writen a program uses the capabilities of second generation MV cameras and the MV Sense API (MQTT) to process people and vehicle detection events.  People events are saved as images to the local filesystem.  If the camera is an MV72 (the only camera that can generate a vehicle event) the image of the vehicle is saved and a cloud based service is used to convert the image to a plain text version of the number plate image.

For those people in New Zealand the licence plate can be looked up against the NZ Police stolen vehicle database as an example of how ALPR (automatic licence plate recognition) can be used.

 

https://www.ifm.net.nz/cookbooks/meraki-icu.html 

7 REPLIES 7
AjitKumar
Head in the Cloud

Awesome Philip. You are the "Inspiration".

Regards,
Ajit
AjitsNW@gmail.com
www.ajit.network
Julian
Getting noticed

Interesting.. need to find some time to test it..

Julian
Getting noticed

hi.. I did some tests... I configured and is working detecting persons and vehicles, but is not getting the snapshot.

 

 

 

with a curl with the timestamp I can get a snapshot without problems:

 

curl -s -L -H 'X-Cisco-Meraki-API-Key: xxxxx' -d '{"timestamp":"2019-11-11T14:54:27.443Z"}' -X POST -H 'Content-Type: application/json' 'https://nxxx.meraki.com/api/v0/networks/xxxx/cameras/xxxx-xxxx-xxxx/snapshot'

 

{"url":"https://spn3.meraki.com/stream/jpeg/snapshot/70333350c2323254sasasahZDg3NzQ5ZjZjYTAwNDMxNmUzZTM3MmNm... to the image will expire at 2019-11-11T08:09:18-08:00"}

 

 

 

I can see the post to the meraki api but is no data for that timestamp.

 

that is the result for the processsnapshot function:

 

vehicle count: 8
processSnapshot: netID=L_xxxxxxx, camera serial=xxxx-xxxx-xxxx,ts=2019-11-11T14:21:33.557Z, count=0
processSnapshot: netID=L_xxxxxxx, camera serial=xxxx-xxxx-xxxx,ts=2019-11-11T14:21:33.557Z, count=0
error_:
{
status: 400,
statusText: 'Bad Request',
headers: {
server: 'nginx',
date: 'Mon, 11 Nov 2019 14:21:33 GMT',
'content-type': 'application/json; charset=utf-8',
'transfer-encoding': 'chunked',
connection: 'close',
'cache-control': 'no-cache, no-store, max-age=0, must-revalidate',
pragma: 'no-cache',
expires: 'Fri, 01 Jan 1990 00:00:00 GMT',
'x-frame-options': 'sameorigin',
'x-robots-tag': 'none',
'x-ua-compatible': 'IE=Edge,chrome=1',
'x-request-id': 'b4d7f0bab7hf03447bde69553f6fecccb',
'x-runtime': '0.162265'
},
config: {
url: 'https://nxxx.meraki.com/api/v0/networks/xxxxxxxx/cameras/xxxx-xxxx-xxxx/snapshot',
method: 'post',
data: '{"timestamp":"2019-11-11T14:21:33.557Z"}',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json; charset=utf-8',
'X-Cisco-Meraki-API-Key': 'xxxxxxxx',
'User-Agent': 'axios/0.19.0',
'Content-Length': 40
},
baseURL: 'https://nxxx.meraki.com/api/v0/',
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus]
},
data: { errors: [ 'No video for the specified timestamp' ] }
}

 

 

 

PhilipDAth
Kind of a big deal
Kind of a big deal

Double check you have the correct URL for the shard you are in "node_modules\node-meraki-dashboard\src\index.js" on line 24.

 

I found the dashboard snapshot function frequently fails to retrieve snapshots for recent timestamps.  That is why I have put the call in a loop, so it tries lots of times.  I notice in your case the dashboard API is returning "No video for the specified timestamp" - so I think this is the problem you are having.

 

It should eventually work after some further iterations of the loop.  You'll be able to tell by checking the people or vehicles folder for a snapshot.

 

 

ps. I'm running firmware 3.36.

ps.  You can reproduce this problem using curl as well - you just have to do the curl call with the returned timestamp shortly after the event happens (try and do it within 10s).  Then you keep repeating the command and suddenly it works.  Sometimes it can take over a minute before it starts working.

Hi, you are right, I incremented the setimeout of the processsnapshot from 5000 to 10000 and now is downloading the snapshots.

 

Thanks

PhilipDAth
Kind of a big deal
Kind of a big deal

When I first started testing I actually used 60,000 because I had so many timeouts.  Sometimes it just never returns a snapshot - event after 10 minutes.

 

Then I eventually settings on the lower timer value with lots of retries.

 

 

Hopefully Meraki will tidy this up sometime ... and fix the 5 requests per second issue.

Get notified when there are additional replies to this discussion.
Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.