/usr/include/alpr.h is in libopenalpr-dev 2.3.0-1build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | /*
* Copyright (c) 2015 OpenALPR Technology, Inc.
* Open source Automated License Plate Recognition [http://www.openalpr.com]
*
* This file is part of OpenALPR.
*
* OpenALPR is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License
* version 3 as published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENALPR_ALPR_H
#define OPENALPR_ALPR_H
#include <iostream>
#include <vector>
#include <fstream>
#include <stdint.h>
#ifdef WIN32
#define OPENALPR_DLL_EXPORT __declspec( dllexport )
#else
#define OPENALPR_DLL_EXPORT
#endif
namespace alpr
{
struct AlprCoordinate
{
int x;
int y;
};
struct AlprChar
{
AlprCoordinate corners[4];
float confidence;
std::string character;
};
struct AlprPlate
{
std::string characters;
float overall_confidence;
std::vector<AlprChar> character_details;
bool matches_template;
};
class AlprRegionOfInterest
{
public:
AlprRegionOfInterest();
AlprRegionOfInterest(int x, int y, int width, int height)
{
this->x = x;
this->y = y;
this->width = width;
this->height = height;
};
int x;
int y;
int width;
int height;
};
class AlprPlateResult
{
public:
AlprPlateResult() {};
virtual ~AlprPlateResult() {};
// The number requested is always >= the topNPlates count
int requested_topn;
// The country (training data code) that was used to recognize the plate
std::string country;
// the best plate is the topNPlate with the highest confidence
AlprPlate bestPlate;
// A list of possible plate number permutations
std::vector<AlprPlate> topNPlates;
// The processing time for this plate
float processing_time_ms;
// the X/Y coordinates of the corners of the plate (clock-wise from top-left)
AlprCoordinate plate_points[4];
// The index of the plate if there were multiple plates returned
int plate_index;
// When region detection is enabled, this returns the region. Region detection is experimental
int regionConfidence;
std::string region;
};
class AlprResults
{
public:
AlprResults() {
frame_number = -1;
};
virtual ~AlprResults() {};
int64_t epoch_time;
int64_t frame_number;
int img_width;
int img_height;
float total_processing_time_ms;
std::vector<AlprPlateResult> plates;
std::vector<AlprRegionOfInterest> regionsOfInterest;
};
class Config;
class AlprImpl;
class OPENALPR_DLL_EXPORT Alpr
{
public:
Alpr(const std::string country, const std::string configFile = "", const std::string runtimeDir = "");
virtual ~Alpr();
// Set the country used for plate recognition
void setCountry(std::string country);
// Update the prewarp setting without reloading the library
void setPrewarp(std::string prewarp_config);
// Update the detection mask without reloading the library
void setMask(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight);
void setDetectRegion(bool detectRegion);
void setTopN(int topN);
void setDefaultRegion(std::string region);
// Recognize from an image on disk
AlprResults recognize(std::string filepath);
// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
AlprResults recognize(std::vector<char> imageBytes);
// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
AlprResults recognize(std::vector<char> imageBytes, std::vector<AlprRegionOfInterest> regionsOfInterest);
// Recognize from raw pixel data.
AlprResults recognize(unsigned char* pixelData, int bytesPerPixel, int imgWidth, int imgHeight, std::vector<AlprRegionOfInterest> regionsOfInterest);
static std::string toJson(const AlprResults results);
static AlprResults fromJson(std::string json);
bool isLoaded();
static std::string getVersion();
Config* getConfig();
private:
AlprImpl* impl;
};
}
#endif // OPENALPR_APLR_H
|