Commit 2a8e1db7 authored by Gihan Jayatilaka's avatar Gihan Jayatilaka

Analyze bit errors

parent c30e6723
import numpy as np
import cv2
import sys
import math
def genImage(label):
frame=np.zeros((299,299,3),dtype=np.uint8)
noCellsSqrt=int(math.sqrt(len(label)))
h=cellHeight=int(frame.shape[0]/noCellsSqrt)
w=cellWidth=int(frame.shape[1]/noCellsSqrt)
for y in range(noCellsSqrt):
for x in range(noCellsSqrt):
frame[y*h:(y+1)*h,x*w:(x+1)*w,:]=label[y*noCellsSqrt+x]*255
frame=cv2.transpose(frame,-1)
return frame
if __name__ == "__main__":
print("python analyze-decoding-biterrors.py cropped.mp4 msg-bits.npz")
VIDEO_FILE=sys.argv[1]
MSG_BITS=sys.argv[2]
vidIn=cv2.VideoCapture(VIDEO_FILE)
Y=np.load(MSG_BITS)["ar"]
for f in range(len(Y)):
if not vidIn.isOpened():
break
ret,fr=vidIn.read()
if not ret:
break
cv2.imshow("Frame",fr)
cv2.imshow("Ground truth",genImage(np.reshape(Y[f],(100,))))
cv2.waitKey(0)
cv2.destroyAllWindows()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment