Home>

In the code below

Why do I get an error displaying the video? ?

import cv2
import numpy as np
from matplotlib import pyplot as plt

cap = cv2.VideoCapture ('move1.mp4')
while (cap.isOpened ()):
    ret, frame = cap.read ()

# Set corresponding points before and after conversion
    p_original = np.float32 ([[247,388], [805,408], [17, 833], [1063, 860]])
    p_trans = np.float32 ([[0,0], [500,0], [0,690], [500,690]])
# Transformation matrix and projective transformation
    M = cv2.getPerspectiveTransform (p_original, p_trans)
    i_trans = cv2.warpPerspective (frame, M, (500, 690))


    show = cv2.cvtColor (i_trans, cv2.COLOR_BGR2RGB)
    cv2.imshow (show)



    if cv2.waitKey (1)&0xFF == ord ('q'):
        break


cap.release ()
cv2.destroyAllWindows ()

Error text

Traceback (most recent call last):
  File "syaei.py", line 26, in<module>
    cv2.imshow (show)
TypeError: imshow () missing required argument 'mat' (pos 2)