Submitted by so-gold t3_117npc4 in askscience

Let’s say you take a photo and then digitally blur it in photoshop. The only possible image that could’ve created the new blurred image is your original photo right? In other words, any given sharp photo has only one possible digitally blurred version.

If that’s true, then why can’t the blur be reversed without knowing the original image?

I know that photos can be blurred different amounts but lets assume you already know how much it’s been blurred.

1

Comments

You must log in or register to comment.

SlingyRopert t1_j9dtray wrote

Unblurring an image is conceptually similar to the following story problem:

Bob says he has three numbers you don’t know. He tells you the sum of the numbers is thirty-four and that all of the numbers are positive. Your job is to figure out what those the numbers are based on the given information. You can’t really. You can make clever guesses about what the numbers might be based on assumptions, but there isn’t a way to know for sure unless you get additional information. In this example, thirty four represents the image your camera gives you and the unknown numbers represent the unblurred image.

In practice, there is a continuum of situations between images that can’t be unblurred and images that can be usefully improved. The determining factor is usually the “transfer function” or Linear translation invariant representation of the blurring operator applied to the image. If the transfer function is zero or less than 5% of unity at some spatial frequencies, the portions of the image information at these spatial frequencies and above is probably not salvageable unless you make big assumptions.

An equation called the Wiener filter can help you figure out which spatial frequencies of an image are salvageable and can be unblurred in a minimum squared error sense. The key to whether a spatial frequency can be salvaged is the ratio of the amount of signal (after being cut by the transfer function of the blur) to the amount of noise at that same spatial frequency.

When the signal to noise approaches one to one, you have to give up on unblurring that spatial frequency in the Wiener filter / unbiased mean squared error sense because there is no information left. This loss of information is what prevents unbiased deblurring.

If you are ok with having “biased” solutions and making some “big assumptions” you can often do magic though. For instance, you could assume that the image is of something that you have seen before and search a dictionary of potential images to see which one would (after blurring) look the most like the image you received from the camera. If you find something whose blurred image matches you could assume that the unblurred corresponding image is what you imaged and nobody could prove you wrong given the blurry picture you have. This is similar to what machine learning algorithms do to unblur an image by relying on statistical priors and training. You run the risk with this sort of extrapolation that the resulting unblurred image is a bit fictitious.

I personally recommend being cautious with unblurring using biased estimators due to the risk of fictitious imagery output.

It is always best to address the blur directly and make sure that you don’t apply a blur so strong that the transfer function goes to near zero.

78

Bax_Cadarn t1_j9g9qhy wrote

>lets assume you already know how much it’s been blurred.

the poster seemed to consider a situation when they know precisely how the image was blurred lol. Is it possible then?

​

Like x+y=3, if You know y =1, can You know x if x is the blurred image?

3

Training_Ad_2086 t1_j9gfmf5 wrote

Likely not if every pixel is blurred.

In that case all original pixel values are lost and replaced by blur pixel values.

Since every original pixel is blurred there is no information to extrapolate from for a undo and so knowing the method is useless.

Its like listening to music on a old telephone, you can make out the sound but all the details of the sound can't be recovered from the audio you are listening to

3

Bax_Cadarn t1_j9ggwpb wrote

Um, maybe this will explain what I think they mean.

Say the picture is one dimensional. There are also only 10 colours. Blurring is moving the colour in some way.

Picture:0137156297 Blurring:11111(-1)(-1)(-1)(-1)(-1)

Blurred:1248245286

Now lnowing both bottom lines, can You figure the top?

1

Training_Ad_2086 t1_j9gi7c1 wrote

Well what you described isn't really a blur function (it'd be a brightness shift). But if we want to call it that then yes it is reversible there.

There are several other mathematical operations you can do that are just reversible like that. However none of them are anywhere close to actual blur functions.

3

The_Hunster t1_j9i7uwt wrote

Given 1 dimensional images again. Is blurry more like taking the image "2,3,4" and turning them all to the average "3,3,3"? Which could of course be "1,3,5" or "4,3,2". Meaning you lose the original information. Would that be a good example of a blur function?

2

MagiMas t1_j9j8gtn wrote

Yes, but it's usually done with a moving average.

So if you have the pixel values 1,3,2,4,3,1,5,2 you could always average in groups of three

1,3,2 => 2
3,2,4 => 3
2,4,3 => 3
4,3,1 => 2.66
3,1,5 => 3
1,5,2 => 2.66

