mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-31 02:06:19 +08:00
Merge branch 'master' of github.com:openalpr/openalpr
This commit is contained in:
@@ -5,23 +5,37 @@ using namespace openalprnet;
|
|||||||
|
|
||||||
BitmapMat::BitmapMat(array<Byte>^ byteArray)
|
BitmapMat::BitmapMat(array<Byte>^ byteArray)
|
||||||
{
|
{
|
||||||
this->m_bitmap = ByteArrayToMat(byteArray);
|
m_bitmap = new cv::Mat();
|
||||||
|
std::vector<char> buffer = AlprHelper::ToVector(byteArray);
|
||||||
|
cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR, this->m_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapMat::BitmapMat(Bitmap^ bitmap)
|
BitmapMat::BitmapMat(Bitmap^ bitmap)
|
||||||
{
|
{
|
||||||
this->m_bitmap = BitmapToMat(bitmap);
|
m_bitmap = new cv::Mat();
|
||||||
|
|
||||||
|
MemoryStream^ ms = gcnew MemoryStream();
|
||||||
|
bitmap->Save(ms, ImageFormat::Png);
|
||||||
|
|
||||||
|
std::vector<char> buffer = AlprHelper::ToVector(ms->ToArray());
|
||||||
|
cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR, this->m_bitmap);
|
||||||
|
|
||||||
|
delete ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapMat::BitmapMat(MemoryStream^ memoryStream)
|
BitmapMat::BitmapMat(MemoryStream^ memoryStream)
|
||||||
{
|
{
|
||||||
this->m_bitmap = MemoryStreamBitmapToMat(memoryStream);
|
m_bitmap = new cv::Mat();
|
||||||
|
std::vector<char> buffer = AlprHelper::ToVector(memoryStream->ToArray());
|
||||||
|
cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR, this->m_bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
BitmapMat::BitmapMat(String^ filename)
|
BitmapMat::BitmapMat(String^ filename)
|
||||||
{
|
{
|
||||||
Bitmap^ bitmap = gcnew Bitmap(filename);
|
m_bitmap = new cv::Mat();
|
||||||
this->m_bitmap = BitmapToMat(bitmap);
|
array<Byte>^ byteArray = File::ReadAllBytes(filename);
|
||||||
delete bitmap;
|
std::vector<char> buffer = AlprHelper::ToVector(byteArray);
|
||||||
|
cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR, this->m_bitmap);
|
||||||
|
delete byteArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
|
#include <opencv2/highgui/highgui.hpp>
|
||||||
|
|
||||||
|
#include "helper-net.h"
|
||||||
|
|
||||||
using namespace System;
|
using namespace System;
|
||||||
using namespace System::Drawing;
|
using namespace System::Drawing;
|
||||||
@@ -33,74 +36,16 @@ namespace openalprnet {
|
|||||||
|
|
||||||
!BitmapMat()
|
!BitmapMat()
|
||||||
{
|
{
|
||||||
delete[] m_bitmap->data;
|
m_bitmap->release();
|
||||||
|
delete m_bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
property cv::Mat Value {
|
property cv::Mat Value {
|
||||||
cv::Mat get()
|
cv::Mat get()
|
||||||
{
|
{
|
||||||
cv::Mat value = this->m_bitmap->clone();
|
return *m_bitmap;
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
static cv::Mat* BitmapToMat(Bitmap^ bitmap)
|
|
||||||
{
|
|
||||||
int channels = 0;
|
|
||||||
|
|
||||||
switch (bitmap->PixelFormat)
|
|
||||||
{
|
|
||||||
case PixelFormat::Format8bppIndexed:
|
|
||||||
case PixelFormat::Format1bppIndexed:
|
|
||||||
channels = 1;
|
|
||||||
break;
|
|
||||||
case PixelFormat::Format24bppRgb:
|
|
||||||
channels = 3;
|
|
||||||
break;
|
|
||||||
case PixelFormat::Format32bppRgb:
|
|
||||||
case PixelFormat::Format32bppArgb:
|
|
||||||
case PixelFormat::Format32bppPArgb:
|
|
||||||
channels = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw gcnew NotSupportedException(bitmap->PixelFormat.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
BitmapData^ bitmapData = bitmap->LockBits(
|
|
||||||
System::Drawing::Rectangle(0, 0, bitmap->Width, bitmap->Height),
|
|
||||||
ImageLockMode::ReadOnly,
|
|
||||||
bitmap->PixelFormat
|
|
||||||
);
|
|
||||||
|
|
||||||
const int totalBytes = bitmap->Height * bitmapData->Stride;
|
|
||||||
|
|
||||||
char *dst = new char[totalBytes];
|
|
||||||
::memcpy(dst, bitmapData->Scan0.ToPointer(), totalBytes);
|
|
||||||
|
|
||||||
cv::Mat* dstMat = new cv::Mat(cv::Size(bitmap->Width, bitmap->Height), CV_8UC(channels), dst);
|
|
||||||
|
|
||||||
bitmap->UnlockBits(bitmapData);
|
|
||||||
|
|
||||||
return dstMat;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cv::Mat* MemoryStreamBitmapToMat(MemoryStream^ memoryStream)
|
|
||||||
{
|
|
||||||
Bitmap^ bitmap = gcnew Bitmap(memoryStream);
|
|
||||||
cv::Mat* mat = BitmapToMat(bitmap);
|
|
||||||
delete bitmap;
|
|
||||||
return mat;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cv::Mat* ByteArrayToMat(array<Byte>^ byteArray)
|
|
||||||
{
|
|
||||||
MemoryStream^ ms = gcnew MemoryStream(byteArray);
|
|
||||||
cv::Mat* mat = MemoryStreamBitmapToMat(ms);
|
|
||||||
delete ms;
|
|
||||||
return mat;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -14,23 +14,20 @@ void AlprMotionDetectionNet::ResetMotionDetection(Bitmap^ bitmap)
|
|||||||
|
|
||||||
void AlprMotionDetectionNet::ResetMotionDetection(String^ filename)
|
void AlprMotionDetectionNet::ResetMotionDetection(String^ filename)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(filename);
|
cv::Mat mat = cv::imread(marshal_as<std::string>(filename));
|
||||||
ResetMotionDetection(wrapper->Value);
|
ResetMotionDetection(mat);
|
||||||
delete wrapper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlprMotionDetectionNet::ResetMotionDetection(MemoryStream^ memoryStream)
|
void AlprMotionDetectionNet::ResetMotionDetection(MemoryStream^ memoryStream)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(memoryStream);
|
return ResetMotionDetection(memoryStream->ToArray());
|
||||||
ResetMotionDetection(wrapper->Value);
|
|
||||||
delete wrapper;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlprMotionDetectionNet::ResetMotionDetection(array<Byte>^ byteArray)
|
void AlprMotionDetectionNet::ResetMotionDetection(array<Byte>^ byteArray)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(byteArray);
|
std::vector<char> buffer = AlprHelper::ToVector(byteArray);
|
||||||
ResetMotionDetection(wrapper->Value);
|
cv::Mat mat = cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR);
|
||||||
delete wrapper;
|
ResetMotionDetection(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(Bitmap^ bitmap)
|
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(Bitmap^ bitmap)
|
||||||
@@ -43,26 +40,21 @@ System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(Bitmap^ bitmap)
|
|||||||
|
|
||||||
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(String^ filename)
|
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(String^ filename)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(filename);
|
cv::Mat mat = cv::imread(marshal_as<std::string>(filename));
|
||||||
System::Drawing::Rectangle motion = MotionDetect(wrapper->Value);
|
System::Drawing::Rectangle motion = MotionDetect(mat);
|
||||||
delete wrapper;
|
|
||||||
return motion;
|
return motion;
|
||||||
}
|
}
|
||||||
|
|
||||||
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(MemoryStream^ memoryStream)
|
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(MemoryStream^ memoryStream)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(memoryStream);
|
return MotionDetect(memoryStream->ToArray());
|
||||||
System::Drawing::Rectangle motion = MotionDetect(wrapper->Value);
|
|
||||||
delete wrapper;
|
|
||||||
return motion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(array<Byte>^ byteArray)
|
System::Drawing::Rectangle AlprMotionDetectionNet::MotionDetect(array<Byte>^ byteArray)
|
||||||
{
|
{
|
||||||
BitmapMat^ wrapper = gcnew BitmapMat(byteArray);
|
std::vector<char> buffer = AlprHelper::ToVector(byteArray);
|
||||||
System::Drawing::Rectangle motion = MotionDetect(wrapper->Value);
|
cv::Mat mat = cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR);
|
||||||
delete wrapper;
|
return MotionDetect(mat);
|
||||||
return motion;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlprMotionDetectionNet::ResetMotionDetection(cv::Mat mat)
|
void AlprMotionDetectionNet::ResetMotionDetection(cv::Mat mat)
|
||||||
|
|||||||
@@ -361,8 +361,7 @@ namespace openalprnet {
|
|||||||
/// Recognize from an image on disk
|
/// Recognize from an image on disk
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AlprResultsNet^ Recognize(System::String^ filepath) {
|
AlprResultsNet^ Recognize(System::String^ filepath) {
|
||||||
AlprResults results = m_Impl->recognize(marshal_as<std::string>(filepath));
|
return Recognize(filepath, gcnew List<System::Drawing::Rectangle>());
|
||||||
return gcnew AlprResultsNet(results);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -419,7 +418,7 @@ namespace openalprnet {
|
|||||||
/// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
|
/// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="imageBuffer">Bytes representing image data</param>
|
/// <param name="imageBuffer">Bytes representing image data</param>
|
||||||
AlprResultsNet^ Recognize(cli::array<Byte>^ imageBuffer) {
|
AlprResultsNet^ Recognize(array<Byte>^ imageBuffer) {
|
||||||
return Recognize(imageBuffer, gcnew List<System::Drawing::Rectangle>());
|
return Recognize(imageBuffer, gcnew List<System::Drawing::Rectangle>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +426,7 @@ namespace openalprnet {
|
|||||||
/// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
|
/// Recognize from byte data representing an encoded image (e.g., BMP, PNG, JPG, GIF etc).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="imageBuffer">Bytes representing image data</param>
|
/// <param name="imageBuffer">Bytes representing image data</param>
|
||||||
AlprResultsNet^ Recognize(cli::array<Byte>^ imageBuffer, List<System::Drawing::Rectangle>^ regionsOfInterest) {
|
AlprResultsNet^ Recognize(array<Byte>^ imageBuffer, List<System::Drawing::Rectangle>^ regionsOfInterest) {
|
||||||
std::vector<char> buffer = AlprHelper::ToVector(imageBuffer);
|
std::vector<char> buffer = AlprHelper::ToVector(imageBuffer);
|
||||||
std::vector<AlprRegionOfInterest> rois = AlprHelper::ToVector(regionsOfInterest);
|
std::vector<AlprRegionOfInterest> rois = AlprHelper::ToVector(regionsOfInterest);
|
||||||
AlprResults results = m_Impl->recognize(buffer, rois);
|
AlprResults results = m_Impl->recognize(buffer, rois);
|
||||||
@@ -437,14 +436,14 @@ namespace openalprnet {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recognize from raw pixel data
|
/// Recognize from raw pixel data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AlprResultsNet^ Recognize(cli::array<Byte>^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight) {
|
AlprResultsNet^ Recognize(array<Byte>^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight) {
|
||||||
return Recognize(imageBuffer, bytesPerPixel, imgWidth, imgHeight, gcnew List<System::Drawing::Rectangle>());
|
return Recognize(imageBuffer, bytesPerPixel, imgWidth, imgHeight, gcnew List<System::Drawing::Rectangle>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recognize from raw pixel data
|
/// Recognize from raw pixel data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
AlprResultsNet^ Recognize(cli::array<Byte>^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight, List<System::Drawing::Rectangle>^ regionsOfInterest) {
|
AlprResultsNet^ Recognize(array<Byte>^ imageBuffer, int bytesPerPixel, int imgWidth, int imgHeight, List<System::Drawing::Rectangle>^ regionsOfInterest) {
|
||||||
unsigned char* p = AlprHelper::ToCharPtr(imageBuffer);
|
unsigned char* p = AlprHelper::ToCharPtr(imageBuffer);
|
||||||
std::vector<AlprRegionOfInterest> rois = AlprHelper::ToVector(regionsOfInterest);
|
std::vector<AlprRegionOfInterest> rois = AlprHelper::ToVector(regionsOfInterest);
|
||||||
AlprResults results = m_Impl->recognize(p, bytesPerPixel, imgWidth, imgHeight, rois);
|
AlprResults results = m_Impl->recognize(p, bytesPerPixel, imgWidth, imgHeight, rois);
|
||||||
@@ -458,7 +457,7 @@ namespace openalprnet {
|
|||||||
array<Byte>^ PreWarp(array<Byte>^ imageBuffer)
|
array<Byte>^ PreWarp(array<Byte>^ imageBuffer)
|
||||||
{
|
{
|
||||||
std::vector<char> buffer = AlprHelper::ToVector(imageBuffer);
|
std::vector<char> buffer = AlprHelper::ToVector(imageBuffer);
|
||||||
cv::Mat src = cv::imdecode(buffer, 1);
|
cv::Mat src = cv::imdecode(buffer, CV_LOAD_IMAGE_COLOR);
|
||||||
|
|
||||||
alpr::PreWarp *preWarp = new alpr::PreWarp(m_Impl->getConfig());
|
alpr::PreWarp *preWarp = new alpr::PreWarp(m_Impl->getConfig());
|
||||||
cv::Mat warpedImage = preWarp->warpImage(src);
|
cv::Mat warpedImage = preWarp->warpImage(src);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const VariadicFunction2<bool, StringPiece*, const RE2&, RE2::Arg, RE2::ConsumeN>
|
|||||||
const VariadicFunction2<bool, StringPiece*, const RE2&, RE2::Arg, RE2::FindAndConsumeN> RE2::FindAndConsume = {};
|
const VariadicFunction2<bool, StringPiece*, const RE2&, RE2::Arg, RE2::FindAndConsumeN> RE2::FindAndConsume = {};
|
||||||
|
|
||||||
// This will trigger LNK2005 error in MSVC.
|
// This will trigger LNK2005 error in MSVC.
|
||||||
#ifndef COMPILER_MSVC
|
#ifndef WIN32
|
||||||
const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
|
const int RE2::Options::kDefaultMaxMem; // initialized in re2.h
|
||||||
#endif // COMPILER_MSVC
|
#endif // COMPILER_MSVC
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ static void StringAppendV(string* dst, const char* format, va_list ap) {
|
|||||||
// the data in it upon use. The fix is to make a copy
|
// the data in it upon use. The fix is to make a copy
|
||||||
// of the structure before using it and use that copy instead.
|
// of the structure before using it and use that copy instead.
|
||||||
va_list backup_ap;
|
va_list backup_ap;
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
backup_ap = ap;
|
||||||
|
#else
|
||||||
va_copy(backup_ap, ap);
|
va_copy(backup_ap, ap);
|
||||||
|
#endif
|
||||||
int result = vsnprintf(space, sizeof(space), format, backup_ap);
|
int result = vsnprintf(space, sizeof(space), format, backup_ap);
|
||||||
va_end(backup_ap);
|
va_end(backup_ap);
|
||||||
|
|
||||||
@@ -37,7 +42,12 @@ static void StringAppendV(string* dst, const char* format, va_list ap) {
|
|||||||
char* buf = new char[length];
|
char* buf = new char[length];
|
||||||
|
|
||||||
// Restore the va_list before we use it again
|
// Restore the va_list before we use it again
|
||||||
|
#if defined(WIN32)
|
||||||
|
va_list backup_ap = ap;
|
||||||
|
#else
|
||||||
va_copy(backup_ap, ap);
|
va_copy(backup_ap, ap);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
result = vsnprintf_s(buf, length, length, format, backup_ap);
|
result = vsnprintf_s(buf, length, length, format, backup_ap);
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright 1999-2005 The RE2 Authors. All Rights Reserved.
|
// Copyright 1999-2005 The RE2 Authors. All Rights Reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
#include <stdio.h>
|
||||||
#include "re2/util/util.h"
|
#include "re2/util/util.h"
|
||||||
#include "re2/stringpiece.h"
|
#include "re2/stringpiece.h"
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ int CEscapeString(const char* src, int src_len, char* dest,
|
|||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
sprintf_s(dest + used, dest_len, "\\%03o", c);
|
sprintf_s(dest + used, dest_len, "\\%03o", c);
|
||||||
#else
|
#else
|
||||||
sprintf(dest + used, "\\%03o", c);
|
std::sprintf(dest + used, "\\%03o", c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
used += 4;
|
used += 4;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ namespace alpr
|
|||||||
microseconds = (double)t.QuadPart / frequencyToMicroseconds;
|
microseconds = (double)t.QuadPart / frequencyToMicroseconds;
|
||||||
t.QuadPart = microseconds;
|
t.QuadPart = microseconds;
|
||||||
tv->tv_sec = t.QuadPart / 1000000;
|
tv->tv_sec = t.QuadPart / 1000000;
|
||||||
tv->tv_usec = t.QuadPart % 1000000;
|
tv->tv_nsec = t.QuadPart % 1000000;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ namespace alpr
|
|||||||
|
|
||||||
timespec time_start;
|
timespec time_start;
|
||||||
time_start.tv_sec = 0;
|
time_start.tv_sec = 0;
|
||||||
time_start.tv_usec = 0;
|
time_start.tv_nsec = 0;
|
||||||
|
|
||||||
return diffclock(time_start, time);
|
return diffclock(time_start, time);
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ namespace alpr
|
|||||||
double diffclock(timespec time1,timespec time2)
|
double diffclock(timespec time1,timespec time2)
|
||||||
{
|
{
|
||||||
timespec delta = diff(time1,time2);
|
timespec delta = diff(time1,time2);
|
||||||
double milliseconds = (delta.tv_sec * 1000) + (((double) delta.tv_usec) / 1000.0);
|
double milliseconds = (delta.tv_sec * 1000) + (((double) delta.tv_nsec) / 10000.0);
|
||||||
|
|
||||||
return milliseconds;
|
return milliseconds;
|
||||||
}
|
}
|
||||||
@@ -100,15 +100,15 @@ namespace alpr
|
|||||||
timespec diff(timespec start, timespec end)
|
timespec diff(timespec start, timespec end)
|
||||||
{
|
{
|
||||||
timespec temp;
|
timespec temp;
|
||||||
if ((end.tv_usec-start.tv_usec)<0)
|
if ((end.tv_nsec-start.tv_nsec)<0)
|
||||||
{
|
{
|
||||||
temp.tv_sec = end.tv_sec-start.tv_sec-1;
|
temp.tv_sec = end.tv_sec-start.tv_sec-1;
|
||||||
temp.tv_usec = 1000000+end.tv_usec-start.tv_usec;
|
temp.tv_nsec = 1000000+end.tv_nsec-start.tv_nsec;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp.tv_sec = end.tv_sec-start.tv_sec;
|
temp.tv_sec = end.tv_sec-start.tv_sec;
|
||||||
temp.tv_usec = end.tv_usec-start.tv_usec;
|
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,24 @@
|
|||||||
#ifndef TIMING_H
|
#ifndef OPENALPR_TIMING_H
|
||||||
#define TIMING_H
|
#define OPENALPR_TIMING_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
// Import windows only stuff
|
// Import windows only stuff
|
||||||
|
#include <windows.h>
|
||||||
|
#if _MSC_VER < 1900
|
||||||
|
struct timespec
|
||||||
|
{
|
||||||
|
time_t tv_sec; // Seconds - >= 0
|
||||||
|
long tv_nsec; // Nanoseconds - [0, 999999999]
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
//#define timespec timeval
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -17,13 +29,6 @@
|
|||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Support for Windows
|
|
||||||
#ifdef WINDOWS
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define timespec timeval
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace alpr
|
namespace alpr
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user