def main(): #calib = calibration.calibration(visualtion=True) base_dataset_path = os.path.join(os.getcwd(), "datasets", "test_lab6") file_name = os.path.join(base_dataset_path, "imageData.txt") image_directory = base_dataset_path drone_location = os.path.join(base_dataset_path, "drone_postion.txt") write_img_dir_path = os.path.join(base_dataset_path, "results") all_images, data_matrix = util.importData(file_name, drone_location, image_directory) all_images = all_images[:12] data_matrix = data_matrix[:12] # for i in range(0,3): # all_images[i] = all_images[i][::10, ::10, :] #all_imgs_undistorted = calib.calibrate(all_images) # stitcher = cv2.createStitcher() if imutils.is_cv3() else cv2.Stitcher_create() # (status, stitched) = stitcher.stitch(all_images) my_combiner = Combiner.Combiner(all_images, data_matrix) result = my_combiner.createMosaic() util.display("RESULT", result) if not os.path.exists(write_img_dir_path): os.makedirs(write_img_dir_path) cv2.imwrite(os.path.join(write_img_dir_path, "finalResult3.png"), result)
if os.path.isdir('results') == True: os.rename('results', 'results - ' + str(now)) os.mkdir('results') fileName = "datasets/imageData.txt" imageDirectory = "datasets/images/" print("Creating Temp Directory") if os.path.isdir('temp') == True: shutil.rmtree('temp', ignore_errors=False, onerror=None) os.mkdir('temp') print("Copying Images to Temp Directory") allImages, dataMatrix = util.importData(fileName, imageDirectory) # Perspective.changePerspective(allImages, dataMatrix) print("Sitiching Images") start = time.time() result = Combiner.combine() end = time.time() util.display("RESULT", result, 4000000) cv2.imwrite("results/final_result.jpg", result) print("Time --->>>>>", end - start) print("Done. Find your final image in results folder as final_result.jpg")
imgcols = 23 num_classes = 2 epochs = 500 batch_size = 64 ismodelsaved = True undersampling = False flpath = '/data/' # print('\n\n') print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') print('!!! PREDICTIONS ON CRISPOR !!!') print('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!') # print('\n!!! DATA PIPELINE !!!\n') loaddata = utilities.importData(flpath=flpath, encoding=str(imgrows) + 'x' + str(imgcols), sim='crispor', tl=False) x_train, x_test, y_train, y_test = train_test_split( loaddata.images, pd.Series(loaddata.target), #loaddata.target, test_size=0.3, shuffle=True, random_state=42) xtraincnn, xtestcnn, ytraincnn, ytestcnn, inputshapecnn = cnns.transformImages( x_train, x_test, y_train, y_test, imgrows, imgcols, num_classes) xtrainffn, xtestffn, ytrainfnn, ytestffn, inputshapeffn = ffns.transformImages( x_train, x_test, y_train, y_test, imgrows, imgcols, num_classes) xtrainrf, xtestrf, ytrainrf, ytestrf = mltrees.transformImages( x_train, x_test, y_train, y_test, imgrows, imgcols) # print('\n!!! TRAINING PIPELINE !!!\n')
''' Driver script. Execute this to perform the mosaic procedure. ''' import utilities as util import Combiner import cv2 fileName = "datasets/imageData.txt" imageDirectory = "datasets/images/" allImages, dataMatrix = util.importData(fileName, imageDirectory) myCombiner = Combiner.Combiner(allImages, dataMatrix) result = myCombiner.createMosaic() util.display("RESULT", result) cv2.imwrite("results/finalResult.png", result)