mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-05 10:56:51 +08:00
math function code fixes for Windows compatibility
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "edgefinder.h"
|
||||
#include "textlinecollection.h"
|
||||
#include "support/timing.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace cv;
|
||||
@@ -325,7 +326,7 @@ namespace alpr
|
||||
{
|
||||
for (unsigned int x = 0; x < crop.cols; x += stride)
|
||||
{
|
||||
contrast += pow( ((crop.at<unsigned char>(y,x) / 255.0) - avg_intensity), 2.0f);
|
||||
contrast += pow( ((crop.at<unsigned char>(y,x) / 255.0) - avg_intensity), 2.0);
|
||||
}
|
||||
}
|
||||
contrast /= ((float) rows) * ((float)cols);
|
||||
|
@@ -124,6 +124,10 @@ Point LineSegment::midpoint()
|
||||
return Point(midX, midY);
|
||||
}
|
||||
|
||||
int round_int(double r) {
|
||||
return (r > 0.0) ? (r + 0.5) : (r - 0.5);
|
||||
}
|
||||
|
||||
LineSegment LineSegment::getParallelLine(float distance)
|
||||
{
|
||||
float diff_x = p2.x - p1.x;
|
||||
@@ -132,8 +136,8 @@ LineSegment LineSegment::getParallelLine(float distance)
|
||||
float dist_x = distance * cos(angle);
|
||||
float dist_y = -distance * sin(angle);
|
||||
|
||||
int offsetX = (int)round(dist_x);
|
||||
int offsetY = (int)round(dist_y);
|
||||
int offsetX = (int)round_int(dist_x);
|
||||
int offsetY = (int)round_int(dist_y);
|
||||
|
||||
LineSegment result(p1.x + offsetX, p1.y + offsetY,
|
||||
p2.x + offsetX, p2.y + offsetY);
|
||||
|
Reference in New Issue
Block a user