calibration.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:pynephoscope 作者: neXyon 项目源码 文件源码
def __init__(self):
        if len(sys.argv) < 2:
            print('Usage: calibration <directory> [<filename>]')
            print('The supplied directory should contain the calibration images.')
            sys.exit(1)

        size = 640

        self.path = sys.argv[1]
        self.image_window = 'Image Calibration'
        self.sky_window = 'Sky Calibration'
        self.tb_image_switch = 'image'
        self.tb_max_mag = 'maximum magnitude'
        self.save_file_name = 'data'
        self.selected_star = None
        self.selected_color = (0, 0, 255)
        self.marked_color = (0, 255, 0)
        self.circle_radius = 5
        self.max_mag = 4
        self.renderer = SkyRenderer(size)

        try:
            self.calibrator = Calibrator(SkyCameraFile.glob(self.path), EarthLocation(lat=Configuration.latitude, lon=Configuration.longitude, height=Configuration.elevation))
        except Exception as e:
            print(e.message)
            sys.exit(2)

        if len(sys.argv) > 2:
            self.save_file_name = sys.argv[2]
            if os.path.exists(self.save_file_name):
                self.calibrator.load(self.save_file_name)

        cv2.namedWindow(self.image_window, cv2.WINDOW_AUTOSIZE)
        cv2.namedWindow(self.sky_window, cv2.WINDOW_AUTOSIZE)

        self.selectImage(0)

        cv2.setMouseCallback(self.image_window, self.imageMouseCallback)
        cv2.setMouseCallback(self.sky_window, self.skyMouseCallback)
        cv2.createTrackbar(self.tb_image_switch, self.image_window, 0, len(self.calibrator.files) - 1, self.selectImage)
        cv2.createTrackbar(self.tb_max_mag, self.sky_window, self.max_mag, 6, self.setMaxMag)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号