python - Opencv VideoCapture crashing on windows xp -


i running windows xp(sp3, 32 bit) vm through oracle virtualbox.

i trying play video file using opencv2 whenever call cap = videocapture(url) crashes(that windows xp's send , dont send report pop comes).

opencv2 version 3.1.0 python version 3.4 windows xp sp3 32 bit.

anyone knows anything?

code written below.

from pil import image, imagetk import tkinter tk import argparse import datetime import cv2 import os  class application:     def __init__(self, output_path = "./"):         """ initialize application uses opencv + tkinter. displays             video stream in tkinter window , stores current snapshot on disk """         self.vs = cv2.videocapture('images/5a121d1ede80980cf28c8eb50674f661.mp4') # capture video frames, 0 default video camera         self.output_path = output_path  # store output path         self.current_image = none  # current image camera          self.root = tk.tk()  # initialize root window         self.root.title("pyimagesearch photobooth")  # set window title          # self.destructor function gets fired when window closed         self.root.attributes("-fullscreen", true)          # getting size resize! 30 - space button         self.size = (self.root.winfo_screenwidth(), self.root.winfo_screenheight() - 30)          self.panel = tk.label(self.root)  # initialize image panel         self.panel.pack(fill='both', expand=true)          # create button, when pressed, take current frame , save file          # start self.video_loop pools video sensor         # read frame         # init frames         self.frames = self.resize_video()         self.video_loop()      def resize_video(self):         temp = list()         try:             temp_count_const = cv2.cap_prop_frame_count         except attributeerror:             temp_count_const = cv2.cv.cv_cap_prop_frame_count          frames_count = self.vs.get(temp_count_const)          while self.vs.isopened():             ok, frame = self.vs.read()  # read frame video stream             if ok:  # frame captured without errors                 cv2image = cv2.cvtcolor(frame, cv2.color_bgr2rgba)  # convert colors bgr rgba                 cv2image = cv2.resize(cv2image, self.size, interpolation=cv2.inter_nearest)                 cv2image = image.fromarray(cv2image)  # convert image pil                 temp.append(cv2image)                 # simple progress print w/o sys import                 print('%d/%d\t%d%%' % (len(temp), frames_count, ((len(temp)/frames_count)*100)))             else:                 return temp      def video_loop(self):         """ frame video stream , show in tkinter """         if len(self.frames) != 0:             self.current_image = self.frames.pop(0)             self.panel.imgtk = imagetk.photoimage(self.current_image)             self.panel.config(image=self.panel.imgtk)             self.root.after(1, self.video_loop)  # call same function after 30 milliseconds  # construct argument parse , parse arguments ap = argparse.argumentparser() ap.add_argument("-o", "--output", default="./",                 help="path output directory store snapshots (default: current folder") args = vars(ap.parse_args())  # start app print("[info] starting...") pba = application(args["output"]) print("no , first") pba.root.mainloop() 

below code causes crash, 2 lines of code takes crash

import cv2 cap = cv2.videocapture('images/5a121d1ede80980cf28c8eb50674f661.mp4') 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -