def move_picture(source, destination): if (path.exists(source) and path.exists(destination)): printlog('Image saved as ' + destination) move(source, destination) else: printlog('Error')
def take_picture(path, image, debug=False): if (debug == False): # this is only a POC placeholder routine # Cameraintegration for Basler-Cameras or other industrial cameras could be # implemented in the future with this method # e.g os.system(command) pass else: ImagePath = path + '/*' + image printlog('Waiting for Image to be taken...') while True: pic = glob.glob(ImagePath) if len(pic): printlog('Image had been taken') # sleep because otherwise the Attributes of the file are missing # and programm crashes sleep(0.1) return pic[0]
resultTemplatePath = resultFolder + '/' + templateFile sourceImagePath = sourceImageFolder + '/' + sourceImageFile resultImagePath = None # SERVICE LOOP ph.printlog('Service started....') while (True): if (os.path.exists(paramPath)): # Get Parameters params = read_csv(paramPath, header=0, delimiter=';') results = read_csv(resultTemplatePath, header=0, delimiter=';') resultPath = resultFolder + '/' + params['NAME_ANTWORTFILE'][0] + '.csv' os.remove(paramPath) lh.printlog('Proceed: ' + params['NAME_ANTWORTFILE'][0]) #Take Image (picture) image = ph.take_picture(sourceImageFolder, sourceImageFile, debug=True) #Create Image Processing Object image_test = qa.ImProc # Read Image and set ROI image_test.readImage(image_test, image, ROI_START, ROI_END) try: #Checkrule for SALs if (params['X_SAL'][0] != '<NULL>'): lh.printlog('SAL - No Check needed') colorToFind = 'nope' contours = 5 #Checkrule for Darkblue Wheels