Analog and discrete ways of representing images and sound. Digital image coding




  • Graphic images from analog (continuous) form to digital (discrete) are converted by spatial sampling.
  • Spatial discretization of an image can be compared to building an image from a mosaic ( a large number small multi-colored glasses).
  • The image is divided into separate small elements (dots, or pixels), and each element can have its own color (red, green, blue, etc.).



  • The most important characteristic of the quality of a raster image is the resolution.
  • The resolution of a bitmap image is determined by the number of dots both horizontally and vertically per unit length of the image.
  • The smaller the dot size, the greater the resolution and, accordingly, the higher the image quality.
  • 1 inch = 2.54 cm

  • During the sampling process, different color palettes can be used, i.e. sets of colors in which image points can be painted.
  • Each color can be considered as a possible state of the point.
  • Number of colors N in the palette and the amount of information I , required to encode the color of each point are related and can be calculated by the formula:

2 = 2 i= 2 1 = 2 i = i=1 bit.



Color depth, (bits)

The number of colors in the palette N

2 24 =16 777 216


  • The image quality on the monitor screen depends on the spatial resolution and color depth.
  • The spatial resolution of a monitor screen is defined as the product of the number of image lines by the number of dots per line. The monitor can display information with various spatial resolutions (800 x 600, 1024 x 768, 1152 x 864 and above).

  • The greater the spatial resolution and color depth, the higher the image quality.
  • AT operating systems it is possible to select the required and technically possible graphics mode for the user.

  • The information volume of the required video memory can be calculated by the formula:
  • where I- information volume of video memory in bits;
  • X Y- the number of dots in the image (X - the number of dots horizontally, Y- vertically);
  • I- color depth in bits per point.

  • Example: the required amount of video memory for graphics mode with a spatial resolution of 800 x 600 pixels and a color depth of 24 bits is:
  • 1 P = I*X*Y = 24 bits x 800 x 600 = 11,520,000 bits = = 1,440,000 bytes = 1,406.25 KB ~ 1.37 MB.

  • The quality of information displayed on the monitor screen depends on the screen size and pixel size. Knowing the screen diagonal size in inches (15", 17", etc.) and the screen pixel size (0.28 mm, 0.24 mm or 0.20 mm), you can estimate the maximum possible spatial resolution of the monitor screen.

The cardinal problem of numerical modeling of migration processes is discretization in space and time. In spatial discretization, the finite difference method (FDM) and the finite element method are most often used.

Rice. 24. Scheme of a square cell of the grid model of the migration flow:

■a - property parameters; b - results of migration calculation. / - primary results; 2 - bilinear interpolation; 3 to 4 - calculated and neighboring grid nodes.

Cops (FEM), the main provisions of which are described, for example, in the works. In the future, we will consider only the MCS, which makes it possible to more clearly represent the difference model of the process. In this case, conservative difference schemes are used, which are based on the compilation of a balance of matter in a block (cell) related to each nodal point (composite cell method).

At the same time, for each cell, the convective inflows and outflows of migrants are determined using linear interpolation between neighboring nodes (which corresponds to the main difference of the MKR) or the concentration value from the node from which the migrant comes (which corresponds to the inverse difference of the MKR) is used. To determine the inflow and outflow of a migrant due to dispersion, the first partial derivatives of the concentration c are also used perpendicularly and parallel to the cell boundaries, which can be bilinearly set from neighboring values.

Let us consider the main points of solving the discretization problem as applied to a two-dimensional convective-dispersive flow in a homogeneous medium, taking into account the decay processes according to equation (3.8) at Kos-R and the action of migration sources-sinks with intensity w. In this case, the differential equation for the convective-diffusion transfer of a neutral migrant in a two-dimensional flow (with coordinates xt at xx=x and x2-y) has the form

TOC \o "1-3" \h \z d / r\ ds \ , de i, ds,

ID,------ І + ^i------------ ac 4- w = n0 -- . (7.1)

If the sign of q is revealed only as a result of the calculation, then, in general, the relation

