Статьи о загранице, путешествиях и отдыхе

Фабрика мебели: угловые диваны. Выгодная покупка!

6 Сентябрь 2010

Honey, I Shrunk the number of pixels in the image

написано в рубрике: News — Метки: — admin @ 18:10
The small introduction
Very long time ago (approximately of years 15 back:-)) with an interval in some years two American films one after another have appeared: « dear, I have reduced children » and « dear, I have increased the child » (« Honey, I shrunk the kids » and « Honey, I blew up the kid »). Similar, the reduction and increase — is two indissolubly connected among themselves processes. Having said something about one of them, it is necessary to say something and about another.:-)
Two years back I have written small clause about increase of number пикселов in the digital images. Now настала it is time to say a pair of words and about reduction.
Essence of a question
As is known, to break — to not build. Proceeding from this national wisdom, it would be possible to make a conclusion what to reduce number пикселов in the image much easier, than to increase. However actually and at reduction of elements of the image of questions arises much. If simply to throw out “«superfluous” пикселы, there is a question: what to throw out, and what to leave? If there is a desire nothing to throw out, and to calculate new meanings(importance) пикселов, proceeding from colours of nearby elements, for such procedure it is necessary to pick up optimum algorithm. Thus it is necessary to remember, that the naturalness of perception(recognition) depends on simultaneous performance of many conditions. Most important are those:
а. Sharpnesses should be enough;
б. The sharpness should be perceived naturally;
в. The voice-frequency transitions should be smooth;
Of a contour and the lines should be smooth enough;
д. On the image should not be appreciable артефактов.
Thus it is important to understand, that any of these conditions is not main. All of them are equal in rights and it should be taken into account in aggregate.
The business is complicated also by  that the criterion « naturalnesses of perception(recognition) » — is difficult be for formalizing and for translating to language of the mathematical formulas. For example, it is possible to require, that in a resulting spatial spectrum the high-frequency components were as much as possible saved. Or, for example, it is possible to aspire to the greatest possible preservation of the form bending around of a spatial spectrum. And it is possible, on the contrary to resort to suppression of high spatial frequencies on one of stages of transformation, for it is obvious, that by and large, but high spatial frequencies will come to offer. But, alas, what formal criterion we would not set, we can be never sure, that he will ensure(supply) absolute success in any case. Only system « of an eye + brain » allows finally to judge efficiency of this or that algorithm.
From вышесказанного, certainly, does not follow, that any automatic procedures of change of the size of the image are useless and are inefficient. It not so. If volume of job is great, and the result to us is necessary not worse average, a sin to not use any universal algorithm. But if it is important to us to receive maximum high quality, which is above the average of a level, an output(exit) only one: it is necessary to try manually (i.e. not automatically) to realize a little well recommending itself of procedures, and then subjectively to choose the best variant.
The complexity of a problem of a choice of optimum algorithm illustrates a fig. 1.
Fig. 1
Let’s assume, that it is required to reduce twice linear sizes of the extreme left image (original). The most simple decision — to break initial картинку on larger blocks and in each block from four initial elements to leave only one. In variant Nearest neighbor (fig. 1) in each block the colour left top пиксела was left. But such approach is connected, for example, to such problems:
1. The result appreciably depends on what is concrete пиксели was decided(solved) to leave;
2. On the final image the undesirable voice-frequency shifts (so can appear, in considered(examined) on a fig. 1 example the image has lost axial diagonal symmetry peculiar to the original).
Other elementary approach — nothing to throw out, and to calculate colour resulting пиксела as mathematical average size of colours which are included in replaced block (see variant, replaced in a fig. 1). More complex(difficult) algorithms can lean(base) on various mathematical procedures of interpolation (see, for example, variant Bicubic resample in a fig. 1).
So, it is visible, that the result essentially depends on the chosen algorithm. What variant is better? Alas, the exact answer cannot be given. If to us the subtleties are important to lean(base) it is possible only on a method of subjective expert estimations.
The analysis of the real image
Let’s consider an example of reduction of the real image (see fig. 2). As an initial photo the photo of a rose from a site www.bigfoto.com was chosen. In the beginning I have made from not ё выкадровку by the size 620 х 620 пикселов, and then has reduced е ё up to the size 200 х 200 пикселов by various ways.
Fig. 2
In столбцах of the table in a fig. 2 the results received by various algorithms are shown:
1. The algorithm Nearest neighbor as a matter of fact means absence ресэмплинга, i.e. procedure of recalculation of colour пикселов. This algorithm is focused on idle time выбрасывание “«superfluous” пикселов. Thus the colour of the stayed element is established on colour of the nearest neighbour in the initial image.
2. The algorithm Bicubic resampling is included into all popular programs of processing of the images. He is simple, is fast and is rather effective.
3. The recalculation of colour пикселов on algorithm Ланцоша (Lanczos resampling from the program Irfan View) is ещ ё one successful attempt to reach(achieve) the compromise between sharpness and smoothness of voice-frequency transitions.
In the first line (1 step) the transformation was received for one step, that is the block (620 х 620) at once was transformed into the block (200 х 200). In the second line (2 steps) the images received in a course of transformation with one intermediate stage are submitted: (620 х 620) = > (310 х 310) = > (200 х 200).
Any procedures of increase of sharpness to the images was applied not.
What image is better? Or (that same): what algorithm is better? Alas, objectively to answer this question it is impossible. As I already have said, the task of natural perception(recognition) is difficultly formalized(difficultly formalizable). The performance of any mathematical criterion provides only result of the not worse certain level. If to us one is important перфекционизм, an output(exit) only: to carry out transformations manually and then subjectively to compare the received results.
Really, we shall see in a fig. 2. The images in an extreme left column are looked rather sharply. Many spectators have even idea that to them the filter Unsharp Mask was applied. However it not so. And sharpness in this case is looked a little unnaturally. An obvious conclusion from here follows: not in one sharpness business! The resulting image should be optimized on many parameters.
The interrogations which have been carried out(spent) by the author of clause among different groups of the people, have revealed, that the extreme right top and average bottom images are most naturally perceived. And the preferences were divided(shared) approximately fifty-fifty. It ещ ё of time testifies that the formal recommendation for reduction of the images to give difficultly. So, for example, the one-step-by-step application of function Lanczos Resapmling is not the sharpest variant. Nevertheless, the result looks very naturally. Even more simple question on number of stages of transformation to answer uneasily. In one cases one stage suffices, and in others it is more preferable to decide(solve) a task behind some steps. I shall be repeated: said fairly, if to us is important перфекционизм, and we do not want to be content with a certain universal approach ensuring result not worse of some (rather high) level.
On the other hand, it is important to not overlook(forget), that вс ё above-stated fairly only at examining the images from enough close distance. Sometimes it happens enough to recede on step – other from картинки — and all distinctions immediately will seem insignificant. Therefore at change of the sizes of the images it is important to not miss from a kind concrete conditions of viewing. If viewing the images under a small corner of sight (from enough large distance) is supposed, concerning a problem resize-resampling it is possible to not worry.
Conclusions
The advantages of this or that method of reduction of number of elements in the image become appreciable only at viewing result from enough close distance.
If we shall rise on a way перфекционизма, to us inevitably will come to refuse automatic procedures and unequivocal recommendations and to rise on a way of realization of a trial and error method.
The references
1. And. Ефремов. We increase number пикселов in the image. Not strict comparison of various realizations of function Resample. First clause devoted to application of function Resize/Resample.
2. The fresh version Irfan View it is possible скачать from a site http: // www.irfanview.com/
3. The plenty of the free-of-charge images is accessible to loading on a site bigfoto.com
4. At change of the size of the images is frequently sharpest there is a task of preservation of naturally perceived sharpness. If you have not enough of practical experience or volume of job is rather great, it is expedient to use any universal, but thus flexible, software. For example, it is possible to use PhotoKit Sharpener from PixelGenius.
The application
Not always it is easy to find out distinctions between the final images received at application of different algorithms, on an eye. In such cases it is expedient to resort to a tool way of comparison two картинок.
The procedure is simple: the first image should be placed in one layer; second — in another. Then for layers it is necessary to establish a mode: blending = difference. If the images are identical, result will be a black rectangular.
At application of such way of comparison it is important to not overlook(forget) what to distinguish on an eye “«black” and “«almost black” colours at times it happens uneasily. Therefore it is desirable поводить on a resulting rectangular « computer пипеткой » completely to be assured in his(its) blackness.
Gratitude
The author considers(counts) as the debt to thank everyone, who kindly has agreed to comment on a fig. 2 and to state сво ё opinion on various algorithms of change of the size of the images. Separate gratitude Сергею Хлопчуру that he has paid attention the author to software from the company PixelGenius.

