def download_batman(path = '/squids_tmp'): '''Download BATMAN-Advanced to the specified PATH and unpack. ARGS: @path -- The absolute path to the directory in which the package should be placed RETURN: None ''' import sys sys.path.append('..') from file_manipulation import extract from urllib import urlretrieve bat_path = path + '/batman-advanced-2015.1.tar.gz' urlretrieve('http://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2015.1.tar.gz', bat_path) extract.extract(bat_path)
# file_path = r'./graph/' images = os.listdir(file_path) # print(images) sum_valid, sum_total = 0, 0 for image in images[:200]: if image[-4:] != '.png': continue # print(image) src = cv2.imread(file_path + '/' + image, 0) # print(src.shape) src = cv2.blur(src, (3, 3)) # theta = ae.Direction_estimate(src) theta = [1024, 1024] # theta = [99999, 99999] retImg, centers, cnt = ex.extract(src.copy(), theta) # plt.imsave('./{}_extract1.png'.format(image),retImg, cmap = 'gray', vmin = 0, vmax = 255) reals = np.load(file_path + '/' + '{}.npy'.format(image[:-4])) reals[:, [0, 1]] = reals[:, [1, 0]] # print('{}.npy'.format(image[:-4])) centers = centers[:cnt, :2] valid, total = 0, reals.shape[0] for center in centers: for real in reals: if np.linalg.norm((center - real)) < 5: # print(center, real, np.linalg.norm((center - real))) valid += 1 break sum_valid += valid
from extract.extract import extract, descompactar from datetime import datetime from transform.transform import transform import schedule import time directory = '/home/levis/Downloads' dh_inicio = datetime.now() extract(directory) time.sleep(1) descompactar(directory) time.sleep(1) transform(directory) dh_final = datetime.now() print(f'O ETL iniciou às {dh_inicio} e finalizou às {dh_final}.')
if __name__ == "__main__": # 读文件 # filename = r'./zl/9-2.png' filename = r'./graph/test_5_1.png' src = cv2.imread(filename, 0)[:2048, :2048] # 估计旋转中心 src = cv2.blur(src, (3, 3)) rot_center = est.Direction_estimate(src) print('Rcenter:', rot_center) # rot_center = [999999999, 999999999] # 星点提取、质心定位 retImg, centers, cnt = ext.extract(src.copy(), rot_center) centers = centers[:cnt] print('Stars:', cnt) # 星图识别、姿态解算 att, starId = iden.identify(centers) print('Attitude:', att) starId = starId[np.where(starId >= 0)] # 重投影 retImg, iden = iden.reProjection(retImg, att, centers) print('Identified:', iden) # 显示 plt.figure()