Modern telescopes go to great lengths to have perfectly shaped parabolic mirrors. My question is, why go to the trouble of having a perfect mirror? Why not take a mirror roughly the right shape, and then correct for the distortion using computers?
correct for the distortion
An imperfect mirror does not produce a distorted image - it produces a blurry image. With light-field sensors and phase imaging, one could possibly correct for the blur, but it is much more challenging problem than normal lens distortion correction.
Distortion refers to a systematic change in how shapes are projected in an image. It results from a lens or mirror with good, accurate geometry that just does not produce a rectilinear projection.
Random imperfections in a mirror do not cause distortion. Every point in the surface of a mirror contributes to every pixel in the result image. If a single part of the mirror is at slightly wrong angle, it does not cause a distortion in one point of the image. Instead, it projects the same image at a slightly different alignment on the same sensor. (1)
In the case of a starfield, this would cause ghost images of very dim stars to appear next to the real stars. Repeat this for a thousand imperfections, and the result is just blurry dots. Deconvolution is a process that can be used to remove blurriness, but noise and other uncertainties limit its effectiveness.
(1) This may be a bit unintuitive if you think about funhouse mirrors where the image is distorted. Those work differently because they act the part of a planar mirror, where indeed each part of image is reflected by a single part of a mirror. But planar mirrors cannot form an image by themselves, instead the lens in your eye is the critical component of the image accuracy.
Also see answers to
The problem is that light imaging detectors convert amplitude to power during the detection process. Phase is lost.
If you had maps of both the magnitude of the electric field and its relative phase, and had this at each wavelength of light, you could do exactly what you propose and correct in software.
In fact, you could then throw away the telescope and image the sky without it.
That's exactly how a radio telescope array works! Dozens of antennas detect waves from a patch of sky, they're all brought into a computer and for each wavelength the source shape is reconstructed from the amplitude and phase information available in the electronic signals.
But CCD detectors or photographic emulsion plates or our eyes convert the photons to other forms of energy, then average it out over time.
Phase is lost, so reconstruction is no longer possible.
then (I think) it is hard to deconvolve the detected image from the PSF to get the true image. For example, you don't necesserily know the exact PSF if the telescope is only "roughly" the right shape, so you don't know what to deconvolve.
The short answer is that blurring destroys information, and no amount of correction after the fact can bring it back.
A slightly less short answer: As others have mentioned, the blur caused by imperfections in the mirror is a convolution of the true image with the "point spread function" created by the imperfections.
Convolution of the image is mathematically equivalent to multiplying the Fourier transform of the image with the Fourier transform of the point spread function. Wherever the transform of that point-spread function is zero or close to it, the image information at the corresponding frequencies is destroyed.
The point-spread function created by random imperfections looks like a Gaussian distribution. The Gaussian distribution has the interesting property that its Fourier transform is also a Gaussian, centered on 0-frequency with bandwidth inversely proportional to the width of the point-spread function.
In other words, the point-spread function is a low-pass filter. It destroys the high-frequency information in the image, where all the fine detail lives. The wider the point spread, the worse it is.
They do corrections in computers. But it's not a perfect thing. Just how you can't tell the difference between 1 + 2 + 1 and 1.3 + 1.4 + 1.3, the equations we solve don't have just one solution. They have many. So we have to do guesses in the algorithm. Given that science is exploring that which is just outside of our knowledge, its useful to get actual raw data rather than having to manipulate it first.
I think my favorite example of this is the famous black hole picture from 2019. It was, of course, a computer reconstruction of the data, using software from a team headed by Katie Bouman. She has a wonderful TED talk on the technology where she points out the challenges with biasing algorithms to detect what we expect to see. One of the tools they relied on to gain confidence that the algorithm wasn't just showing them what they expected to see was to train the algorithm on pictures of her friends and faculty. If the resulting image processed after training on these pictures was basically the same as the one from generated from processing after training on pictures of known stellar objects, they were reasonably confident it wasn't bias.
But its always easier to just have better raw data.
In situations where one is using a camera to look at a brightly glowing or brightly illuminated object at relatively short range, and one can observe the object for a long time without it changing, the total amount of information present in the incoming photons will be much greater than the amount of useful information one would want in a final image. Using more photons will make it possible to reduce the level of noise in a picture, but halving the amount of noise will require roughly quadrupling the number of photons to be collected. When photons are plentiful, it's possible to produce images with far less noise than when photons are scarce, but reducing noise levels requires having a lot of photons.
It's possible to construct a digital filter to undo the effects of precisely modeled optical defects or limitations that would cause images to be blurry. Unfortunately, no matter how perfectly such a filter is constructed, using one to sharpen blurry images tends to amplify noise as much as it would amplify useful signal. The more photons one can exploit to reduce noise, the less of a problem this will be. Unfortunately, in astronomical photography, it's necessary to make due with a relatively limited number of photons. While it might theoretically be possible to use a suitably constructed digital filter to sharpen images when performing astronomical photography, the purpose of using large mirrors is to collect as many photons as possible, and much of the reason for doing that is to minimize noise. If use of a filter would double the amount of noise, and the increased noise wasn't acceptable, one would need to increase the mirror area by a factor of four to collect enough photons to compensate. Conversely, if one would be willing to tolerate a factor-of-two increase in the amount of noise present in an image, that would imply the mirror was four times as big as needed to meet the noise targets.
In short, when photons are scarce, trying to use digital sharpening filters to correct blurriness caused by imperfect optics may be possible, but achieving a certain image quality with imperfect optics would require increasing the size of the optics so much that it's less practical than simply using higher quality optics to start with.