|
@@ -1772,7 +1772,7 @@ namespace OTSIMGPROC
|
|
|
Point2f p[4];
|
|
|
rRect.points(p);
|
|
|
int D_MIN =getDistance(p[0], p[1]);
|
|
|
- int D_MinRecLen = 0;//minareaRect's length(the lenger side).
|
|
|
+ int D_MinRecLen = 0;//minareaRect's length(the longger side).
|
|
|
for (int j = 0; j <= 2; j++)
|
|
|
{
|
|
|
//line(cvContourImg, p[j], p[(j + 1) % 4], Scalar(100, 100, 0), 2);
|
|
@@ -1788,7 +1788,18 @@ namespace OTSIMGPROC
|
|
|
}
|
|
|
|
|
|
a_pOTSPart->SetDMin(D_MIN*a_PixelSize);
|
|
|
- a_pOTSPart->SetOrientation(rRect.angle);
|
|
|
+
|
|
|
+ double angle;
|
|
|
+ if (rRect.size.width> rRect.size.height) // w > h
|
|
|
+ {
|
|
|
+ angle = abs(rRect.angle);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ angle = 90.0 + abs(rRect.angle);
|
|
|
+ }
|
|
|
+
|
|
|
+ a_pOTSPart->SetOrientation(angle);
|
|
|
//----------calculate the perimeter
|
|
|
double d = arcLength(listEdge, true);
|
|
|
a_pOTSPart->SetPerimeter(d*a_PixelSize);
|