so the blurred image is

2,3,3,2.66,3,2.66

An actual blur filter is usually a bit more complex, a gaussian blur for example weights the original pixels in different amounts (according to a gaussian curve). So instead of just taking the average of 1,3,2 you'd calculate

0.25 * 1 + 0.5 * 3 + 0.25 * 2 = 2.25

And you can choose how broad you want to make the window of values that you consider in the operation etc.

Crucially, if we write the simple blurring operation from the top as a set of equations with the original pixel values unknown and named as x_i:

(x_1 + x_2 + x_3) / 3 = 2
(x_2 + x_3 + x_4) / 3 = 3
(x_3 + x_4 + x_5) / 3 = 3
(x_4 + x_5 + x_6) / 3 = 2.66
(x_5 + x_6 + x_7) / 3 = 3
(x_6 + x_7 + x_8) / 3 = 2.66

you can see that we have 8 unknown values but only 6 equations. If you remember the maths of systems of equations from school we need 8 equations to fully determine 8 unknowns. So this problem is under-determined even in a case of such a simple blurring operation where we know exactly which kind of operation was done to the original image. In a more realistic scenario, where we don't know the exact type of blurring operation done to an image, it gets even less feasible to reverse the operation without somehow using prior knowledge of how unblurred content usually looks like (which is what neural networks are doing when they are used to scale up and unblur small images).

3

SlingyRopert t1_j9ghtzw wrote

There’s a whole bunch of special cases but I tried to target the case where you know exactly how it is blurred but the blurred version you have has additional noise. It is this additional noise that does you in. My example also could if explicitly brought in the blurring into the equation example and brought in the convolution nature:

Let’s think about a one dimensional deblurring problem where we measure just two blurred pixels. The left one is 34 and the right one is 27. Suppose we exactly know the blur (in kernel form) is three pixels wide and the blur has values A, B, C. If w,x,y,z is the unblurred image then

Aw + Bx + C*y + N= 34 and

Ax + By + C*z + M = 27

where N and M are small random numbers (noise in the pixel measurement).

To estimate the middle two pixels of the unblurred image, you have to solve the above equations for x and y. You only know A B and C but you (often) can assume that w, x,y,z are zero or positive and that N and M are fairly small. Even if you are really good at linear algebra, solving the above two equations for the two to six unknowns is il-posed.

If you get enough pixels (say more than the width of the blur), you can get away from having to solve for edge pixels like w and z and you can get approximate solutions like using the Wiener filter.

I have been assuming you know the blur and that the blur is the same everywhere in the image. If the blur is not the same over the image, the linear algebra tricks that make the Wiener filter don’t work and you have to selectively apply them over small enough patches that they still sort of work.

If you do not know the blur, it’s strong assumption time (also called “blind deconvolution”) and you need to consult a professional with details about your inverse problem to see how well it can be solved.

2

dmmaus t1_j9du3dw wrote

> Let’s say you take a photo and then digitally blur it in photoshop. The only possible image that could’ve created the new blurred image is your original photo right?

No, that's not correct. Many different images could give you the same blurred image.

When you blur an image, fine detail below a certain scale is lost. If two images are the same at large scales, but different in the fine details below the scale where the blur filter removes them, and you blur them, you won't be able to tell the difference. So you can't decide which of the two images you started with. You can make a guess, but given there are infinitely many images that will blur to the same blurred result, you are likely to be wrong.

76

Krillin113 t1_j9o8gj1 wrote

Isn’t a blur filter just a predetermined set of vectors where each pixel is moved according to the corresponding vector? I assume if I blur the same picture twice I’d end up with two pictures that are identical, ie the same blurring effect occurred.

If I know what was moved in which direction, u should be able to inverse that and end up with the original picture no? So unless blurring filters aren’t deterministic or I don’t have the ‘key’ to what happened I should be able to do it right?

2

dmmaus t1_j9qji0l wrote

No, that's not quite right. If you blur the same picture twice using the same blur filter, then yes, you end up with the same final image. But that's not the same as saying that if you blur two different pictures you end up with two different images. Two different pictures blurred with the same filter can end up being identical blurred images.

