【发布时间】:2018-05-18 05:15:12
【问题描述】:
我有 2 个单独的文件,每个文件都定义了自己的类。
文件 1:
class AndorCameraSDK:
def __init__(self):
self.count = 0
def LiveAcquisition(self,nframes,np.ndarray[np.unit16_t,ndim = 3,mode = 'c']image:
cdef unsigned char * pBuf #This has the data
#.......Initialisation of parameters..............#
for i in range(nframes):
pBuf = <unsigned char *>calloc(sizeinBytes,sizeof(unsigned char)
#-----Storing the data in pBuf into a 3-D array image....#
pus_image = <unsigned short*> pBuf
for j in range(self.width):
pus_image = <unsigned short*> pBuf
for k in range(self.height):
image[i][j][k] = pus_image[0]
pus_image += 1
_puc_image += self.stride
def function1(self):
#Something else to be done with another function
在文件 2 中
import AndorCameraSDK as andorcamera
class AndorCameraGUI:
def __init__(self):
#Making use of Tkinter couple of widgets has been created, which includes a button named LiveImage which calls the function LiveImageGUI.
def LiveImageGUI (self):
self.camera = andorcamera()
#define a 3D array I
self.camera.LiveAcquisition(nframes,I) #called from File 1
def LivePlot(self)
# A function using FigurecanvasTkAgg to display the image processed from LiveAcquisition in the display area defined in the GUI panel
我想要达到的目标:
- 将
pBuf存储到 3D 数组中的 for 循环必须是同一内部线程调用的函数。 - 此函数应调用文件 2 中的
LivePlot函数,以便在 GUI 中显示存储的图像帧。 - 这两种情况都应该发生,以便在处理
(i+1)st 帧时,显示ith 帧,以免出现时间延迟。
有人可以帮我解决这个问题吗? 非常感谢任何帮助。
【问题讨论】:
标签: python multithreading tkinter