LPR Camera API Not Sending License Plate Number in HTTP POST

Home › Forums › Viewtron Security Camera Systems Support › IP Camera API › LPR Camera API Not Sending License Plate Number in HTTP POST

  • A software developer using our Viewtron LPR Camera’s API recently contacted me with a problem that I wanted to document so that it would help others with setting up and troubleshooting. Here is an account of the issue and solution.

    I set up HTTP POST API on my Viewtron LPR-IP4 using the LPR camera API video and the example server.py project that Mike published on GitHub. The camera posts XML with the plate location, a timestamp, and the camera IP, but not the plate number.

    What am I doing wrong?

    This is what I sent to the customer:

    The XML you captured is a trajectory message. That message is object tracking only, so it never includes the plate characters or a picture. The plate read is a separate POST. In this case the camera was also too close to read the plate. A trajectory with no plate event usually means the read failed. Work through the checks below in this order.

    1. That XML is a trajectory message

    Look for messageType trajectory and targetType licensePlate. The post also has a rect. The four numbers in that box (x1, y1, x2, y2) are normalized to 10000. They mark where the plate sits in the frame. They are not the plate characters.

    A trajectory post does not contain the license plate number, and it does not contain images. Here is the shape of the post from this camera. The private IP is left in. The MAC address is not included. The rect coordinates are normalized to 10000.

    <?xml version="1.0" encoding="UTF-8" ?>
    <config>
        <messageType>trajectory</messageType>
        <ipAddress>192.168.1.121</ipAddress>
        <targetType>licensePlate</targetType>
        <rect>
            <!-- x1, y1, x2, y2 normalized to 10000 -->
        </rect>
    </config>

    The developer docs describe this stream as Smart track data (traject) on the real-time object tracking page. That page is written for person, car, and motorcycle tracking. On this LPR camera the same idea shows up as a trajectory message with targetType licensePlate. Either way, it is tracking, not a plate read.

    2. Confirm the HTTP push settings

    The camera can send several kinds of posts. Your server has to handle more than the trajectory message. The plate event arrives as its own POST.

    Viewtron LPR-IP4 Edit HTTP Notification screen set to HTTP POST with License Plate Detection

    On Edit HTTP Notification, confirm:

    • Actively Push is selected (not Push by Subscription).
    • Push protocol version is V2.
    • Protocol is HTTP and the method is POST, with your server, port, and path filled in. Persistent connection can stay checked.
    • Under Smart Alarm Data, Smart event data is checked, and both Original picture and Target picture are checked.
    • Under Smart Alarm Type, License Plate Detection is selected.

    The screen above also has Alarm status data and Smart track data checked, plus Alarm In and Video Exception. Those extra boxes are why trajectory posts show up. Leave Smart event data, the two picture boxes, and License Plate Detection on. Those are what carry the plate event.

    The example server.py from the video may be out of date. It can log the trajectory XML and miss the plate event that follows it. Use the Python SDK or the Node SDK. Both are linked from the Viewtron developer docs. For this camera, follow the license plate recognition camera API.

    On a camera that posts by itself, the plate event uses smartType VEHICE (that spelling is what the camera sends) and the plate text is in plateNumber, along with the plate crop and the full-frame picture. If the POST is coming from a Viewtron NVR, the plate event uses messageType alarmData, smartType vehicle, and licensePlateNumber. The SDK detects which format arrived. In the Python and Node examples, keep events whose category is lpr.

    3. The camera tracked the plate but never read it

    The push settings can be right and you still get only trajectory posts. That is what happened here. The plate was about 4 feet from the camera and filled about 40% of the frame width. Live view showed the plate as a tracked object, so the trajectory posts kept coming. The camera never sent a plate number, and it did not return an error.

    Pointed at a parking spot about 12 yards away, the same camera read plates consistently.

    A trajectory with no plate event usually means the read failed. Fix the distance, the angle, and how large the plate is in the frame.

    The Viewtron LPR-IP4 product page lists a license plate recognition range of 21 to 90 feet (7 to 30 meters) when the install is done well. The installation notes on that page say:

    • Keep the horizontal angle at 15 degrees or less.
    • Keep the vertical angle at 30 degrees or less. Less angle works better.
    • Mount the camera so the view is about 16 feet wide or less where the plate is captured.
    • Mount it between 12 and 50 feet from where vehicles pass, and between 3 and 16 feet high.

    Four feet is closer than both the 12 foot mounting note and the 21 foot start of the recognition range. Twelve yards is 36 feet, which sits inside the 21 to 90 foot range.

    The LPR camera installation guide says to cover about one lane (about 15 feet wide). It lists the LPR-IP4 8-32mm lens for automatic plate recognition out to 90 feet. Keep vertical pitch at 30 degrees or less and the horizontal angle at 15 degrees or less. Park a vehicle in the zone and set the minimum plate size slightly smaller than that plate, and the maximum slightly larger.

    Related

    Questions about this LPR camera setup? Email info@cctvcamerapros.net or call / text 1-561-433-8488.