📜 ⬆️ ⬇️

Sparse image processing

We will talk about the usual spatial image processing by imposing simple masks. Sometimes this process is called two-dimensional aperture correction. As is known, the principle of such processing is as follows: a pixel of a new image is formed on the basis of the same pixel of an old image and its surroundings with different weights. Over the years of digital image processing, many masks and magic tricks have been invented; this type of processing has its pros and cons. We consider the effects of sparse masks.
We will process the plot of the image of the test television table in order to consider small details.



For example, take the usual LPF mask [1]:
')
1 2 1 2 4 2 1 2 1 




The impact of small masks is not isotropic, since the distance between the central element of the mask and the vertical / horizontal elements is conventionally 1, and between the central element of the mask and diagonal elements is the root of 2. This leads to some geometric distortions. An obvious solution is to increase the size of the mask to ensure isotropy. When image processing on computers was only mastered, and the time spent on testing was critical, an increase in the size of the mask led to an increase in the amount of computation, so the “extra” elements were usually filled with zeros. These ideas were developed in the 1980s by comrade L.P. Yaroslavsky, but in Russian he published three large books, where he did not touch on this question, but I could not find his small articles or monographs.
By the way, I will quote to the heap: “any small object is a set of points in some compact area (it can be a circle, a rectangle, a cross, a rhombus, etc.). There is a “brake zone” around the central element. If the size of this zone is twice the size of the object, then the object is allocated without distortion [2]. "
The same LPF for a mask of 5 * 5 elements will take the form:

 1 0 2 0 1 0 0 0 0 0 2 0 4 0 2 0 0 0 0 0 1 0 2 0 1 




However, the blur effect is many times stronger, since the more distant neighbors are involved in the formation of the central pixel of the new image.
The same LPF for the mask 7 * 7 elements:

 0 0 0 2 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 4 0 0 2 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 2 0 0 0 




Let's compare the results of processing (in order - the original image, 3 * 3, 5 * 5, 7 * 7):



Next, we consider the effect of the clarity mask, calculated by my spiritual mentor Galchuk IV, and published in [3].
Filter enhancement 3 * 3:

 -0.1 -0.1 -0.1 -0.1 2 -0.1 -0.1 -0.1 -0.1 

Filter enhancement 5 * 5:

 -0.1 0 -0.1 0 -0.1 0 0 0 0 0 -0.1 0 2 0 -0.1 0 0 0 0 0 -0.1 0 -0.1 0 -0.1 

Filter enhancement 7 * 7:

 0 0 0 -0.1 0 0 0 0 -0.1 0 0 0 -0.1 0 0 0 0 0 0 0 0 -0.1 0 0 2 0 0 -0.1 0 0 0 0 0 0 0 0 -0.1 0 0 0 -0.1 0 0 0 0 -0.1 0 0 0 

And, for extreme sports, a 15 * 15 clarity filter:

 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 2 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0.1 0 0 0 0 0 0 0 

And, in fact, the results (in order - the original image, 3 * 3, 5 * 5, 7 * 7, 15 * 15):







Actually, the results for the 15 * 15 mask are obvious, since for large objects there is an effect of distorting the boundaries of objects with large brightness differences, as well as mixing parts of different objects with each other and destroying some image details. As mentioned above, this is due to the fact that the brightness values ​​of the pixels of the processed image are formed from elements that are far from the central point.
Having carried out measurements for s / sh and kchh, I found out that the optimal mask size for this group of images is 7 * 7.

A remarkable feature of large sparse masks is to enhance the effect with increasing size.


This is the main conclusion of the article.

Of course, you can make large filled masks (there are no zero elements, there are some calculated coefficients everywhere), but then there is the difficulty of calculating these same elements, because creating a mask for some purpose is a very nontrivial and time-consuming exercise that gives the greatest effect, as a rule for images taken in similar systems under approximately the same conditions. Processing time, respectively, also increases.

Features of the implementation
To create images for the article, I used ImageJ - for beginners, both are very good, and most importantly, quickly. The ability to create your own masks and even complex processing algorithms is present (there seems to be a certain built-in module for writing something by macros, but I have not tried it).

In stationary surveys using matlab. The code for applying the mask is very simple:

 input=imread('C:\input.jpg'); input=double(input); kernel=[-0.1 -0.1 -0.1;-0.1 2 -0.1;-0.1 -0.1 -0.1]/1.2; %  -  ,     % kernel=[0 0 -0.1 0 0;0 -0.1 0 -0.1 0;-0.1 0 2 0 -0.1;0 -0.1 0 -0.1 0;0 0 -0.1 0 0]/1.2; %  5*5,   output = imfilter(input, kernel); figure, imshow((output)); 


In tribute to the memory of Soviet science
In search of material, I came across an article of 1982 [4], where the mask was described as much as 5 * 10 (and so, although canonically such things were never recommended), created for:
- removal of the constant component,
- reduce the dynamic range of the signal from point objects (this is how they slyly struggled with impulse noise).

{the heart suggests, this mask is also the display geometry on harsh CRT tubes of the oscillographic type, flattened}

Bibliography
1. Gonzalez R., Woods R. Digital image processing. - M .: Technosphere, 2005. - 1072 p.
2. Kuryachy M.I. Digital Signal Processing: Tutorial. - Tomsk: TU Department, TUSUR, 2012. - 172 p.
3. Konyukhov A.L., Galchuk I.V., Kuryachy M.I. Increasing the resolution of active-pulsed television and computer systems using two-dimensional aperture correction and iterative algorithms. Kursk, materials of the conference "Recognition - 2012".
4. Mandraji V.P. The effectiveness of two-dimensional filtering of signals when determining the coordinates of point objects. - M .: Communication equipment. Series "Television Technique". Issue 5 (No. 42), 1982

PS or what else
In the article, I did not give figures and calculated characteristics. There are many methods for determining the quality of the image, and all of them are somewhat biased or inconvenient. In addition, for black-and-white and color images techniques differ.
Being engaged in processing black-and-white images of technical vision systems, I suffered for a long time with quality criteria, since the subjective view is always subjective, and the computer doesn’t distinguish the computer from rain or grass from any interference from the power source, if there is no programmer’s will.
In the future, at the request of the workers, I can write a review on signal-to-noise assessment and other objective (calculated) quality parameters for black and white images, methods for calculating contrast (a banal task, but there are almost no adequate methods for low-quality images), homomorphic filtering and where it works, well, maybe we'll think of something else.
Thanks for attention!

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


All Articles