2qmkc _ (gtnk _J_ gmk) ck _J_ (qtnk _ [qmk I)

Thus, a linear system of equations is obtained with n equations (n ​​is the number of cells with defined values ​​of c), whose asymmetric matrix of coefficients indicates every four upper and lower codiagonals occupied along with the main diagonals. The computational models of migration depicted in this way are approximately equivalent to the models (matrix equations) formulated using the normal MCS, as well as the MC models. E with the help of linear approximation of functions. The advantage of such a system is that it guarantees the maximum visibility of the mathematical description of the process.

At present, numerical modeling of migration almost exclusively uses a first-order partial difference for the time derivative and builds the migration model by taking into account the importance of the two time levels. Then equation (7.1) for the migration model has the form

Implicit (see Fig. 25, b); y \u003d \ / 2 - Crank - Nicholson (see Fig. 25, c); 7 \u003d 2/3 - Galerkin (see Fig. 25, c).

For Ve (0; 2/3; 1) the order of approximation is proved 0 (Д0 and for y=: 1/2-0 (Дt) , From the expansion of the functions in a Taylor series it follows that the numerical dispersion is called as

Requires fine sampling. Even providing the possibility of correcting the dispersion coefficient DKop according to the expression

TOC \o "1-3" \h \z Acor = D - [ I * I D*/2 + A^2/(2n0)] > 0 (7:6)

It does not exclude significant discretization costs. To characterize the discretization of migration processes, the dimensionless numbers obtained from equation (7.3) are used:

0 I v I Ah Ah Dtv* At I v I Redx = --! W and Di

And to characterize oscillations - derivative characteristics

ReLd: P0 Ax Ax P0 Ax2

It follows from the equation that significant costs for the spatial discretization of migration processes are justified only when the error of temporal discretization also has the same order of magnitude. Therefore, the Cryik-Nicolson scheme with an error of the order of At2 is often used in simulations, despite the associated stability concerns. Its increase is achieved using the predictor-corrector method G10]. At the same time, according to the implicit solution scheme (Y=1), the half-step At/2 is calculated with the initial position of all parameters by the time t and the values ​​c*+L(12) are determined. Then, according to the Craik-Nicolson scheme (y= 1/2), the entire step is implemented At, and all the parameters of migration, terms of sources-sinks, exchange and replacement, as well as the convection term are set at the time t + At / 2. Thus, the computational model of equation (7.2) with a full step is obtained in this form (see Fig. .25):

Moreover, for dc/dt it is necessary to substitute the one-, two- or three-dimensional initial differential equation, and for d2c/dt2 its derivative. Finally, a very significant approximation accuracy is achieved due to the fact that the time derivative is taken into account not only at the point n (this is in general view also applies to sink members ic and yes), but also to neighboring nodes. In its simplest form, this substitution is carried out according to Simpson's rule: dc/dt-(1/6) [(dc/dt)a-.i+4(dc/dt)n+(dc/di)n-1].

On fig. 25f also shows a finite difference scheme for one-dimensional migration processes proposed by G. Stoyan. This scheme makes it possible to control the calculation of all partial derivatives and obtain stable and accurate numerical solutions, especially for cases of pure dispersion or pure convection.

The chosen numerical method is suitable only in those cases when the numerical solution tends to the exact one with decreasing width. step, i.e. when this method is convergent.

Numerical dispersion is caused primarily by the discreteness of the terms: convection and capacity (accumulation), i.e., the first derivatives of dependent variables. This can lead to significant errors in modeling migration processes with? a small coefficient of dispersion ε>, the value of which for various numerical models of migration is obtained depending on Pe^nr and the number Di or Cr. Thanks to the introduction of< ленных. коэффициентов дисперсии [см., например, уравнение (7.6)] значительно уменьшаются погрешности и в простых дискретных схемах. (Стабильные обратные разности членов конвекции и акку­муляции, а также МК. Э с линейными пространственными и вре­менными начальными функциями приводят к значительной числен­ной дисперсии или требуют очень тонкой локальной и временной дискретизации.

Numerical oscillations occur under certain conditions and, as a rule, are determined by comparison with the corresponding analytical solutions. The danger of fluctuations arises mainly in processes with dominant convection. The Crank-Nicolson scheme, the main difference of convection or accumulation terms, and the formulation of the FEM are especially subject to oscillations.
according to the Galerkin scheme with linear functions. At the same time, the implicit scheme, the inverse differences of the convection and accumulation terms, as well as the formulation of the MC. E according to Ritz and according to Galerkin with multiple collocation are largely free from oscillations. At the same time, the more “neutral” the numerical scheme, the more accurate and sensitive it is to violations. Therefore, the numerical scheme used in practice is always a compromise between both tendencies.

Along with discreteness errors, the stability errors resulting from a limited number of numerical calculations are also important. A numerical migration model is considered unconditionally stable if the numerical error (rounding) decreases from one time step to another, and conditionally stable - if this occurs only under certain conditions. These conditions for special cases are presented analytically in . Thus, by comparing with analytical solutions, the stability condition is fixed for a given spatial discretization by establishing the critical value of the time step through the critical numbers Di or Cr. Unconditionally stable is the implicit solution scheme with y-1, and as y decreases, the tendency to instability increases. Numerical solution of the compiled system of equations (matrix equation) is also fraught with the possibility of errors. Very large errors, which spread strongly with the conditional stable method, can be caused by solving a system of equations with poorly expressed conditions, in which the elements of the main diagonals of the coefficient matrix do not predominate enough compared to the main diagonals of the codiagonals.

Significant errors in solving equations can be caused by solving the entire system of equations using a particular step method (for example, the implicit method of alternating directions) and transferring the elements of the coefficient matrix to the right side of the equations by multiplying by time or iteratively dependent variables with back dating to create band matrices with a small band width (predominantly tridiagonal coefficient matrices) For this reason, computer programs for numerical simulation of migration should be carefully checked and controlled, especially by comparison with analytical solutions.

Based on the numerical solution, the primary determination of the number of reference points in the space-time grid is made. The number of reference points in time or in the size of the iterative step in a nonlinear solution indicates the number of determined locally discrete values ​​of dependent variables (R or sometimes vx, vy, c) and thus affects the number of system equations. The time spent on a one-time solution of this system of equations is the main value for estimating costs; they depend on the type of computer, the method used to solve the system 124 of equations, and the quality of the generated computer program. If these costs are multiplied by the number of time or iteration steps required for modeling, and we add to this the time spent on correcting the coefficient matrices and the right side of the equations, then we get the time required for mathematical modeling on a computer. The need for storage space for mathematical modeling of multidimensional migration processes is determined primarily by the need for a subprogram storage space for solving a system of equations.

Processing of graphic information

Coding and processing of graphic and multimedia information

Spatial Discretization

Graphical information can be presented in analog and discrete forms. An example of an analog representation of graphic information is a painting canvas, the color of which changes continuously, and a discrete one is an image printed with an inkjet printer and consisting of separate dots of different colors.

Graphic images from analog (continuous) form to digital (discrete) are converted by spatial discretization. Spatial discretization of an image can be compared to the construction of an image from a mosaic (a large number of small multi-colored glasses). The image is divided into separate small elements (dots, or pixels), and each element can have its own color (red, green, blue, etc.).

Pixel- the minimum area of ​​the image for which you can independently set the color.

As a result of spatial discretization, graphic information is presented in the form bitmap, which is formed from a certain number of lines containing, in turn, a certain number of points (Fig. 1.1).

Resolution. The most important characteristic of the quality of a raster image is the resolution.

Resolutionbitmap is defined by the number of dots both horizontally and vertically per unit length of the image.

The smaller the dot size, the greater the resolution (more raster lines and dots per line) and, accordingly, the higher the image quality. The resolution value is usually expressed in terms of dpi(dot per inch - dots per inch), i.e., in the number of dots in an image strip one inch long (1 inch = 2.54 cm)

Spatial discretization of continuous images stored on paper, photo and film can be done by scanning. Currently, digital photo and video cameras are becoming more widespread, which capture images immediately in a discrete form.

The quality of bitmaps resulting from scanning depends on the resolution of the scanner, which manufacturers indicate with two numbers (for example, 1200 x 2400 dpi)

Scanning is performed by moving a strip of photosensitive elements along the image. The first number is optical resolution scanner and is determined by the number of photosensitive elements on one inch of the strip. The second number is hardware resolution; it is determined by the number of "microsteps" that the strip of photosensitive elements can take, moving one inch along the image.

Color depth. The sampling process can use different color palettes, i.e. sets of colors in which image points can be painted. Each color can be considered as a possible state of the point. The number of colors N in the palette and the amount of information I required to encode the color of each point are related and can be calculated by the formula:

In the simplest case (black and white image without grayscale), the color palette consists of only two colors (black and white). Each dot of the screen can take one of two states - "black" or "white", therefore, by formula (1.1) it is possible to calculate how much information is needed to encode the color of each dot.

or why the resolution of the file must be at least twice the lineature of the raster

A characteristic feature of modern printing systems processing of halftone originals is that both the spatial discretization of the image and the quantization of its tone by level are carried out in them at least twice. Spatial discretization is the replacement of an image whose tone changes arbitrarily in the X and Y coordinates with an image composed of separate sections - zones within which this parameter is averaged. In the general case, as already mentioned, the sampling frequency should be at least twice the frequency of the harmonic component of the original image to be reproduced on the copy. This position is illustrated schematically in Fig. 1 (a), at position a) of which the original continuous message is a sinusoidal oscillation u(t) with period T. The spectrum of such a signal consists of a constant component and the first harmonic:

u \u003d U 0 + U l sin (27tt / T)

Rice. one.

The original signal (a), its sample values ​​and the modulation depth (%) at zero (b), opposite (c) and intermediate (d) phase of the sampling frequency.

At the zero phase of discrete readings U D period T/2 the depth of their modulation by the first harmonic of the original signal is zero, and information about the frequency is completely lost. Only the average value is transmitted U 0 the original signal (see Fig. 1, b). With a change in the phase of counts by half of their period, the modulation depth turns out to be equal to 100% (see Fig. 1, c). Intermediate between the considered phases of readings are accompanied by distortions in the amplitude and phase of the first harmonic, although, as the graph in Fig. 1(d), information about its frequency is preserved. At least one-dimensional (in one of the coordinates) discretization of images accompanies the process of electro-optical analysis. In analog reproduction systems and in television, an optical parameter, which is a function of the coordinates of the original or the transmitted scene, is converted into the amplitude of an electrical signal that changes at the output of the photoelectric cell in time during progressive reading (scanning). The spectrum of spatial frequencies of the image in the direction transverse to the horizontal scanning direction is limited by the frequency of decomposition into lines. Due to the finite dimensions of the scanning spot (aperture), this spectrum is also limited along the lines by a frequency reciprocal of this spot. The second reason for limiting the frequency spectrum and sampling the image along the line is the video signal modulation of the amplitudes, phases or frequencies of an additional electromagnetic wave - the carrier frequency necessary for signal transmission, for example, in television or in analog remote (using electrical communication channels) reproduction. Two-dimensional (in both coordinates) sampling and quantization take place during the so-called analog-to-digital conversion of the video signal, as a result of which the set of spatial samples of the tone value can be represented by some array of numbers written, for example, in binary code. This representation allows you to abstract from the real scanning time and perform functional transformations of tone, color, small details, contours and other image content as operations on the numbers of this array. For such purposes, PCs are now effectively used.
Spatial discretization also accompanies rasterization - the representation of an image in the form of a set of sealed and blank elements, the relative area of ​​which is determined by the tone or color of the corresponding sections of the original. In this case, as already mentioned, the frequency of the first sampling associated with electro-optical analysis and analog-to-digital conversion is taken, as a rule, in twice exceeding the lineature of the polygraphic raster, or rather, the frequency of the raster function, within the period of which one or another number of raster dots and spaces is formed. If this condition is met, then when reproducing a system of periodic strokes of an arbitrary spatial phase, the sizes of neighboring points will at least slightly differ from each other in all cases except for one: when the strokes themselves are shifted by exactly half a period relative to decomposition element 1 and the raster cell. On the print, instead of strokes, a uniform field of identical raster dots with a relative area of ​​50% is formed (see Fig. 2, d), since the reflectance of the original, averaged over the area of ​​the reading spot I, has the same (intermediate) value for all elements of the raster. In the reference zone 7, each time there is half a stroke and half a space (see Fig. 2, c). This case is similar to that shown in Fig. 1(b).

Rice. 2.
The strokes of the frequency 0.51 in the raster grating of the L lineature at the same (a) and opposite (b) phases; their raster copies: b, d - with reading element 1 equal to the lineature pitch; e - at readings of 2 twice as small raster steps.

In all other spatial phases, the stroke contrast on reproduction turns out to be higher, since the values ​​of neighboring readings and the sizes of the raster dots formed in accordance with them differ. The maximum difference occurs in the opposite extreme case, when, as shown in Fig. 2 (a, b), the strokes of frequency 0.51 coincide in phase with the raster grating. Here there is an analogy with the case illustrated in Fig. 1 (a, c). They are transmitted in a raster twice the lineature, equal to L lines / cm, without loss of contrast. The guarantee of transmission of strokes with full contrast, regardless of their spatial phase, is provided by a decomposition frequency that is twice the raster lineature, as Fig. 2 (e). Since at least two spatial discretizations of the image take place in polygraphic reproduction, it follows from the above simplified example that a two-fold decomposition frequency margin must be provided twice. The first time you have to do this is when choosing the screen lineature, if the task is to reproduce certain spatial frequencies of the original on the print. A second margin of 2, this time in relation to the selected lineature value, is set for the scan rate of the original. For example, to reproduce strokes that have a frequency of 4 lines / mm on the original, a print lineature of 80 lines / cm (~ 200dpi) is required (as well as the corresponding paper smoothness and other print parameters). It is necessary to read such an original when scanning at a frequency of 16 lines / mm (~ 400ppi). The degree of destruction of contours and fine details in the raster process is somewhat reduced if the sampling frequency, in accordance with the provisions of the sampling theory, is twice the raster lineature (see Fig. 3, e, f).

Rice. 3.
« Funnel (a) and random (b) distribution of weight values; images of contour 1, which separates on the original sections with absorption 0.94 and 0.04, based on one (c, d), four (e, f) and 64 (g, h) readings per raster period;
2 - analysis reference zone

The section of the original intersected by the contour is represented in this case by four counts of different values. Four fragments of the corresponding section of the copy are formed according to different signs of the “alphabet” of dots. The shape of the area printed inside the area is modulated by the geometry of the contour, and the latter is rendered with greater graphical accuracy and sharpness. This effect is clearly illustrated by the model in Fig. 4 (d) in comparison with those presented in fig. 4(b, c).

Rice. 4.
Line elements (a) of a halftone original and their bitmap copies using:

  • one (b, c, e) and four (d, f) samples in the period of the raster function;
  • unsharp masking of a numeric array (c);
  • shifts of raster dots (e) and their fragments (e) on the contours.

The accuracy of the full contrast contour transfer further increases with the increase in the reading frequency of the original and turns out to be at the level of the resolution of the output device, when each synthesis element in the original video array corresponds to an independent multilevel reading (see Fig. 3, g, h). The reference zones, as a rule, are almost an order of magnitude larger than the dimensions of the synthesis elements and cannot be significantly reduced. Otherwise, excessively, on average by two orders of magnitude, the already large volumes of illustration files, amounting to tens and hundreds of megabytes, increase. Accordingly, the capacity of storage devices, the time for processing and exchanging video information between various modules and workstations of pre-press systems, the transmission time or the occupied bandwidth for remote reproduction increase. In practice, they are limited to only a twofold excess of the sampling rate over the lineature, which corresponds to the examples in Fig. 3 (e, f) and fig. 4(d). Such modes and reproduction systems are conditionally referred to as coarse scan / fine print systems (coarse reading / clear printing). The number of readings equal to the number of synthesis subelements, i.e. fine scan / fine print modes, are found only in continuous tone output devices or inkjet digital printing with relatively small image formats, low input / output resolutions (about 12-24 lines /mm (300-600dpi)) and in this regard, low lineatures.

slide 1

slide 2

Graphic image Analogue (continuous) Visual, perceived by the human eye. Example, painting Discrete (digital) Spasmodic, perceived computer technology. Example, image created inkjet printer printer Transformed by spatial sampling

slide 3

Spatial discretization is a way of converting an analog form of information into digital (discrete). The graphic image is converted to a raster image (consists of a certain number of dots and lines). Mechanism: The image is divided into separate fragments (points, or pixels), and each fragment has its own color.

slide 4

Pixel - the minimum area of ​​the image for which the color is set independently

slide 5

Resolution - determines the number of horizontal and vertical dots per unit length of the image. Unit of length 1 inch = 2.54 cm The unit of measure for the resolution of a raster image is dpi

slide 6

Spatial discretization - In practice it is carried out: Digital photo and video cameras; Scanning.

Slide 7

Scanning technology A strip of light-sensitive element moves along the surface of the image. Image quality, however, depends on the resolution of the scanner. For example, 1200x2400 dpi Optical resolution, number of photosensitive elements per 1 inch of the strip Hardware resolution, number of "microsteps" that the strip of photosensitive elements makes when moving 1 inch along the image

Slide 8

Color Palette A set of colors that can take on pixels in an image. When sampling, each minimal area of ​​the image (dot or pixel) receives a certain color from the used color palette.

Slide 9

The color of a point is its possible state. N - the number of colors in the palette J - the amount of information needed to encode the color of the point. Example, black and white image, N=2, i.e. only one of two possible states - white or black. J= 1 bit The amount of information that is needed to encode the color of an image point, called the color depth (J)

slide 10

Color depth and number of colors in the palette Color depth, J (bits) Number of colors in the palette, N 8 2^8=256 16 2^16=65 536 24 2^24=16 777 216