def test(): print("hello") cam = astro_sensor.AstroCam(simulate="simulate.bmp") print("loaded image") img = cam.snapshot() stars, code = star_finder.find_stars(img, thresh=0, force_solve=True) print("found %u stars" % len(stars)) i = 0 while i < len(stars): s = stars[i] print("[%u]: [%.1f, %.1f, %.1f, %.1f]" % (i, s.cx, s.cx, s.r, s.brightness)) i += 1 solution = pole_finder.PoleSolution(stars, search_limit=1, debug=True) if solution.solve(): print("solved, %u matches" % len(solution.stars_matched)) else: print("failed") print("bye")
def solve(self): if self.img is None: return False self.histogram = self.img.get_histogram() self.img_stats = self.histogram.get_statistics() gc.collect() stars, code = star_finder.find_stars(self.img, hist = self.histogram, stats = self.img_stats, thresh = self.settings["thresh"], force_solve = self.settings["force_solve"]) self.expo_code = code self.stars = stars if self.expo_code == star_finder.EXPO_MEMORY_ERR: self.mem_errs += 1 if len(self.stars) > self.max_stars: self.max_stars = len(self.stars) #self.save_settings() if self.debug: print("max stars %u" % self.max_stars) return self.solve_full()
print("cam init...", end="") cam.init(gain_db=32, shutter_us=1500 * 1000) while cam.check_init() == False: print(".", end="") print(" done") print("capturing...") img = cam.snapshot() print("done") hist = img.get_histogram() stats = hist.get_statistics() stars, code = star_finder.find_stars(img, hist=hist, stats=stats, thresh=(16 * 3), guider=True) print("stars: %u , mean: %u" % (len(stars), stats.mean())) guidestar.process_list(stars, 100, [], 2) sel_star = guidestar.select_first(stars) bar_len = 10 for i in stars: r = i.r() * 2 cx = i.cxf() cy = i.cyf() cx_i = int(round(cx))