Could a computer unblur the image from an out of focus microscope?

The blurring is not randomised, it is predictable. See Can someone please explain what happens on microscopic scale when an image becomes unfocused on a screen from a projector lens? for a basic explanation.

Each point of the in-focus image is spread out into a diffraction pattern of rings called a point spread function (PSF), and these ring patterns overlap to form the out-of-focus image. The blurred image is the convolution of the object and the PSF.

Convolution is a mathematical transformation which can in some circumstances be reversed (deconvolution) - for example when the image has been made using coherent light (from a laser) and the PSF is known. When photos are taken using ordinary incoherent light, and the PSF is unknown, the blurring cannot be reversed completely, but a significant improvement can be made, eg using the blind deconvolution algorithm. Examples of objects and resulting images can be used to approximately re-construct the PSF, or a Gaussian function can be used.

Blurring due to motion (of the camera or object) can also be corrected. For both cases the techniques and problems are discussed in Restoration of De-Focussed and Blurred Images, and examples given of what can be achieved.

Software is available online to fix blurred images.


Yes, it's called deconvolution. Here are some examples of deconvolved images from microscopes:

enter image description here enter image description here enter image description here

I found these by Googling for "example of deconvolved image from a microscope".

It's possible by shooting lasers through the lens and generating a map of ray data that can be used in the deconvolution algorithm. I have also seen this done with an in focus image and deconvolved to bring a completely different plane into focus.


Yes, it can be (partially) undone, because the process is not random and only part of the information is lost.

Physics

You comment that you are interested in the physics aspect of the question, so let's first clear that up: an image is focused when every point of the object corresponds to a point of the image - all the rays emanating from a given point of the object, passing, e.g., through the lens, converge to a single point (of the sensor, be it your eyes, a CCD, or a film). An image is out of focus when that doesn't happen: when these rays are spread and each point of the image receives light from different points of the object. If you know exactly the blur took place, you can try to reverse it.

That's better explained in this answer to the question Why image is blurry or focused with convex lenses?.

Algorithms

Algorithms for blur removal must work with hypotheses on how exactly the blur took place, i.e., which function better describe it, or the blurring process model. Restoration algorithms can be found in many image processing apps, but that's still an active area of research. You can read about it here and here, among many other sources. Notice, however, that restoration is only partial e artifacts seem to be always present in the restored images.

Purposeful obscuration

If pixelation is applied, though, the image is going through coarse graining, so information is irreversibly lost, and the same is true for other forms of blurring, such as averaging and addition of noise to the image: then in general an algorithm cannot recover information from the picture, because the information is not there anymore.

But, an algorithm can guess. You can train an artificial neural network for recognizing whatever you expect or want to find in the picture, and allow it to fill in the details, as explained here and here.