📜 ⬆️ ⬇️

Reflections on the restoration of the damaged image

Recently, after reading a post about holographic coding from eresik , I discovered a thing I did not know before, that:
You can restore the full image of the object by any piece of the holographic image (with deterioration of the image quality)


The first thing that came to mind was “Wow, cool! I'll have to experiment with that too. ” Later, forgetting about this idea, I came across another topic from Valler , where the author developed the idea by implementing the coding of color images.

I was very interested in the very idea of ​​restoring an image from a partially corrupted image.
')


In the topics about holographic coding, two things immediately catch your eye:
1) Even if the encoded image does not spoil, then during restoration, the image is still obtained with distortion.
2) The encoded image should contain a lot of redundant information. This is clearly seen from the topic, where the author encodes a 16x16 image into an image of 256x256 (an increase in size of 256 times!).

After a bit of thought, I quickly realized that everything was tritely simple, provided that the image was spoiled only by large concentrated pieces .

For example, there is an image and here it is spoiled:


What a horror, now we do not know what was on the right side of the picture! So why not do this:
1) Take the image and mix all the pixels according to a certain algorithm (which gives a good random variation and at the same time allows you to restore the reverse order).
2) When the image deteriorates in a certain area, all this corruption spreads evenly throughout the image.
3) Then, applying various filters, you can get the original image (relatively) in very good quality.

A few pictures from the application that I wrote to test my thoughts.
And so, we encode the image:


Encoded image spoils:


Restore the image:


Apply the filter. Unfortunately, my knowledge in image processing was only enough to write a filter to fill in the damaged pixels with the average value of the surrounding normal pixels:


It seems the result is quite good. Better than with holographic coding. However, there is no redundant information, and if the encoded image was not corrupted, then we get a 100% copy of the original without any artifacts during decoding.

A couple of additional pictures. With 50% of corrupted data:

With 75% of corrupted data:


That's all.
I think that for people who are deeply involved in image processing and information coding, my methods will seem too uneducated, but do not judge strictly, I just wanted to share my thoughts.

UPD:
Added recovery examples for large image sizes. The archive contains the original image (3872x2592) and three decoded images with 25%, 50% and 75% data loss.
Download archive 49.4 Mb

Source: https://habr.com/ru/post/122607/


All Articles