Skip to content

Python quit unexpectedly while using the libopencv_highgui.2.4.dylib plug-in #8305

@sushanb

Description

@sushanb
System information (version)
  • OpenCV => 2.4.13.2
  • Operating System / Platform => OS X El Capitan
  • Language: Python
Detailed description

OpenCv library with python client works perfectly for the image processing. However, it throws up error when I try to use VideoCapture method.

Steps to reproduce
import numpy as np
import cv2
import sys

cap = cv2.VideoCapture("peopleCounter.avi")

w = cap.get(3) #get width
h = cap.get(4) #get height

mx = int(w/2)
my = int(h/2)

count = 0
ret, frame = cap.read()
while(cap.isOpened()):
   ret, frame = cap.read() #read a frame
   try:
       count = count + 1
       text = "Hello World " + str(count)
       cv2.putText(frame, text ,(mx,my),cv2.FONT_HERSHEY_SIMPLEX
                   ,1,(255,255,255),1,cv2.LINE_AA)
       cv2.imshow('Frame',frame)
   except:
       #if there are no more frames to show...
       print('EOF')
       break

   #Abort and exit with 'Q' or ESC
   k = cv2.waitKey(1000) & 0xff
   if k == 27:
       break

cap.release() #release video file
cv2.destroyAllWindows() #close all openCV windows
Error messsage

screen shot 2017-03-02 at 3 44 18 am

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions