Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/visualization.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import numpy as np
import matplotlib.patches as patches
import matplotlib.pyplot as plt
import cv2


def show_frame(frame, bbox, fig_n):
fig = plt.figure(fig_n)
ax = fig.add_subplot(111)
r = patches.Rectangle((bbox[0],bbox[1]), bbox[2], bbox[3], linewidth=2, edgecolor='r', fill=False)
ax.imshow(np.uint8(frame))
ax.add_patch(r)
plt.ion()
plt.show()
plt.pause(0.001)
plt.clf()
#Adjust Color Channels of frame
frame_adjusted = np.ndarray(shape=(720,1280,3), dtype=np.dtype(np.uint8))
Copy link

@hayatibis hayatibis Aug 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line should be

frame_adjusted = np.ndarray(shape=np.shape(frame), dtype=np.dtype(np.uint8))

frame_adjusted[:,:,:] = frame[:,:,2::-1]
x, y, w, h = int(bbox[0]), int(bbox[1]), int(bbox[2]), int(bbox[3])
cv2.rectangle(frame_adjusted, (x, y), (x+w,y+h), (0,0,255), 4, 8, 0)
cv2.imshow('image',frame_adjusted)
cv2.waitKey(1)


def show_crops(crops, fig_n):
Expand All @@ -38,4 +37,4 @@ def show_scores(scores, fig_n):
ax3.imshow(scores[2,:,:], interpolation='none', cmap='hot')
plt.ion()
plt.show()
plt.pause(0.001)
plt.pause(0.001)