Dear, I have reduced number пикселов in the image_______________________________________ ________________
The small introduction
Very long time ago (approximately of years 15 back:-)) with an interval in some years two American films one after another have appeared: « dear, I have reduced children » and « dear, I have increased the child » (« Honey, I shrunk the kids » and « Honey, I blew up the kid »). Similar, the reduction and increase — is two indissolubly connected among themselves processes. Having said something about one of them, it is necessary to say something and about another.:-)
Two years back I have written small clause about increase of number пикселов in the digital images. Now настала it is time to say a pair of words and about reduction.

Essence of a question
As is known, to break — to not build. Proceeding from this national wisdom, it would be possible to make a conclusion what to reduce number пикселов in the image much easier, than to increase. However actually and at reduction of elements of the image of questions arises much. If simply to throw out “«superfluous” пикселы, there is a question: what to throw out, and what to leave? If there is a desire nothing to throw out, and to calculate new meanings(importance) пикселов, proceeding from colours of nearby elements, for such procedure it is necessary to pick up optimum algorithm. Thus it is necessary to remember, that the naturalness of perception(recognition) depends on simultaneous performance of many conditions. Most important are those:
а. Sharpnesses should be enough;б. The sharpness should be perceived naturally;в. The voice-frequency transitions should be smooth;Of a contour and the lines should be smooth enough;д. On the image should not be appreciable артефактов.
Thus it is important to understand, that any of these conditions is not main. All of them are equal in rights and it should be taken into account in aggregate.
The business is complicated also by  that the criterion « naturalnesses of perception(recognition) » — is difficult be for formalizing and for translating to language of the mathematical formulas. For example, it is possible to require, that in a resulting spatial spectrum the high-frequency components were as much as possible saved. Or, for example, it is possible to aspire to the greatest possible preservation of the form bending around of a spatial spectrum. And it is possible, on the contrary to resort to suppression of high spatial frequencies on one of stages of transformation, for it is obvious, that by and large, but high spatial frequencies will come to offer. But, alas, what formal criterion we would not set, we can be never sure, that he will ensure(supply) absolute success in any case. Only system « of an eye + brain » allows finally to judge efficiency of this or that algorithm.
From вышесказанного, certainly, does not follow, that any automatic procedures of change of the size of the image are useless and are inefficient. It not so. If volume of job is great, and the result to us is necessary not worse average, a sin to not use any universal algorithm. But if it is important to us to receive maximum high quality, which is above the average of a level, an output(exit) only one: it is necessary to try manually (i.e. not automatically) to realize a little well recommending itself of procedures, and then subjectively to choose the best variant.
The complexity of a problem of a choice of optimum algorithm illustrates a fig. 1.

