def get_frame(nEvent, ctx): if nEvent == TOUPCAM_EVENT_IMAGE: w, h = ctypes.c_uint(), ctypes.c_uint() ''' :param HToupCam: handle to cam :param pImageData: (void*) Data buffer. :param bits: (int) 24, 32 or 8, means RGB24, RGB32 or 8 bits grey images. This parameter is ignored in RAW mode. :param pnWidth: (unsigned*) width of image. :param pnWidth: (unsigned*) height of image. ''' lib.Toupcam_PullImage(self.cam, ctypes.c_void_p(self._data.ctypes.data), bits, ctypes.byref(w), ctypes.byref(h)) print( f"TOUPCAM_IMAGE_EVENT- width:{w.value}, height:{h.value}; data-length:{len(self._data)}; data-shape:{self._data.shape}; bitdepth:{bits.value}; dtype:{dtype}" ) elif nEvent == TOUPCAM_EVENT_STILLIMAGE: w, h = self.get_size() h, w = h.value, w.value still = zeros((h, w), dtype=uint32) lib.Toupcam_PullStillImage(self.cam, ctypes.c_void_p(still.ctypes.data), bits, None, None) self._do_save(still)
def get_frame(nEvent, ctx): 'callback function, to be stored in _frame_fn' #ctx is not used if nEvent == TOUPCAM_EVENT_STILLIMAGE: w, h = self.get_size() h, w = h.value, w.value still = np.zeros((h, w), dtype=np.uint32) lib.Toupcam_PullStillImage(self.cam, ctypes.c_void_p(still.ctypes.data), None, None, None) # lib.Toupcam_PullStillImage(handle,void_pointer_pImageData, # int bits,unsigned pointer pnWidth,unsigned pointer pnHeight) self._do_save(still)
def get_frame(nEvent, ctx): if nEvent == TOUPCAM_EVENT_IMAGE: w, h = ctypes.c_uint(), ctypes.c_uint() lib.Toupcam_PullImage(self.cam, ctypes.c_void_p(self._data.ctypes.data), bits, ctypes.byref(w), ctypes.byref(h)) elif nEvent == TOUPCAM_EVENT_STILLIMAGE: w, h = self.get_size() h, w = h.value, w.value still = np.zeros((h, w), dtype=np.uint32) lib.Toupcam_PullStillImage(self.cam, ctypes.c_void_p(still.ctypes.data), bits, None, None) self._do_save(still)
def get_frame(nEvent, ctx): #print("getting frame") if nEvent == TOUPCAM_EVENT_IMAGE: w, h = ctypes.c_uint(), ctypes.c_uint() lib.Toupcam_PullImage(self.cam, ctypes.c_void_p(self._data.ctypes.data), bits, ctypes.byref(w), ctypes.byref(h)) if self._master is not None: self._master.update_image() elif nEvent == TOUPCAM_EVENT_STILLIMAGE: w, h = self.get_size() h, w = h.value, w.value still = zeros((h, w), dtype=uint32) lib.Toupcam_PullStillImage(self.cam, ctypes.c_void_p(still.ctypes.data), bits, None, None) self._do_save(still) if self._master is not None: self._master.update_image()