Home>
An error occurs in the code for projective transformation of the following video.
Why is that? ?
By the way, usually there are many examples where projective transformation is just a still image, but is it possible for a movie? ?
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 ('syaei', show)
if cv2.waitKey (1)&0xFF == ord ('q'):
break
cap.release ()
cv2.destroyAllWindows ()
This is an error statement
File "syaei.py", line 20, in<module>
i_trans = cv2.warpPerspective (frame, M, (500, 690))
cv2.error: OpenCV (4.1.1) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/imgwarp.cpp:2886: error: (-215: Assertion failed) _src.total ( )>0 in function 'warpPerspective'
-
Answer # 1
Related articles
- python - i don't see the error in the face cropping program with opencv
- python - i got an error in opencv
- python - program error removal with opencv tracker
- python - i get an error when connecting to a voice channel with discordpy
- python - categorical_crossentoropy error does not resolve
- readcsv error in python
- python - i want to display an image with pysimplegui, but an error occurs
- python - error when scraping with selenium and firefox
- [python] graphviz output format error
- python - the py file cannot be executed in the task scheduler 0x2 error
- python 3x - best estimator: i get an error with no syntax, so please tell me what to do
- python - error in image binarization using cv2adaptivethreshold function
- [python] i don't know how to solve the error
- python - an error has occurred in yolo v3
- python - idle cannot resolve the "rootgeometry" error
- python - tuple error does not resolve
- python max () arg is an empty sequence and an error occurs and it cannot be processed well
- python 3x - error after changing to csv file
- python - in raspberry pi, the error occurs only in the case of the automatic start program using systemd
- python - an error occurs in the if statement program that compares the size of numbers
I didn't have to worry about errors