Py2exe with OpenCV creating empty image

98 views
Skip to first unread message

Marcos del Amo

unread,
Mar 16, 2017, 11:26:35 AM3/16/17
to wxPython-users
Here is my python code:

import os
import cv2
import glob


if __name__ == '__main__':
procs = []
v_files = glob.glob(os.path.abspath(os.path.join("""Put your complete path to folder with mp4 videos here""", '*.mp4')))
for index in range(len(v_files)):
    cap = cv2.VideoCapture(v_files[index])
    cap.set(1, 150)
    ret, frame = cap.read()
    cv2.imwrite(v_files[index].split(".")[0] + '.mp4.jpg', frame)

Which works fine as a python file, it goes to the folder, takes the videos and then creates a jpg for each video file on the same folder but when I use py2exe and execute the program it creates empty .jpgs (0 k).

Here is the setup file:


# -*- coding: utf-8 -*-
from distutils.core import setup 
import py2exe 
import numpy

setup(name="r.py",
 description="Test thumbnail", 
 author="Angrod", 
 windows=["r.py"],
 #console=["r.py"],
 options={"py2exe": {
                "includes": ["numpy","cv2"],
                "bundle_files": 3,
                "dll_excludes": ["oleaut32.dll","user32.dll","comctl32.dll","shell32.dll","kernel32.dll","winmm.dll","wsock32.dll","comdlg32.dll","advapi32.dll","crypt32.dll","ws2_32.dll","winspool.drv","gdi32.dll","ole32.dll","msvcp90.dll","rpcrt4.dll,_scproxy","opencv_ffmpeg.dll"]
                }
     }, 
 zipfile=None,
)

I've tried cx_Freeze 5.0.1 and py2exe but got the same problem with both of them.

Thanks for the help!



Reply all
Reply to author
Forward
0 new messages