def snapImageAndSave(self): """ A wrapper function that allows MappingFunctions.py to snap and save an image MappingFunctions hould be instantiated before this gets called by calling illumInit() """ MF = self.MF # snap an image with settings from the config file PC.snap(MF.ImageExposure, \ MF.ImageGain, \ MF.ImageColor, \ MF.ImageFilename)
def snapPicPNG(exposure, gain, color, filename): """ snaps an image and saves the 14bit image as an 8 bit greyscale PNG by shifting out 6 bits """ temp = PC.snap(exposure, gain, color, filename + ".raw") im = Image.new('L', (1000,1000)) pix = im.load() for i in range(1000): for j in range(1000): pix[j,i] = PC.py_14to8bit(temp, 1000*i+j) # end for # end for PC.cameraClose() # also frees up image buffer memory im.save(filename + ".png", "png")