Ask Your Question

Revision history [back]

VideoCapture results in a skewed/slanted frame

[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 = cap.read()
   cv2.imshow('img', img)
   k = cv2.waitKey(30) & 0xFF
   if k == 27:
      break
cap.release()
cv2.destroyAllWindows()

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

Any help would be greatly appreciated.