Problem with videocapture and imshow after upgrading to opencv3

asked 2015-04-18 03:02:02 -0600

Hi everoyne,

I've been stuck with a problem concerning videocapture/imshow. The output image always is squared with part of the image attached on the right. Problem occurs since upgrading to opencv3.0.0 beta. Does anyone have a hint? Help is appreciated.

import os
import cv2

ordner = os.listdir(os.getcwd())
count = len(ordner) + 1
cap = cv2.VideoCapture(0)
h = cv2.CAP_PROP_FRAME_HEIGHT
w = cv2.CAP_PROP_FRAME_WIDTH
print h, w
nuname = "bild_" + str(count) + ".png"

while(True):
    # Capture frame-by-frame
    ret, frame = cap.read()
    if not ret :
        continue


    bunt = cv2.cvtColor(frame, 1)
    #bunt = cv2.resize(bunt, (640,480))
    cv2.imshow('bild',bunt)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        cv2.imwrite(nuname, bunt)
        print(nuname)
        cap.release()
        cv2.destroyAllWindows()
        break

image description

edit retag flag offensive close merge delete

Comments

please add your os to the question.

(can't reproduce on win)

berak gravatar imageberak ( 2015-04-18 03:12:10 -0600 )edit

Thank you, berak. os is windows 8.1 (64)

hatchetherby gravatar imagehatchetherby ( 2015-04-18 06:05:29 -0600 )edit