LuckyPhotons
A tour of LuckyPhotons, my open source capture software for the Sun, Moon and planets
In the post Sun and Moon with my own capture software I already mentioned that after the solar eclipse I started building my own lucky imaging software. I have now published it on GitHub: https://github.com/ktrask/LuckyPhotons
In that older post I already explained why I did this, but here is a short summary of what my software is meant to do in particular:
- There is no native lucky imaging software for Linux that is open source. I used FireCapture for the solar eclipse, but it just isn’t open source.
- Autofocus on the Sun or Moon
- An automatic search feature to find and centre the Sun.
- Automatic stretching of the live view
- Automatic adjustment of exposure time and gain to make the best use of the histogram.
- While a capture is running, saving takes priority and the UI is only updated now and then
- A warning when a capture is overexposed, and automatic readjustment if you want it.
- Guiding, i.e. correcting the tracking when the polar alignment isn’t that good
- Everything should stay clear even on a small monitor (mine has 1024x600).
What is lucky imaging?
We live on Earth, and we can only live here because the Earth has an atmosphere, our air. When we take photos, the light (that is, the photons) has to pass through the air. And we have all seen the shimmer when there is a hot surface somewhere (like a fire, an oven, a radiator, an asphalt road in summer) and we look at what lies behind it. That is strong air turbulence, often also called seeing. The problem when taking photos is that the light has to pass through this turbulence. This turbulence is also the reason why stars twinkle. It means that an image can switch from sharp to blurry within a fraction of a second. Lucky imaging is exactly the method that tries to compensate for this by taking lots of images, but with a very short exposure time. And then simply hoping that, say, 10% of them are particularly sharp. That is the lucky part of lucky imaging. It works quite well as long as the turbulence isn’t too strong. Basically it is a capture method where you record videos with short exposure times, get as many frames as possible and then work statistically with the best of them. A short exposure time often means that the noise in a single frame is quite high, but that is compensated by having lots of them and combining them (stacking).
Here is an example of the full Moon in November 2026 that I captured with LuckyPhotons. I let LuckyPhotons focus, then captured 1000 frames and stacked the best 100 of them with PlanetarySystemStacker. It was also very hazy that day, so hardly any stars could be seen in the sky, but the Moon was clearly visible.
The full Moon on 24 November, stacked from the sharpest 100 of 1000 frames
For now, LuckyPhotons is purely capture software. It is inspired by lucky imaging as a concept, but it is also meant to cover all other kinds of capture where you actually want video, such as a solar eclipse. I am also thinking about building stacking right into it, but so far that hasn’t been the focus.
How is LuckyPhotons organised?
There are several stations, shown as buttons at the top of the UI, and it always opens on Connect.
Connect
This is where you connect a camera and, if you like, devices via INDI or Alpaca. I mainly use this for the mount and the autofocuser, but I have also used the filter wheel and a weather sensor that is attached through INDI. The other INDI devices partly show up, but so far they only display standard buttons.
At the moment it still mainly suggests simulators, which I used to build and test many features before trying the whole thing on real hardware.
Cameras should be connected directly, but if they are also connected via INDI, they are suggested here as well. That is much slower and not really meant for lucky imaging, but I kept it in for debugging and for testing other cameras.
The Connect station with a real frame of the full Moon from 24 November in the live view. The devices and the camera are simulators here.
Find
This station has helpers for finding a target. This is also where you choose the subject, i.e. Sun/Moon etc. The idea is that you say: Sun, and then, with a connected mount, there is a ‘Find target’ button. LuckyPhotons then knows that a Sun should be round, and searches a field with the step size you chose. If the Sun is found in the field, it gets centred. If it isn’t found, all frames are still shown once, and then you can click on the frame where, for example, a gradient from the Sun is visible, slew there and continue searching from there. Because a target search like this sometimes doesn’t quite work, there is also ‘Drive all fields’ as an alternative. It doesn’t stop when the Sun is in the frame; instead you pick the field with the Sun afterwards and slew to it manually. This also works when some round-looking artefact somewhere on the horizon was detected as the Moon and you want to find the real Moon yourself. For the target search to work, you should also have set the focal length of the telescope. The pixel size hopefully comes from the camera, and with that LuckyPhotons knows how many pixels the Sun or the Moon will be across. If not, for example with webcams, you can enter it yourself under Optics, and it is remembered for that camera.
A connected rotator can be controlled here as well, and you can set up the framing.
With a connected mount, Find also has buttons to move the mount. They are meant for fine adjustment, so holding them down doesn’t do much except repeat the step size bit by bit.
What doesn’t work at the moment is GoTo, i.e. entering a target and slewing to it directly.
Caution with the Sun: Of course you may only point at the Sun with a solar filter, otherwise you can ruin the camera very quickly. The automatic Sun search also assumes that a solar filter is fitted; without one the image would just stay overexposed. If you have a finder scope or a guide camera, you should of course cover it too, or, if you want to use it, put a solar filter on it as well. There is currently no explicit warning in LuckyPhotons, because before finding the Sun you have already done the GoTo to the Sun in another program, and all programs I know give an extra warning at that point. Should LuckyPhotons ever get its own GoTo function, there will of course be a warning there too.
The Find station: subject Moon, focal length 360 mm, field of view and step size, direction pad for the mount, »Find target« and »Drive all fields«
Focus
Focus is an important station. I also like to use it when I’m not even doing lucky imaging. Most autofocus algorithms for deep sky work with the so-called V-curve, where the star size is measured and the focuser position with the smallest star is found. That only works if you want to focus on stars and those stars are already recognised as stars. If you are far from focus, for example after changing the setup, that doesn’t help. Then I like to use the live view here and move the focuser manually until I can roughly make something out. This works particularly well during the day, when you can point the telescope at the horizon or at a distant tree. Depending on whether I use an autofocuser or focus manually, I would first focus roughly, then set ’none’ as the subject and run the autofocus. Or I would keep turning the focuser until it looks in focus to me. The focus is rated continuously even when focusing manually. For subjects that should be discs, it checks how sharp the edge is.
The Focus station: live sharpness rating with history, focuser with autofocus, on the right a zoom window onto the lunar surface
Expose
Here you can set the capture parameters such as offset/black level, and whether you capture in 8 bit or 16 bit. You can also choose a crop here. Many planetary cameras can reach much higher frame rates as soon as you only want a small region. So the frame rate can be set here as well. On the right there is a larger histogram and the option to set how much the live view should be stretched. The stretched image is never what gets captured, it is always the raw data. Stretching is on by default. You can also mark clipping, so you can see straight away where something is overexposed. Since the exposure time also changes with the filter, the filter wheel can be set here too.
The Expose station: black level, region of interest with the frame rate each one allows, »Limit frame rate«, format and filter wheel, on the right the large histogram
An overexposed frame from 27 September: with »Mark clipping« the burnt-out areas turn red
Guide
With a tracking mount, guiding isn’t necessarily much of an issue for lucky imaging. But during a solar eclipse, where with my focal length and my planetary camera I may have a margin of 100px per side, it does become a problem. Especially during the day, polar alignment isn’t that easy. That is why you can set up guiding here. LuckyPhotons first measures the mount once with guide pulses and then tries to keep tracking. Since we are not doing long exposures here, this simply works on the normal camera. It is only about compensating tracking errors, not pixel-perfect like with long exposures.
The Guide station: measure the pulses first, then start guiding
Capture
This is where you set the metadata for the capture: What should the file be called, how many frames or for how long do I want to capture?
In principle you can also plan capture sessions with several filters. But I have neglected this so far, so it isn’t really well tested yet. My goal was to automate what I did during the solar eclipse: first a time-lapse, then switch to maximum 10 min before totality, and automatically switch back to time-lapse after totality. This works by setting start and stop times under Capture and adding that as a job. But the session editor is still a bit clunky, and since there is no solar eclipse I’m currently working towards, I haven’t tested it yet. But there is another one next year, and for that I will test and improve the feature more thoroughly.
The Capture station: target, number of frames, time-lapse with start and end time, estimate of size and duration and the check before capturing. Capturing is started at the bottom right.
How do I start a capture?
In the ‘Capture’ station you only set the meta parameters; the capture itself is started with the capture button at the bottom right. Videos are saved in SER format, which is the standard format for further processing with tools like PlanetarySystemStacker and AutoStakkert.
How can I use LuckyPhotons?
There are no ready-made installers yet, because development is still at a fairly early stage. So you need to have Rust installed to use it, and how to build it is described on GitHub: https://github.com/ktrask/LuckyPhotons#building
I then start it from the repository folder:
cargo run -p lp-gui
Supported hardware
Via the INDI protocol all sorts of astro cameras are supported, but LuckyPhotons works best with native camera drivers. At the moment those are mainly cameras with the standard Linux webcam driver, but also ZWO and Touptek cameras. My Omegon veTEC is actually a Touptek camera, so all kinds of rebranded cameras work as well. For ZWO I have only tested my monochrome guide camera, so I can’t guarantee that other cameras work well too. But I would be grateful for any feedback on tested cameras; I will maintain the list on GitHub.
In general I’d be happy about feedback: What works for you, what should work, which cameras have you tested? Other contributions such as pull requests are welcome too.
Open points
I would like to add a two-camera mode. Not necessarily to capture with two cameras in parallel, but during the solar eclipse I used a small wide-angle camera as a finder camera, because the Sun was definitely in its view, and that let me see how well I was actually searching the field. With an automatic routine you could measure the offset between the main camera and the finder camera once and then get the Sun into the field faster.
Filter automatically while saving during lucky imaging and only save frames that reach a minimum quality/sharpness at all. That reduces the load on the disk and saves storage space.
What to do with a solar eclipse and a slow storage medium? Around the total phase I actually want to capture at the highest possible frame rate and not throw away any frames, as you would in real lucky imaging.
More camera drivers. So far I have mainly implemented Touptek and ZWO cameras, because I have examples for them. But even for ZWO colour cameras I don’t know whether debayering works correctly, because I haven’t had one to test yet.
Plate solving at night to slew to the target more accurately.
GoTo for mounts that support it, to slew to a target directly.
Start the INDI server directly from LuckyPhotons. At the moment I always start my KStars/Ekos session, disconnect the main camera and then connect it in LuckyPhotons. That works well for me because I do deep sky imaging with Ekos anyway, but for someone who doesn’t use it, it would probably be good to be able to set everything up here directly.
Web interface and remote control
An ‘interesting frames’ function for time-lapse: you stream at maximum frame rate, and if one of the 30 frames is suddenly different, it is saved in addition. That way I would have caught all the frames with the aeroplane during the solar eclipse.
Windows and Mac support. I only use Linux, but I could certainly try LuckyPhotons on a Windows machine at some point. I don’t have a Mac, though, so I can’t really cater for it right now.
Better advance planning of capture sessions.
Live stacking of real lucky imaging sessions, so that you don’t need a second step at all to get the final image.
Miscellaneous
Since I started, it has become a trend that software created with the help of LLMs is built in Rust, so I’m almost embarrassed to say that I built this software in Rust mostly with Claude Code.
A lot of bad software is being created right now along the lines of ‘I built this’, when in fact an LLM did it. Many of these programs are of dubious quality or are just published without any intention of maintaining them in the long run. And software like that is springing up like mushrooms right now. Since Rust is very often used for it, this bad, vibe-coded Rust software is already a meme.
But here I mainly specified what the software should do and how exactly things should work, and verified that it does what it should and works the way I imagine. For some features, like the automatic Sun search, it was quite tedious to have to explain every single bug and every wrong assumption to the LLM one by one. But I have to say that I would never have invested the time in this project if I had had to write every line of code myself.
This post was translated automatically from German.