Ask Your Question

VideoCapture results in a skewed/slanted frame

asked 2019-08-05 10:43:38 -0500

[I tried to edit my original post "VideoCapture frame is slanted" and Askbot automatically closed it. So here it is renamed.]

I'm using cv2.VideoCapture(), which works fine with various webcams. When I use it with a TW6869 video capture chip, the video come in slanted. What I mean is that the image is tilted about 45 degrees when displayed with imshow.

I'm pretty sure that the last pixel in the first line is being repeated or moved to the first pixel of the next line. The second line has 2 pixels repeated or moved to the third, 3 to the fourth, etc. This go on for the 480 lines, so the last line has 480 pixels repeated or moved. The frame is 720x480.

The code is just:

import numpy as np
import cv2
cap = cv2.VideoCapture()
while 1:
   ret, img =
   cv2.imshow('img', img)
   k = cv2.waitKey(30) & 0xFF
   if k == 27:

I tried to crop the frame to but that didn't help.

Any help would be greatly appreciated.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-08-05 21:34:20 -0500

kiet gravatar image

Set width and height to correct size of frame. I guess that frame size could be 640x480, 720x576 or 720x480

cap = cv2.VideoCapture()
cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640)
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480)

Or you can set frame size after calling I'm not sure about opencv api.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-08-05 10:43:38 -0500

Seen: 115 times

Last updated: Aug 05 '19