You can think of a blur filter as a set of vectors that move pixel information around, but the step you're missing is that the pixel information isn't moved to just one other pixel. It's spread around over several neighbouring pixels, and then added together with the information spread from other pixels that overlaps it. That adding together operation muddies the waters, so to speak - once the blurred pixel info is added together to form the final blurred image, you can't work out how to un-add them to separate them again. There will be multiple possible solutions to the problem of going backwards to an unblurred image, and no way to decide which is the correct solution.

2

Bewaretheicespiders t1_j9e3k3x wrote

Hi, I have a master in computer vision, let me explain.

If you put it in terms of signal processing, bluring is what we call a "low-pass" filter. It conserves low-frequencies, but deletes high frequences. Looking at the image in the frequency domain using a fourier transform makes that obvious. So thats why you can't unblur them. The information is gone. Its like erasing part of an image, except in frequency space.

Some machine learning methods can sharpen an image. Understands that they do not recover the information that was lost. Instead they make an "educated guess" of what the lost information might have been.

> The only possible image that could’ve created the new blurred image is your original photo right

No, its not, and hence the problem.

6

guitarhead t1_j9g1qa5 wrote

What you're describing is 'deconvolution' and there exists algorithms designed to do exactly this (see for example, Richardson-Lucy deconvolution). However, you need to either know or make some assumptions about the 'blur' for it to work.

There is software that Canon releases for high-end cameras and lenses that does something similar. Becuase they know exactly the type of blur that their lenses create at different points on the frame for different focal distances, they use this information to remove some of that lens blur from the digital image. Canon call this 'digital lens optimizer'. See here and here for more info.

2

paleblueyedot t1_j9dtlsb wrote

> The only possible image that could’ve created the new blurred image is your original photo right?

Is this true? It seems counterintuitive that a gaussian blurred image A' couldn't be created by both A and B.

Maybe you're right though. See this.

1

mfb- t1_j9e1hrp wrote

It's not true for real images (with a finite number of pixels and colors).

6

slashdave t1_j9e4c45 wrote

>The only possible image that could’ve created the new blurred image is your original photo right?

No. Just consider the extreme. What if you blurred an image so much that it turned into a solid color?

6

rjolivet t1_j9gimkz wrote

Bluring is not a bijective function. Meaning two different images could give the same blurred one. Some information is lost.

This said, some IA models are specifically trained to unblur images : they don't get back the lost information but only make up a possible sharp images that could have resulted to the blurred one, based on what it saw before.

The results are quite impressive.

https://ai.smartmine.net/service/computer-vision/image-deblurring

1

S-Markt t1_j9ppo31 wrote

it depends on how it is blurred. if they used the same procedure for every pixel, it can be reversed, it is even possible to write a program that finds out, how it is blurred.

but if you tell the program to use a random seed (0-5 for example, every time it blurrs one pixel, this new pixel has got a different base.

1

hatsune_aru t1_j9owuz6 wrote

Most of the people here are wrong. It is possible to un-blur an image within reasonable fidelity, provided that you know how the blur was done (i.e. which method, what the parameters for the method were, etc).

The naive way of blurring an image basically averages the input pixels from its neighbors and outputs it on the output. This is a reversible process, provided you know how the averaging window was created.

The averaging window can also be estimated to potentially get a "good enough" reproduction of the image before it was blurred.

0

loki130 t1_j9qm08v wrote

In the extreme case, if you take an entire image and average it to a single color, clearly you can't reconstruct any detail from that no matter how clearly you know the algorithm. I think a similar argument could be made that a large image split into 4 quadrants that are each completely averaged would also be unrecoverable. Perhaps there is some floor of smaller blur radius where the image becomes recoverable, but I don't think it's obvious that knowing the blur process always allows reversal.

1

hatsune_aru t1_j9qmunn wrote

I like to think of that extreme example as "edge effects". Obviously there are limitations to the recovery technique, but "deblurring" is absolutely a thing both in imaging and similarly in non-imaging applications.

https://en.wikipedia.org/wiki/Blind_deconvolution

In a sense, electronic engineering (which I can say I'm a specialist in) concepts like emphasis, equalization, etc are just compensations for channel effects, which one could think as time varying signal equivalents for blurring in imaging.

In that sense, recovery of a "blurred" signal via equalization is absolutely used everywhere that uses high speed digital signals like USB, DDR, PCIe, etc.

1

loki130 t1_j9ri1xj wrote

Then why are you saying everyone is wrong when they're pretty much all mentioning that deblurring methods exist but don't amount to perfect image recovery?

2