cameraenvironment.showCalib() cameraenvironment.showResiduals() #--------------------- Calculate homography ------------------------------- #Set homography parameters hgmethod = 'sparse' #Sparse/dense homography method hgseed = [50000, 0.1, 5.0] #Seeding parameters (max. pts, quality, min. #distance) hgtrack = [(25, 25), 1.0, 4] #Tracking parameters (window size, backtracking #threshold, min. number of pts) #Set up Homography object homog = Homography(camimgs, cameraenvironment, caminvmask, calibFlag=True, band='L', equal=True) #Calculate homography hg = homog.calcHomographies([hgmethod, hgseed, hgtrack]) homogmatrix = [item[0] for item in hg] #---------------------- Detect and calculate areas ------------------------- #Define Area class initialisa colour = False #Define colour range? verify = False #Manually verify detected areas? calibFlag = True #Detect with corrected or uncorrected images maxim = 0 #Image number of maximum areal extent imband = 'R' #Desired image band
os.makedirs(destination) # Define camera environment cam = CamEnv(camdata) # --------------------- Calculate homography ------------------------------- # Set homography parameters hgback = 1.0 # Back-tracking threshold hgmax = 50000 # Maximum number of points to seed hgqual = 0.1 # Corner quality for seeding hgmind = 5.0 # Minimum distance between seeded points hgminf = 4 # Minimum number of seeded points to track # Set up Homography object homog = Homography(camimgs_start, cam, invmask, calibFlag=True, band='L', equal=True) # Calculate homography hg = homog.calcHomographyPairs(hgback, hgmax, hgqual, hgmind, hgminf) homogmatrix = [item[0] for item in hg] # ----------------------- Calculate/import lines --------------------------- # Set up line object terminus = Line(camimgs_start, cam, homogmatrix) # Used to select a file to start the tracking from start_frame = 'ReportImages/tests/' # Path from destination start_frame_name = 'IMG_3211.JPG' # File name start_frame += start_frame_name
cameraenvironment.reportCamData() cameraenvironment.showGCPs() cameraenvironment.showPrincipalPoint() cameraenvironment.showCalib() #---------------------- Calculate homography ------------------------------ #Set homography parameters hgback=1.0 #Back-tracking threshold hgmax=50000 #Maximum number of points to seed hgqual=0.1 #Corner quality for seeding hgmind=5.0 #Minimum distance between seeded points hgminf=4 #Minimum number of seeded points to track #Set up Homography object homog = Homography(camimgs, cameraenvironment, caminvmask, calibFlag=True, band='L', equal=True) #Calculate homography hgout = homog.calcHomographyPairs(hgback, hgmax, hgqual, hgmind, hgminf) #---------------------- Calculate velocities ------------------------------ #Set velocity parameters bk = 1.0 #Back-tracking threshold mpt = 50000 #Maximum number of points to seed ql = 0.1 #Corner quality for seeding mdis = 5.0 #Minimum distance between seeded points mfeat = 4 #Minimum number of seeded points to track #Set up Velocity object
#Optimise camera environment cam.optimiseCamEnv(optflag, optmethod, show) #--------------------- Calculate homography ------------------------------- #Set homography parameters hmethod = 'sparse' #Method hgwinsize = (25, 25) #Tracking window size hgback = 1.0 #Back-tracking threshold hgmax = 50000 #Maximum number of points to seed hgqual = 0.1 #Corner quality for seeding hgmind = 5.0 #Minimum distance between seeded points hgminf = 4 #Minimum number of seeded points to track #Set up Homography object homog = Homography(camimgs, cam, invmask, calibFlag=True, band='L', equal=True) #Calculate homography hg = homog.calcHomographies( [hmethod, [hgmax, hgqual, hgmind], [hgwinsize, hgback, hgminf]]) homogmatrix = [item[0] for item in hg] #----------------------- Calculate/import lines --------------------------- #Set up line object terminus = Line(camimgs, cam, homogmatrix) #Manually define terminus lines lines = terminus.calcManualLines()