Ìàãèñòð ÄîíÍÒÓ Âóëü Àííà Àëåêñååâíà

Ann Vool

Faculty of computer science and technology (CST)

Computer monitoring systems

Speciality Computer-aided Monitoring Systems in Ecology and Economy

Research and development of algorithms for image processing for the Android operating system

Scientific adviser: Gennagiy Averin

ABSTRACT

Content

Introduction

1. Relevance of the topic

2. The purpose and objectives of the study, expected results

3. A review of research and development

3.1 Overview of noise models. Noisy images

3.2 Overview algorithms blur

3.3 Overview of local sources

4. Comparative analysis of the standard means of motion blur and Renderscript algorithm Stack Blur

Conclusions

Source List

Introduction

Image Processing – any form of information processing, for which the input image data are, for example, photos or video frames. Image processing can be performed to obtain the output image (for example, preparation for the polygraph replication to broadcast, and so on. D.) and for other information (e.g., text recognition, counting the number and type of cells in the microscope field, and so on. d.). Also static two-dimensional images, is also required to process the image varies with time, for example, video [1] . Improving the quality of images to human perception, creation of special effects, image processing (selection of objects, search persons smiles) – a problem that can be solved by filtering images.
In the middle of XX century image processing has been for the most part carried out the analog and optical devices. Similar optical techniques are still important in areas such as, for example, holography. However, with the sharp rise of productivity of computers, all these methods increasingly supplanted by digital imaging. Methods of digital image processing are usually more accurate, reliable, flexible and easy to implement, rather than analogue methods. The digital image processing is widely used dedicated hardware such as a processor and a pipelining of instructions multiprocessor systems [2].

1. Relevance of the topic

digital techniques allow you to convert images to improve their visual perception. Also in this area are solved problems change the presentation of images for storage, transmission, electronic imaging and subsequent analysis of information embedded in them. Digital image processing is a booming field of science. Research and development of methods and algorithms for processing and analysis of the information provided in the form of digital images is a very urgent task. Digital images are exposed to different types of noise that may arise from the process for producing images, information transfer techniques, methods of digitizing data. The process of eliminating different types of noise in the images is called a filtration [3].

In general, the image processing can be used in such applications and research purposes:

  • OCR;
  • the processing of satellite images;
  • machine vision;
  • data processing to separate different characteristics;
  • medical imaging;
  • identification of the person (face, iris, fingerprint data);
  • automatic control of vehicles;
  • definition of the form of the object of interest to us;
  • definition of moving objects;
  • Apply filters [1].

2. The purpose and objectives of the study, expected results

Objectives of the study are as follows:

  • create a qualitative review of existing algorithms for image filtering, such as blur, sharpen, noisy, noise removal;
  • to conduct a comparative analysis of different algorithms, the same filter criteria such as time and quality of the resulting image, depending on the programming language (Java or C ++);
  • optimize selected the best algorithms for the operating system Android.

Thus, the purpose of the study is to find a rational computational procedure, which would allow to achieve the best results the least time-consuming.

3. A review of research and development

3.1 Overview of noise models. Noisy images

Often, a filtration in a narrower sense to understand the so-called the interference filter or filtering image noise.  This implicitly assumes that the original somewhere there some original perfectly clean (nezashumlennoe) image, which is then by noise pollution  (A certain kind of distortion), was obtained the real image that we see. As a result, the problem of interference filter is to ensure that by a certain treatment  the observed real image as best you can clean it from the noise, that is, to obtain an image that is closest in performance to the original image nezashumlennomu. It should be understood that noisy – it's just a very simple idealized model of occurrence of distortion in digital images of real objects. Distortions Image obtained by video real three-dimensional object in a natural environment, may be of a very complex nature, depending on the shooting conditions (Lighting, fog, glare, shadows, rain, snow, and so on. N.), The characteristics of the optical system (distortion, defocus, turbidity of lenses and mirrors, and so on. N.), The characteristics of e- the recording apparatus, the characteristics of the transmission channel characteristics of devices and digitizing of many factors. Close to reality mathematical models digital imaging contain hundreds of complex nonlinear equations and the set table amendments. The law of formation of the brightness values ??of each pixel of the image,  generally is not independent of the formation of adjacent pixels, the image brightness parameters depend on the geometry, and so on.  