Fig. 1   Let’s assume, that it is required to reduce twice linear sizes of the extreme left image (original). The most simple decision — to break initial картинку on larger blocks and in each block from four initial elements to leave only one. In variant Nearest neighbor (fig. 1) in each block the colour left top пиксела was left. But such approach is connected, for example, to such problems:
1. The result appreciably depends on what is concrete пиксели was decided(solved) to leave;2. On the final image the undesirable voice-frequency shifts (so can appear, in considered(examined) on a fig. 1 example the image has lost axial diagonal symmetry peculiar to the original).
Other elementary approach — nothing to throw out, and to calculate colour resulting пиксела as mathematical average size of colours which are included in replaced block (see variant, replaced in a fig. 1). More complex(difficult) algorithms can lean(base) on various mathematical procedures of interpolation (see, for example, variant Bicubic resample in a fig. 1).
So, it is visible, that the result essentially depends on the chosen algorithm. What variant is better? Alas, the exact answer cannot be given. If to us the subtleties are important to lean(base) it is possible only on a method of subjective expert estimations.

The analysis of the real image
Let’s consider an example of reduction of the real image (see fig. 2). As an initial photo the photo of a rose from a site www.bigfoto.com was chosen. In the beginning I have made from not ё выкадровку by the size 620 х 620 пикселов, and then has reduced е ё up to the size 200 х 200 пикселов by various ways.

