Page 1 of 1

ALPR and auto cropping images

Posted: Fri Apr 14, 2023 2:13 am
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.

Re: ALPR and auto cropping images

Posted: Sat Apr 15, 2023 7:38 am
by Magic919
You’d possibly get some responses on the Slack channel.

Re: ALPR and auto cropping images

Posted: Tue Apr 18, 2023 12:23 am
by Darkmage
Okay, cool. Thanks for the tip.

Re: ALPR and auto cropping images

Posted: Wed Apr 19, 2023 12:59 am
by iconnor
There is a lot of work to do here...

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