If you try to correct such complex mathematical model for recording images speak not about filtering the noise, and the restoration and reconstruction of images. The most common model is an independent noise on the pixel noise substitution. Given a starting grayscale image I_m [x, y], with each pixel can take values ??in the range [0, ..., I_max-1]. The general model of noise substitution suggests that after noising each pixel of the image, which had previously brightness i, or with a certain probability p (i) retain this value or this value brightness will randomly substituted with probability q (i, j) some other luminance value j from the same end of the discrete range [0, ..., I_max-1]. As can be seen, to describe a general model of a random replacement must specify the size of the table of transition probabilities I_max 2 , which is a very significant amount in the case of conventional 8-bit grayscale image (table size – 256×256 elements). This description is clearly a non-compact and therefore seldom used in practice  halftone images. For grayscale images tend to consider other, more private model noising – additive noise, which suggests that the noisy image is generated according to the law:

Additive noise

where: Im '[x, y] – pixel noisy image, Im [x, y] – pixel of the input image, R (x, y) – the additive random component.

Furthermore, in most applications, the dependence of the noise on the coordinates of the pixel is considered to be insignificant. Finally, based on the known statistics of the law of large numbers, law of distribution of the additive noise component prefer to describe a convenient parametric family of normal (Gaussian) distribution with mean zero. Thus, Gaussian additive noise described by the expression:

Gaussian additive noise

where: N (a, σ) – normal distribution, a – the expectation of a normally distributed signal, σ – The mean square deviation (RMS) of a normally distributed size. It is this model of noise pollution is most often seen in filtration problems halftone images [4].

Original grayscale image, σ = 0

Image 1 — Original grayscale image, σ = 0

Noisy halftoning additive Gaussian noise, σ = 20

Image 2 — Noisy halftoning additive Gaussian noise, σ = 20

Noisy halftoning additive Gaussian noise, σ = 40

Image 3 — Noisy halftoning additive Gaussian noise, σ = 40

Noisy halftoning additive Gaussian noise, σ = 60

Image 4 — Noisy halftoning additive Gaussian noise, σ = 60

3.2 Overview of algorithms for image blur

Blur image plays an important role in modern computer graphics. Motion blur often directed to simulate nearsightedness (In cases where the myopia becomes desirable, or even necessary). So, blur parts of the image is often used for reasons of censorship. In some cases, Blur is an integral part of various techniques of image correction aimed at addressing specific defects (excessive detail, scanning defects, scratches, dust). We know that the Model and photographers use special procedures blur photographic images to achieve the effect of eliminate wrinkles . Blurred images as more amenable to compression (for example, when you save a JPEG image file is smaller in size and less severe arterial compression of the facts). Different techniques blur Image available in all modern graphics editors.

Gaussian Blur — a characteristic blur filter, which uses the normal distribution (also called the Gaussian distribution, hence name) for calculating transformation applied to each pixel of the image. The equation of the Gaussian distribution in the form N measurements:

Gaussian distribution in the form N measurements

or, in the special case of two measurements:

Gaussian distribution in the form 2 measurements

where: r — is blur radius, r 2 = u 2 + v 2, σ — The standard deviation of the Gaussian distribution. In two dimensions, this formula defines the surface having the form of concentric circles with a Gaussian distribution from the central point. Pixels where the distribution is different from zero are used to construct convolution matrix that is applied to the original image. The value of each pixel becomes secondary weighted for the neighborhood. Original pixel value takes the largest weight (Gaussian has the highest value), and adjacent pixels takes less weight, depending on the the distance to them. In theory, the distribution in each point of the image is non-zero, which would require the calculation of the weighting factors for each pixel. But, in practice, when calculated as a discrete approximation of the Gauss function, do not include pixels in the region of 3 σ, as they are small enough. Thus, the program, filter image is sufficient to calculate the matrix [6 σ]×[6 σ], to guarantee sufficient accuracy of approximation of the Gaussian distribution [5] .

