C# Vehicle Detector Example

Initialize vehicle detector model

using OneML.Alpr;
VehicleDetector detector = new VehicleDetector();

Initialize vehicle detector model with licensing

using OneML.Alpr;
LicenseManager licenseManager = new LicenseManager();
licenseManager.SetKey("LICENSE_KEY_VALUE_HERE");
licenseManager.ActivateKey();
VehicleDetector detector = new VehicleDetector(licenseManager);

Initialize oneML’s Utils

Utils utils = new Utils();

Initialize oneML’s Utils with licensing

Utils utils = new Utils(licenseManager);

Read input as oneML’s Image

Image img = utils.ReadImageCV(filePath);

Run the model

VehicleDetectorResultList results = detector.Detect(batch);

or

VehicleDetectorResult result = detector.Detect(img);

And get the output

FloatList scores = output.GetScores();
BBoxList bboxes = output.GetBBoxes();
int size = output.GetSize();
StatusCodeList statuses = output.GetReturnStatus();

Cleanup

detector.Dispose();
utils.Dispose();

or wrap the application with

using (VehicleDetector detector = new VehicleDetector())
using (Utils utils = new Utils())
{
// use detector, utils here
}