I am now using the IMX8QXP-CPU Board (rev. c0) to load videos with OpenCV and simply display them.
When I load the video with cv2.VideoCapture, the size of the image is loaded correctly, but when I display it with imshow, the display is strange as shown in the attached image.
here is my code (I didn't quite understand how to make it a code block, sorry.)
import cv2
#load movie
cap = cv2.VideoCapture('RiverDance.mp4')
while True :
ret, img = cap.read()
height, width, channels = img.shape[:3]
print("width: " + str(width))
print("height: " + str(height))
cv2.imshow('Video', img)
k = cv2.waitKey(1)
if k==27: # Esc key to stop
break
I also performed image processing methods such as importing still images, displaying the imported images, exporting, grayscale conversion, Gaussian smoothing, and binarization.
It worked without any problems.
---Types of videos I've tried :
mp4, width:1280, height: 720, 59.94 fps
mp4, width:640, height: 360, 29.97 fps
mp4, width:480, height: 272, 24.0 fps
The same result was obtained for avi, mov, and mkv.
--- about OS info :
ID="fsl-imx-xwayland"
NAME="NXP i.MX Release Distro"
VERSION="4.14-sumo (sumo)"
VERSION_ID="4.14-sumo"
PRETTY_NAME="NXP i.MX Release Distro 4.14-sumo (sumo)"
--- about Python & OpenCV :
Python 3.5.5 (didn't use any virtualenv include pyenv)
[GCC 7.3.0] on linux
>>> import cv2
>>> cv2.__version__
'4.0.1'
Can anyone tell me what causes this and what the solution is?
I'm sorry to bother you, but I would appreciate your help.
thanks in advance.