def start_camera(self): self.camera = uc480.camera() self.camera.AllocImageMem() self.camera.SetImageMem() self.camera.SetImageSize() self.camera.SetColorMode() self.camera.CaptureVideo() self.camera.CopyImageMem() self.image = QtGui.QImage(self.camera.data.ctypes.data, self.camera.width,self.camera.height,QtGui.QImage.Format_Indexed8) color_table = [QtGui.qRgb(i,i,i) for i in range(0,256)] self.image.setColorTable(color_table) self.setBackgroundBrush(QtGui.QBrush(self.image.scaledToHeight(self.height()))) self.timer.start(100)
def init(): global imgIndex # figure out how many images we have already from today files = glob.glob(imgDir + imgRoot() + '.*.???') if files: maxnum = max(map(lambda x: int((x.split('.'))[1]), files)) imgIndex = maxnum + 1 print 'Starting file list at index ' + str(imgIndex) # create the ThorLabs camera camera = uc480.camera() camera.AllocImageMem() camera.SetImageMem() camera.SetImageSize() camera.SetColorMode() camera.SetPixelClock(20) camera.SetGamma(160) if 0: camera.SetGain(1) camera.SetExposureTime(10) camera.SetFrameRate(20) else: camera.SetGain(1) camera.SetExposureTime(2) camera.SetFrameRate(20) #camera.SetGainBoost() camera.CaptureVideo() cv2.namedWindow("UberCam", cv2.cv.CV_WINDOW_AUTOSIZE) return camera
def setUp(self): self.camera = uc480.camera()
def test_init(): camera = uc480.camera() camera.ExitCamera()