From 7e2652eace4f443b6a01f006b420e91128f0bb7a Mon Sep 17 00:00:00 2001
From: natanielruiz <nataniel777@hotmail.com>
Date: 星期一, 04 九月 2017 03:25:59 +0800
Subject: [PATCH] Before modifying dataset loading for data augmentation.

---
 code/test_on_video.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/code/test_on_video.py b/code/test_on_video.py
index 20dfaac..ca17ccd 100644
--- a/code/test_on_video.py
+++ b/code/test_on_video.py
@@ -123,6 +123,14 @@
             sys.exit(0)
 
         x_min, y_min, x_max, y_max = int(line[1]), int(line[2]), int(line[3]), int(line[4])
+        x_min -= 100
+        x_max += 100
+        y_min -= 200
+        y_max += 50
+        x_min = max(x_min, 0)
+        y_min = max(y_min, 0)
+        x_max = min(frame.shape[1], x_max)
+        y_max = min(frame.shape[0], y_max)
         # Crop image
         img = frame[y_min:y_max,x_min:x_max]
         img = Image.fromarray(img)
@@ -145,6 +153,8 @@
         # Print new frame with cube and TODO: axis
         txt_out.write(str(frame_num) + ' %f %f %f\n' % (yaw_predicted, pitch_predicted, roll_predicted))
         utils.plot_pose_cube(frame, yaw_predicted, pitch_predicted, roll_predicted, (x_min + x_max) / 2, (y_min + y_max) / 2, size = 200)
+        # Plot expanded bounding box
+        cv2.rectangle(frame, (x_min, y_min), (x_max, y_max), (0,255,0), 3)
         out.write(frame)
 
         frame_num += 1

--
Gitblit v1.8.0