summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Dennedy <dan@dennedy.org>2015-12-21 21:26:09 (GMT)
committer Dan Dennedy <dan@dennedy.org>2015-12-21 21:26:09 (GMT)
commit2bef628ffe57949fd0bfbddc5d0c6a03c3c05d9c (patch)
tree8550601253970e8de690947a0a9ce99c93c02ef7
parent7ed3f84e652077df438db0db466a37e36b200347 (diff)
Fix compiling against OpenCV 2.3.1.
OpenCV >= 2.4.9 added CV_VERSION_EPOCH, and it appeared in v3.0.0 for a couple of months before being removed. However, v2.4.11 defines CV_VERSION_MAJOR as 4. Based on suggestion by PhobosK on GitHub
-rw-r--r--src/filter/facedetect/facedetect.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/filter/facedetect/facedetect.cpp b/src/filter/facedetect/facedetect.cpp
index 638e2fe..dbcae75 100644
--- a/src/filter/facedetect/facedetect.cpp
+++ b/src/filter/facedetect/facedetect.cpp
@@ -261,7 +261,7 @@ private:
{
double scale = this->scale == 0? 1.0 : this->scale;
CvScalar colors[5] = {
-#if (CV_VERSION_EPOCH != 2)
+#if !defined CV_VERSION_EPOCH && (CV_VERSION_MAJOR >= 3)
CvScalar(cvRound(color[0].r * 255), cvRound(color[0].g * 255), cvRound(color[0].b * 255), cvRound(alpha * 255)),
CvScalar(cvRound(color[1].r * 255), cvRound(color[1].g * 255), cvRound(color[1].b * 255), cvRound(alpha * 255)),
CvScalar(cvRound(color[2].r * 255), cvRound(color[2].g * 255), cvRound(color[2].b * 255), cvRound(alpha * 255)),
@@ -297,7 +297,7 @@ private:
}
case 1:
{
-#if (CV_VERSION_EPOCH != 2)
+#if !defined CV_VERSION_EPOCH && (CV_VERSION_MAJOR >= 3)
CvBox2D box = CvBox2D(CvPoint2D32f(center.x, center.y), CvSize2D32f(r->width / scale, (r->height / scale) * 1.2), 90);
#else
CvBox2D box = {{center.x, center.y}, {r->width / scale, (r->height / scale) * 1.2}, 90};
@@ -307,7 +307,7 @@ private:
}
case 2:
{
-#if (CV_VERSION_EPOCH != 2)
+#if !defined CV_VERSION_EPOCH && (CV_VERSION_MAJOR >= 3)
CvPoint pt1 = CvPoint(r->x / scale, r->y / scale);
CvPoint pt2 = CvPoint((r->x + r->width) / scale, (r->y + r->height) / scale);
#else