Image with Gaussian blur at different radiuses as follows:

Image with Gaussian blur at different radiuses

Image 5 — Gaussian blur
(animation: 7 frames, 10 iterates, 144 kB)
(R — blur radius in pixels).

In general, in order to blur the image, it is necessary in some way averaging the color values of each pixel with color of its neighbors within certain range. This range is called the radius of blur. The obvious solution would be the following: to lay down the color values for each pixel, which is located no farther than blur radius from the current X and Y coordinates, and then divide them by the square of the two blur radius plus one (as the left, right, top and bottom of the selected pixels on a distance of not more than + radius of the center pixel). In addition, when the image blur to consider the weight of pixels. With their variation can be obtained different results. Thus, if all the pixels will have the same weight, we obtained by averaging the image. If we give more weight to the central pixel than the deadline, the image will be more concentrated . For a variation, you can use the scales Various distributions known in mathematical statistics.

The algorithm averaging neighboring pixels uses a uniform distribution law. In this case, all the pixels will have the same weight. In the case where the blur radius is ten:

The algorithm averaging neighboring pixels

The number 21 is the sum of the weights of all neighboring pixels (for blur radius of 10). This number is necessary to divide the colors of neighboring pixels. As can be seen, the sum of the central and neighboring pixels (on each side) is exactly equal to the value 2 * R + 1. Thus, there is no need to calculate the amount.

A triangular distribution law — blur algorithm, using Simpson's distribution law. This distribution law weights neighboring points on the texture with increasing distance from the central point decrease linearly. As before, the blur radius is equal to ten. Need to find the sum of all weights of the neighboring pixels texture and share the final result at her. In order to let this weight the central pixel is equal to (r + 1). Then Weight neighboring pixels will vary in accordance with the function f (x). Weights extreme points in this case are equal to one.

A triangular distribution law

Sum of the weights of all the pixels in this case is expressed by the formula (r + 1) * (r + 1)   [6] .

3.3 Overview of local sources

Within the portal Master of Donetsk National Technical University there was no work appropriate theme of this diploma project. However, there are several works in the direction of image processing, for example, projects D.   and. Metelitsa – Design and Analysis of extraction algorithm circuit in the grayscale image, provided low-contrast boundaries of objects  [7] ; D. A. Savchenko – Research of methods of image segmentation  [8] ; A. In. Kolesnik – Distributed software system for image recognition  [9] . There was no final work, which It would include any operations with the images on the platform Android. At the moment, the programming for the operating system Android rapidly gaining popularity, so there is a high probability that in the future the portal Masters will appear more and more theses associated to this area.

4. Comparative analysis of the standard means of motion blur and Renderscript algorithm Stack Blur

In recent years, more and more applications that appear in the vast Google   Play   Store, use the blur effect. For example, well-known application Muzei from + RomanNurik or popular widget Yahoo   Weather. After examining these applications can be seen that the skillful handling of blurring can be achieved very impressive results. In this thesis project image filtering algorithms should be optimized, taking into account the features of the operating system Android. The faster the algorithm works, the better, since the operation blur, noise pollution, and so on. d. must be made transparent to the user as possible. Do not forget that Android-applications run on mobile devices, not on the computer.

One of the most popular and convenient way to quickly blur the picture in the Android is Renderscript. This is a very powerful tool for the job images. Despite its apparent complexity, many of the parts are simple enough to use. Renderscript — a new API, aimed at high performance 3D rendering and complex computing operations. Renderscript is interesting in an attempt to maximize application performance. For developers there are three tools: a simple API for 3D rendering that supports hardware acceleration API for modeling complex calculations, and the language of the standard, close to the C99.

