def bpc(self): calib = calibrator.calibrator(fresh=True, save=True) logging.getLogger("user_level_log").info( "Adjusting camera exposure time for visualisation on the scintillator" ) calib.prepare() logging.getLogger("user_level_log").info( "Calculating beam position for individual zooms") for zoom in calib.zooms: logging.getLogger("user_level_log").info("Zoom %s" % zoom) calibrator.main(calib, zoom) logging.getLogger("user_level_log").info( "Saving results into database") calib.updateMD2BeamPositions() logging.getLogger("user_level_log").info( "Setting camera exposure time back to 0.050 seconds") calib.tidy() diff = calib.get_difference_zoom_10() logging.getLogger("user_level_log").info( "The beam moved %s um horizontally and %s um vertically since the last calibration" % (str(round(diff[0], 1)), str(round(diff[1], 1)))) calib.saveSnap() logging.getLogger("user_level_log").info( "Beam position check finished")
def beamPositionCheck(self): import calibrator calib = calibrator.calibrator(fresh=True, save=True) calib.prepare() for zoom in calib.zooms: calibrator.main(calib, zoom) calib.tidy() calib.updateMD2BeamPositions() calib.updateDatabase() calib.writeTxt()
def bpc(self): calib = calibrator.calibrator(fresh=True, save=True) logging.getLogger("user_level_log").info("Adjusting camera exposure time for visualisation on the scintillator") calib.prepare() logging.getLogger("user_level_log").info("Calculating beam position for individual zooms") for zoom in calib.zooms: logging.getLogger("user_level_log").info("Zoom %s" % zoom) calibrator.main(calib, zoom) logging.getLogger("user_level_log").info("Saving results into database") calib.updateMD2BeamPositions() logging.getLogger("user_level_log").info("Setting camera exposure time back to 0.050 seconds") calib.tidy() diff = calib.get_difference_zoom_10() logging.getLogger("user_level_log").info("The beam moved %s um horizontally and %s um vertically since the last calibration" % (str(round(diff[0],1)), str(round(diff[1],1))) ) calib.saveSnap() logging.getLogger("user_level_log").info("Beam position check finished")
import numpy as np import matplotlib.pyplot as plt matplotlib.use('Agg') # OpenCV VideoCapture will not open files (although works fine with a camera) # So, its faster (and safer) to open the videos with a standard python method.... import pylab import imageio from calibrator import calibrator from frame_handler import FrameHandler from LaneTracking import LaneTracker ################ CALIBRATION - CAMERA PARAMETERS ESTIMATION ###################### cal = calibrator() # try to load camera parameters, cal.load() # otherwise do calibration if not cal.flag_calibrated: print("Camera parameters file not found. Calibrating....") if cal.fflag_calibrated == False: print( "Something went wrong during calibration. Check your calibration image paths!" ) exit(0) cal.calibrate(show_corners=False) cal.save() else: print("Camera parameters file found. Parameters successfully loaded!")