]> rtime.felk.cvut.cz Git - hercules2020/kcf.git/commitdiff
Extracted rotated output rectangle from rotation
authorShanigen <vkaraf@gmail.com>
Fri, 5 Oct 2018 10:00:22 +0000 (12:00 +0200)
committerShanigen <vkaraf@gmail.com>
Fri, 5 Oct 2018 10:00:22 +0000 (12:00 +0200)
main_vot.cpp
src/kcf.h

index 27c776fd8644646c6c01bfdeb15fc7510159f61e..32e54542db5bbdf5aa17cf5e30b8a46ed4fb5adc 100644 (file)
@@ -180,7 +180,15 @@ int main(int argc, char *argv[])
         std::cout << std::endl;
 
         if (visualize_delay >= 0) {
-            cv::rectangle(image, bb_rect, CV_RGB(0,255,0), 2);
+            cv::Point pt(bb.cx, bb.cy);
+            cv::Size size(bb.w, bb.h);
+            cv::RotatedRect rotatedRectangle(pt, size, bb.a);
+
+            cv::Point2f vertices[4];
+            rotatedRectangle.points(vertices);
+
+            for (int i = 0; i < 4; i++)
+                cv::line(image, vertices[i], vertices[(i + 1) % 4], cv::Scalar(0, 255, 0), 2);
             cv::imshow("output", image);
             int ret = cv::waitKey(visualize_delay);
             if (visualize_delay > 0 && ret != -1 && ret < 128)
index f537ccad0dc74611860534bd1b16ee48450a1113..99719e9bf086927baa5d74d1f97412e73e662644 100644 (file)
--- a/src/kcf.h
+++ b/src/kcf.h
@@ -22,7 +22,7 @@ struct ThreadCtx;
 
 struct BBox_c
 {
-    double cx, cy, w, h;
+    double cx, cy, w, h, a;
 
     inline cv::Point2d center() const { return cv::Point2d(cx, cy); }