Improved performance is achieved by running native code on the device. However, unlike the NDK, This cross-platform solution. Language development for Renderscript — is C99 with some extensions during the development process, it is compiled in hardware-independent intermediate format and placed in the application package. When the application is run, the script is compiled into machine code and optimized. This avoids the problems associated with the need to choose a specific machine architecture. Renderscript not intended to replace existing high-level API, it should be used in those cases where the current need for performance is not provided by API   [10] . Renderscript available in Android version 3.0 and higher.

As a result, finding ways to optimize the motion blur was found that Render Script — not the fastest method of blurring the image file. It was found algorithm Stack Blur, authored by Mario Klingemann. This algorithm after the implementation of C ++ NDK showed significantly better performance compared to Render Script. When processing an image size of 325 × 60 with a radius of 20 pixels blur Renderscript score of 13 ms, and Stack Blur – 2 ms. The quality of the results have been obtained about the same.

Thus, we can conclude that the use of standard tools of the Android platform is not always convenient. When the task to minimize time zatratyi while maintaining a good quality of the end result, these funds are insufficient. Therefore, the aims and objectives of this study are a hot topic, that require urgent resolution.

Conclusion

Analyzing the various algorithms of image filtering and optimizing them under the operating system Android, you can come to a completely new direction in image processing. Processing of graphic files – an area that in today's world of computer technology to quickly and intensively develops, there new tools and algorithms for image filtering. At the moment, it has created quite a few editors who work on personal computers and can perform very sophisticated graphics functions. But not always for the image processing is necessary to use a PC, because some steps far it is more convenient to perform on your mobile device. This fact provides the opportunity to develop algorithms that will perform as efficiently as possible image processing on the tablet, smartphone or even an e-book.

Filtering image helps to solve a lot of problems that arise in any digital imaging device. The weakening of the action of interference accomplished by filtration. When filtering the brightness (tone) of each point of the original image, distorted hindrance, is replaced by some other value brightness, which recognizes the least distorted noise. Blurring photo is used to provide an image with a limited number of colors more shades. As a rule, the effect of blurring applied to images and with a smooth transition to increase the range of colors used shades. Blur effect allows you to defocus the necessary parts of the picture. For example, blurring can identify objects and people through the blur located in the background the background, and helps to eliminate many other technical shortcomings of the image.

Source List

1. Image Processing. [Electronic resource]. – Access mode: https://ru.wikipedia.org/wiki/Îáðàáîòêà_èçîáðàæåíèé
2. Filtering images. Fast Fourier Transform [electronic resource]. – Access mode: https://sites.google.com/site/alexeysidnev/docs/filter_fft
3. Review of methods of filtering and segmentation of digital images. [Electronic resource]. – Access mode: http://cyberleninka.ru/article/n/obzor-metodov-filtratsii-i-segmentatsii-tsifrovyh-izobrazheniy
4. The task image filtering. [Electronic resource]. – Access mode: http://wiki.technicalvision.ru/index.php/Çàäà÷à_ôèëüòðàöèè_èçîáðàæåíèé
5. Software implementation of a Gaussian blur. [Electronic resource]. – Access mode: ftp://ftp.altlinux.org/pub/people/at/gblur.pdf
6. Blur image with shaders. [Electronic resource]. – Access: http://www.gamedev.ru/code/articles/blur
7. Snowstorm D.   and. – Development and analysis of contour extraction algorithm for halftone image under the condition of low-contrast objects borders. [Electronic resource]. – Access mode: http://masters.donntu.ru/2014/fknt/metelytsia/diss/index.htm
8. Savchenko E.   A. – Research of methods of image segmentation. [Electronic resource]. – Access mode: http://masters.donntu.ru/2010/fknt/savchenko/diss/index.htm
9. Kolesnik A.   In. – Distributed software system for image recognition. [Electronic resource]. – Access mode: http://masters.donntu.ru/2010/fknt/kolesnik/diss/index.htm
10. Introduction to Renderscript. [Electronic resource]. – Access: http://habrahabr.ru/post/113535
Îôèöèàëüíûé ñàéò ÄîíÍÒÓ| Ïîðòàë ìàãèñòðîâ ÄîíÍÒÓ
Ðóññêèé| Óêðà¿íñüêà| English