ALPR and auto cropping images

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
Darkmage
Posts: 3
Joined: Mon Mar 27, 2023 1:06 am

ALPR and auto cropping images

Post by Darkmage »

Greetings!

Thanks to this forum and the various tutorials and posts out there, I have successfully configured the Event Server to automatically run a ML process on the Zoneminder events and if it detects a car, motorcycle, or truck it will attempt some ALPR using the free tier of the API at PlateRecognizer.com. Sometimes, it even works. But I'm sure it could be better.

The API has an upper limit on uploaded images of 1600 pixels in either dimension, which seems like a lot. However, my camera overlooking my driveway is 3840x2160 and the Event Server automagically resizes the snapshot down to 1600 before passing it along to the API. What it doesn't do is crop the image before sending it to the service. So invariably the service scans the yard, bushes, shed and other unnecessary portions.
I mean, look at this. So much area that is highly unlikely to have a license plate in it. (This time it worked, but that's actually pretty rare)
Image

So the object detection puts a box around the vehicle. The API can accept any image up to 1600 pixels in any direction. I would like for the event server to use the object detection box as a boundary for a crop operation of the full sized image and then send the cropped portion to the API for analysis. So my question is: Has anyone already developed a script to crop an image before calling the ALPR process? I really don't want to reinvent the wheel.
Magic919
Posts: 1381
Joined: Wed Sep 18, 2013 6:56 am

Re: ALPR and auto cropping images

Post by Magic919 »

You’d possibly get some responses on the Slack channel.
-
Darkmage
Posts: 3
Joined: Mon Mar 27, 2023 1:06 am

Re: ALPR and auto cropping images

Post by Darkmage »

Okay, cool. Thanks for the tip.
User avatar
iconnor
Posts: 2904
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: ALPR and auto cropping images

Post by iconnor »

There is a lot of work to do here...

I don't think there is any code to do what you want..
Post Reply