Fig. 2   In столбцах of the table in a fig. 2 the results received by various algorithms are shown:
1. The algorithm Nearest neighbor as a matter of fact means absence ресэмплинга, i.e. procedure of recalculation of colour пикселов. This algorithm is focused on idle time выбрасывание “«superfluous” пикселов. Thus the colour of the stayed element is established on colour of the nearest neighbour in the initial image.
2. The algorithm Bicubic resampling is included into all popular programs of processing of the images. He is simple, is fast and is rather effective.
3. The recalculation of colour пикселов on algorithm Ланцоша (Lanczos resampling from the program Irfan View) is ещ ё one successful attempt to reach(achieve) the compromise between sharpness and smoothness of voice-frequency transitions.
In the first line (1 step) the transformation was received for one step, that is the block (620 х 620) at once was transformed into the block (200 х 200). In the second line (2 steps) the images received in a course of transformation with one intermediate stage are submitted: (620 х 620) = > (310 х 310) = > (200 х 200).
Any procedures of increase of sharpness to the images was applied not.
What image is better? Or (that same): what algorithm is better? Alas, objectively to answer this question it is impossible. As I already have said, the task of natural perception(recognition) is difficultly formalized(difficultly formalizable). The performance of any mathematical criterion provides only result of the not worse certain level. If to us one is important перфекционизм, an output(exit) only: to carry out transformations manually and then subjectively to compare the received results.
Really, we shall see in a fig. 2. The images in an extreme left column are looked rather sharply. Many spectators have even idea that to them the filter Unsharp Mask was applied. However it not so. And sharpness in this case is looked a little unnaturally. An obvious conclusion from here follows: not in one sharpness business! The resulting image should be optimized on many parameters.
The interrogations which have been carried out(spent) by the author of clause among different groups of the people, have revealed, that the extreme right top and average bottom images are most naturally perceived. And the preferences were divided(shared) approximately fifty-fifty. It ещ ё of time testifies that the formal recommendation for reduction of the images to give difficultly. So, for example, the one-step-by-step application of function Lanczos Resapmling is not the sharpest variant. Nevertheless, the result looks very naturally. Even more simple question on number of stages of transformation to answer uneasily. In one cases one stage suffices, and in others it is more preferable to decide(solve) a task behind some steps. I shall be repeated: said fairly, if to us is important перфекционизм, and we do not want to be content with a certain universal approach ensuring result not worse of some (rather high) level.
On the other hand, it is important to not overlook(forget), that вс ё above-stated fairly only at examining the images from enough close distance. Sometimes it happens enough to recede on step – other from картинки — and all distinctions immediately will seem insignificant. Therefore at change of the sizes of the images it is important to not miss from a kind concrete conditions of viewing. If viewing the images under a small corner of sight (from enough large distance) is supposed, concerning a problem resize-resampling it is possible to not worry.

Conclusions
The advantages of this or that method of reduction of number of elements in the image become appreciable only at viewing result from enough close distance.
If we shall rise on a way перфекционизма, to us inevitably will come to refuse automatic procedures and unequivocal recommendations and to rise on a way of realization of a trial and error method.

The references
1. And. Ефремов. We increase number пикселов in the image. Not strict comparison of various realizations of function Resample. First clause devoted to application of function Resize/Resample.
2. The fresh version Irfan View it is possible скачать from a site http: // www.irfanview.com/
3. The plenty of the free-of-charge images is accessible to loading on a site bigfoto.com
4. At change of the size of the images is frequently sharpest there is a task of preservation of naturally perceived sharpness. If you have not enough of practical experience or volume of job is rather great, it is expedient to use any universal, but thus flexible, software. For example, it is possible to use PhotoKit Sharpener from PixelGenius.

The application
Not always it is easy to find out distinctions between the final images received at application of different algorithms, on an eye. In such cases it is expedient to resort to a tool way of comparison two картинок.
The procedure is simple: the first image should be placed in one layer; second — in another. Then for layers it is necessary to establish a mode: blending = difference. If the images are identical, result will be a black rectangular.
At application of such way of comparison it is important to not overlook(forget) what to distinguish on an eye “«black” and “«almost black” colours at times it happens uneasily. Therefore it is desirable поводить on a resulting rectangular « computer пипеткой » completely to be assured in his(its) blackness.

Gratitude
The author considers(counts) as the debt to thank everyone, who kindly has agreed to comment on a fig. 2 and to state сво ё opinion on various algorithms of change of the size of the images. Separate gratitude Сергею Хлопчуру that he has paid attention the author to software from the company PixelGenius.

Нет комментариев

Еще нет комментариев.

RSS лента комментариев к этой записи.

Извините, комментирование на данный момент закрыто.

Работает на WordPress