我正在使用Python进行图像处理项目。我需要一个好的GUI,所以我使用PAGE生成了一个GUI。 现在我有三个.py文件:
页面生成的GUI支持文件定义用于存储GUI组件值的全局veritable。在
已生成页面GUISupport.py公司名称:
#! /usr/bin/env python
#
# Support module generated by PAGE version 4.8.6
# In conjunction with Tcl version 8.6
# Nov 16, 2016 07:58:07 AM
import sys
try:
from Tkinter import *
except ImportError:
from tkinter import *
try:
import ttk
py3 = 0
except ImportError:
import tkinter.ttk as ttk
py3 = 1
global frm #this is the global variable
frm=None
def init(top, gui, *args, **kwargs):
global w, top_level, root
w = gui
top_level = top
root = top
def destroy_window():
# Function which closes the window.
global top_level
top_level.destroy()
top_level = None
if __name__ == '__main__':
import GUI
GUI.vp_start_gui()
已生成页面图形用户界面.py. 我单独添加了一个show_frame()函数。根据this信息。在
^{pr2}$这是我用OpenCV编写的图像处理代码
import numpy as np
import cv2
import GUISupport as guis
cam=cv2.VideoCapture(0)
while 1:
_,f=cam.read()
cv2.imshow('frame',f)
guis.frm=cv2.cvtColor(f, cv2.COLOR_BGR2RGBA) #this is the variable passed using GUISupport.py
if cv2.waitKey(1) & 0xFF == ord('q'):
cv2.destroyAllWindows()
cam.release()
break
我已经运行了这个代码。但是,我得到了一个错误:
File "C:\Users\user\Documents\Visual Studio 2013\Projects\testforCAmFeed\testforCAmFeed\GUI.py", line 74, in show_frame
img = Image.fromarray(GUISupport.frm)
AttributeError: class Image has no attribute 'fromarray'
我需要将我的视频和其他变量传递给GUI模块,并需要将tkinter GUI控制器数据传递给图像处理模块。在
怎么做?在
目前没有回答
相关问题 更多 >
编程相关推荐