lousy mirror corrected by software
There are a couple different ways this could go, depending on where in the optical train (of other powered items such as mirrors and lenses) this particular mirror is.   

In a simple case, such as when you view a "funhouse mirror," the mirror causes pure distortion, and not any defocus or aberrations.  This is easily corrected either with a mirror of opposite shape, or by remapping the image based on the distortion parameters.  Remember: distortion does NOT blur anything.  

If the mirror is in an intermediat focus plane, then you essentially have created the heart of an adaptive optic system -- albeit your mirror is not "helping" .  In this case, the mirror's shape is causing the optical wavefront (phase) to get degraded. The phase delay, which is a function of optical path length, varies across the mirror.  In this case, you will need some sort of phase sensing device, such as a Shack-Hartmann sensor, to identify the errors and possibly drive correction systems.  

I suspect your overall question is more closely related to the first of these cases, so a simple remapping will suffice.  The typical approach taken by us optickers is to image a large picture consisting of dots on a grid.  We expect the image dots to be on a rectangular grid, so when they aren't we know how much to "move" each pixel in the camera to get the correct image.