# VehicleAnalysis

Runs number plate recognition, vehicle recognition (make and optionally model), and vehicle color analysis on the file(s) associated with an IDOL document FlowFile, and adds information about vehicles to the IDOL document.

To recognize vehicle models you must train a vehicle model database. For more information about vehicle analysis, including how to train a vehicle model database, refer to the Media Server Administration Guide.

Supported file formats

The processor can handle video files.

The processor can handle the following image formats:

- TIFF
- JPEG
- JPEG 2000
- PNG
- GIF (only the first frame of an animated GIF)
- BMP (compressed BMP files are not supported) and ICO
- PBM, PGM, and PPM
- WebP

Additionally, if you configure your MediaServiceImpl controller service to use a KeyView Export Service, the processor can handle document formats, including:

- Adobe PDF
- Microsoft Word Document (.DOC and .DOCX)
- Microsoft Excel Sheet (.XLS and .XLSX)
- Microsoft PowerPoint Presentation (.PPT and .PPTX)
- OpenDocument Text (.ODT)
- OpenDocument Spreadsheet (.ODS)
- OpenDocument Presentation (.ODP)
- Rich Text (RTF)

## Properties

Name | Default Value | Description
--- | --- | ---
IDOL License Service |  | An IdolLicenseServiceImpl that provides a way to communicate with an IDOL License Server.
Media Service |  | A MediaServiceImpl that manages media analysis resources.
Number Plate Locations |  | A comma-separated list of ISO-3166 codes to specify the locations for which you want to recognize number plates.
Database File |  | The path of a file that contains the vehicle model database to use. Set this property to use a database that you exported from Media Server, using the action `ExportVehicleModelDatabase`.
Shared Database |  | The name of the vehicle model database to use. Set this property to use a database that is stored in the external database specified by the Media Service (see the "Media Service" property).

## Relationships

Name | Description
--- | ---
success | Processing was successful.
failure | Processing failed.

## Example Output

The following example shows the metadata that can be added to an IDOL document, when vehicle analysis runs on an image.

    <idol_media>
        <vehicles>
            <vehicle page="1">
                <numberplate>
                    <plateread>AB01CDE</plateread>
                    <origin>GB</origin>
                    <region height="43" left="448" page="1" top="427" width="170">
                        <point x="448" y="428"/>
                        <point x="617" y="427"/>
                        <point x="617" y="466"/>
                        <point x="448" y="469"/>
                    </region>
                </numberplate>
                <make>Ford</make>
                <model>Focus</model>
                <color b="165" g="115" r="91">blue</color>
                <region height="488" left="112" page="1" top="109" width="718"/>
            </vehicle>
            ...
        </vehicles>
    </idol_media>

The XML contains a `vehicle` element for each vehicle.

- The `numberplate` element provides information about the number plate.

  - `plateread` - the characters from the number plate.
  - `origin` - the country of origin.
  - `region` - the position of the number plate in the image. The `point` elements describe the corners of a polygon that contains the number plate. The `left`, `top`, `width`, and `height` attributes describe the position and size of a bounding box around the polygon. All of these values are in pixels, where `x=0`, `y=0` represents the top-left corner of the image.
  - `subread` - the sub-read from the number plate. This field is only used for some locations, such as the United Arab Emirates. If the number plate does not have a sub-read, the element is omitted.
  - `vehicletype` - the vehicle type (private, taxi, military, and so on), if it can be determined from the number plate. If the number plate does not contain this information, the element is omitted.
- The `make` and `model` elements describe the vehicle make and model. The model is present only if you have trained and configured a vehicle model database.
- The `color` element describes the vehicle color. The `r`, `g`, and `b` attributes give the red, green, and blue color components.
- The `region` element describes the location of the vehicle in the image.

When you run vehicle analysis on a video, there can be multiple `region` elements, for both the number plate and vehicle, because the vehicle can be tracked across multiple video frames. The `page` attributes are replaced with `start` and `duration` attributes that provide video timestamps, in seconds. For example:

    <idol_media>
        <vehicles>
            <vehicle duration="0.32" start="13.4">
                <numberplate>
                    <plateread>AB01CDE</plateread>
                    <origin>GB</origin>
                    <region duration="0.04" height="29" left="1606" start="13.4" top="719" width="130">
                        <point x="1606" y="719"/>
                        <point x="1735" y="721"/>
                        <point x="1735" y="747"/>
                        <point x="1606" y="746"/>
                    </region>
                    <region duration="0.04" height="28" left="1637" start="13.52" top="761" width="132">
                        <point x="1637" y="761"/>
                        <point x="1768" y="762"/>
                        <point x="1768" y="788"/>
                        <point x="1637" y="786"/>
                    </region>
                    <region duration="0.04" height="29" left="1703" start="13.68" top="816" width="134">
                        <point x="1703" y="816"/>
                        <point x="1836" y="818"/>
                        <point x="1836" y="844"/>
                        <point x="1703" y="842"/>
                    </region>
                </numberplate>
                <make>Ford</make>
                <model>Focus</model>
                <color b="165" g="115" r="91">blue</color>
                <region duration="0.04" height="385" left="1414" start="13.4" top="433" width="453"/>
                <region duration="0.04" height="410" left="1454" start="13.52" top="487" width="429"/>
                <region duration="0.04" height="427" left="1504" start="13.68" top="534" width="415"/>
            </vehicle>
            ...
            ...
        </vehicles>
    </idol_media>

_FT_HTML5_bannerTitle.htm