Spatial sampling. Processing of graphic information

Analog and discrete methods of representing images and sound

A person is able to perceive and store information in the form of images (visual, sound, tactile, gustatory and olfactory).

Visual images can be saved in the form of images (drawings, photographs, etc.), and sound images can be recorded on records, magnetic tapes, laser discs, and so on.

Information, including graphic and audio, can be presented in analog or discrete form.

At analog representation physical quantity takes infinite number of meanings, what does it meantions change continuously.

At discrete representation research institute physical quantity takes a finite set of values, and its value changes abruptly.

https://pandia.ru/text/78/427/images/image002_72.jpg" align="left" width="204" height="136 src=">In the process of encoding an image, it is spatial disk retization. Spatial sampling of an image can be compared to constructing an image from a mosaic (a large number of small multi-colored glasses). The image is divided into separate small fragments (dots), and each fragment is assigned a color value, that is, a color code (red, green, blue, and so on) Fig. 2 Spatial sampling

Images

The quality of image encoding depends on two parameters dimensions.

Firstly, the quality of image encoding is higher, the smaller the dot size and, accordingly, the greater the number of dots that make up the image.

Secondly, the greater the number of colors, that is, the greater the number of possible states of an image point, is used, the better the image is encoded), (each point carries a greater amount of information). The combination of colors used in the set forms palette colors.

Formation of a raster image.

Graphic in formation appears on the monitor screen as raster second image , which is formed from a certain number of lines, which in turn contain a certain number of dots (pixels).

Image quality is determined by the resolution property of the monitor , i.e., the number of points from which it is composed.

The higher the resolution,that is, the greater the number of raster lines and points in the lineke, the higher the image quality.

Modern personal computers typically use three main screen resolutions: 800 x 600, 1024 x 768 and 1280 x 1024 pixels.

Let's consider the formation of a raster image on the monitor screen, consisting of 600 lines of 800 dots in each line (total dots). In the simplest case (a black and white image without grayscale), each point on the screen can have one of two states - “black” or “white”, that is, 1 bit is needed to store its state.

Color images are formed in accordance with the binary color code of each point stored in video memory (Fig. 3).
Video memory

Point no.

Binary codedot colors

Rice. 3. Formation of a raster image

¿ Color images may have different color depth, which is given by the number of bits,used to encode the color of a dot. The most common color depths are 8, 16, 24 or 32 bits

Binary Image Encoding Quality determined resolution screen and depth of color.

Each color can be considered as a possible state of a point, then the number of colors displayed on the monitor screen can be calculated using the formula

N=2 i,
where i is the color depth

Table 4. Color depth and number of displayed colors

Color depth (i)

Number of colors displayed (N )

The color image on the monitor screen is formed inby mixing three basic colors: red, green andblue. This color model is calledRGB-model bythe first letters of English flower names (Red, Green, Blue).

To obtain a rich palette of colors, the base colors can be given different intensities.

For example, with a color depth of 24 bits, 8 bits are allocated for each color, that is, for each color there are possible N= 28= 256 intensity levels specified in binary codes (from minimum - to maximum - ) table 5

Table.5. Formation of colors at 24-bit color depth

Color name

Intensity

Red

Green

Blue

Blue

Yellow

Graphic mode.

Graphic display mode image on the monitor screen is determined by the resolution shearing ability and depth of color.

In order for an image to be formed on the monitor screen, information about each of its points (the color code of the point) must be stored in the computer’s video memory.

Let's calculate the required amount of video memory for one of the graphics modes, for example, with a resolution of 800 x 600 pixels and a color depth of 24 bits per pixel.

Total dots on screen: 800 600 =

Required amount of video memory:

24 bits = bit = 1 byte =

1406.25 KB = 1.37 MB.

The required amount of video memory for other graphics modes is calculated in the same way.

Windows provides the ability to select a graphics mode and configure settings for the computer's video system, which includes a monitor and video adapter.

Setting graphics mode

1. Click on the indicator Screen on Taskbars , a dialog box will appear Properties: Screen . Select tab Mood ka, which informs us about the brand of the installed monitor and video adapter and provides the ability to set the graphic mode of the screen (color depth and resolution).

2. Click the button Additionally , A dialog box will appear where you can select a tab Adapter. The tab contains information about the manufacturer, brand of video adapter, amount of video memory, etc. Using the drop-down list, you can select the optimal screen refresh rate.

Questions to Consider

1. What is the essence of the spatial sampling method?

2. Explain the principle of forming a raster image.

3. What parameters set the graphic mode in which
Are images displayed on the monitor screen?

Binary coding of audio information

Time sampling of sound.

¿ The sound representsa sound wave with continuously changing amplitude and frequency. The greater the amplitude of the signal, the louder it is for a person; the higher the frequency of the signal, the higher the tone.

In order for a computer to process sound, a continuous audio signal must be converted into a sequence of electrical pulses (binary ones and zeros).

In the process of encoding a continuous audio signal, it is time sampling.

A continuous sound wave is divided into separate small temporary sections, and for each such section a certain amplitude value is set.

Thus, the continuous dependence of the signal amplitude on time A(t) is replaced by a discrete sequence of volume levels. On the graph, this looks like replacing a smooth “curve” with a sequence of “steps” - Fig. 6.

Each “step” is assigned a sound volume level and its code (1, 2, 3, and so on). Sound volume levels can be considered as a set of possible states; accordingly, the more volume levels are allocated during the encoding process, the more information the value of each level will carry and the better the sound will be.

Modern sound cards provide 16-bit audio encoding depth. The number of different signal levels (states for a given encoding) can be calculated using the formula

N=2 i, = 216 = 65536, where i is the sound depth.

Thus, modern sound cards can provideRead coding of 65536 signal levels. Each valueThe amplitude of the sound signal is assigned a 16-bit code.

When binary coding a continuous audio signal, it is replaced by a sequence of discrete signal levels.

The quality of encoding depends on the number of signal level measurements per unit time, that is hoursampling totes.

The more measurements are made in 1 second (the higher the sampling frequency), the more accurate the binary coding procedure/

The quality of binary audio coding is determined byyes coding depth And sampling frequency tions.

The number of measurements per second can range from 8000 to, that is, the sampling frequency of an analog audio signal can take values ​​from 8 to 48 kHz. At a frequency of 8 kHz, the quality of the sampled audio signal corresponds to the quality of a radio broadcast, and at a frequency of 48 kHz, the quality of the sound of an audio CD. It should also be taken into account that both mono and stereo modes are possible.

You can estimate the information volume of a stereo audio file with a sound duration of 1 second with high sound quality (16 bits, 48 ​​kHz).

To do this, the number of bits per sample must be multiplied by the number of samples per second and multiplied by 2 (stereo):

16 bits 2 = 1 bit = byte = = 187.5 KB.

The standard Sound Recording application plays the role of a digital tape recorder and allows you to record sound, that is, sample sound signals, and save them in sound files in WAV format. This program allows you to edit audio files, mix them (overlay them on top of each other), and play them back.

Questions to Consider

1. What is the principle of binary audio coding?

2. On what parameters does the quality of binary audio encoding depend?




  • Graphic images are converted from analog (continuous) to digital (discrete) form by spatial sampling.
  • Spatial sampling of an image can be compared to constructing an image from a mosaic (a large number of small multi-colored glasses).
  • The image is divided into individual 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 resolution.
  • The resolution of a raster image is determined by the number of pixels 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, various color palettes can be used, i.e., sets of colors in which image points can be colored.
  • Each color can be considered as a possible state of a point.
  • Number of colors N in the palette and amount of information I , necessary to encode the color of each point are interconnected and can be calculated using the formula:

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



Color depth, (bits)

Number of colors in the palette, N

2 24 =16 777 216


  • The quality of the image 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 and the number of pixels per line. The monitor can display information with different spatial resolutions (800 x 600, 1024 x 768, 1152 x 864 and higher).

  • The greater the spatial resolution and color depth, the higher the image quality.
  • Operating systems provide the ability to select a user-required and technically feasible graphics mode.

  • The information volume of the required video memory can be calculated using the formula:
  • Where I- information volume of video memory in bits;
  • X Y- number of image pixels (X - number of horizontal pixels, Y- vertically);
  • I- color depth in bits per dot.

  • 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 a 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.

Spatial sampling.

During the encoding process, an image is spatially discretized. Spatial sampling of an image can be compared to constructing an image from a mosaic (a large number of small multi-colored glasses). The image is divided into separate small fragments (dots, and each fragment is assigned a color value, that is, a color code (red, green, blue, and so on).

Sampling- This conversion of graphic information from analogue to discrete form, that is, splitting a continuous graphic image into individual elements.

The quality of image encoding depends on:

1) sampling rate, i.e. the size of the fragments into which the image is divided. The quality of image encoding is higher, the smaller the dot size and, accordingly, the greater the number of dots that make up the image.

The choice of sampling frequency is always a compromise between the quality of reproduction of fine details and the degree of information reduction. As a rule, in the process of image sampling, its “format” is determined, i.e. the number of elements forming it. In this case, of course, the size of the image also changes. Therefore, in order to exclude the influence of this additional factor (image size) on the parameter under study, an artificial technique was used in this work: when changing the sampling conditions, the image size is artificially is maintained constant.

2) coding depth, i.e. number of flowers. The greater the number of colors, that is, the greater the number of possible states of an image point, is used, the better the image is encoded (each point carries a greater amount of information). The combination of colors used in a set forms a color palette.

Graphic information on the monitor screen is presented in the form of a raster image, which is formed from a certain number of lines, which in turn contain a certain number of dots (pixels).

Pixel- the minimum area of ​​the image whose color can be set independently.

Each color can be considered as a possible state of a point, then the number of colors displayed on the monitor screen can be calculated by the formula: N = 2i, where i is the color depth: (if color depth (I) = 8, then 2^8 = 256)

Problem 1. Let's consider the formation of a raster image on the monitor screen, consisting of 600 lines of 800 points in each line (480,000 points in total). In the simplest case (black and white image without grayscale), each point on the screen can have one of two states - “black "or "white", that is, 1 bit is needed to store its state.

TASK 2. Let's calculate the required amount of video memory for one of the graphics modes, for example, with a resolution of 800 x 600 pixels and a color depth of 24 bits per pixel.

Total dots on the screen: 800,600 = 480,000. Required video memory: 24 bits 480,000 = 11,520,000 bits = 1,440,000 bytes = 1406.25 KB = 1.37 MB.




















Spatial sampling of continuous images stored on paper, photographic and film can be achieved by scanning. Currently, digital photo and video cameras that capture images immediately in discrete form are becoming increasingly widespread.
















Color depth and number of colors in the palette Color depth, i (bits) Number of colors in the palette, N 42 4 = = = =




Monitor graphic modes The quality of the image 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 and the number of pixels per line. The monitor can display information with different spatial resolutions (800*600, 1024*768, 1152*864 and higher).


Monitor graphics modes Color depth is measured in bits per pixel and characterizes the number of colors in which image pixels can be painted. The number of colors displayed can also vary widely, from 256 (8-bit color depth) to over 16 million (24-bit color depth).




Graphic monitor modes Periodically, with a certain frequency, dot color codes are displayed on the monitor screen. The frequency of image reading affects the stability of the image on the screen. In modern monitors, image updates occur at a frequency of 75 or more times per second, which ensures comfortable image perception by the user. Example Let's find the amount of video memory for a graphics mode with a spatial resolution of 800x600 pixels and a color depth of 24 bits. I P = i * X * Y = 24 bits x 600 x 800 = bit = byte = 1,406.25 KB = 1.37 MB


Task Screen resolution Color depth x x 768 The monitor can have graphics modes with color depths of 8, 16 and 24, 32 bits. Calculate the amount of video memory in KB required to implement a given color depth at various screen resolutions. Enter the solution into the table.


Sources of information: - Ugrinovich N. D. Textbook Computer Science: textbook for grade 9 / N. D. Ugrinovich - 4th ed. – M.: BINOM. Laboratory of knowledge, – 178 p.; - Ugrinovich N.D., Bosova L.L., Mikhailova N.I. Informatics and ICT: workshop / N. D. Ugrinovich, L. L. Bosova, N.I. Mikhailova - M.: BINOM. Knowledge Laboratory, – 394 p. - Ugrinovich N.D. Computer science and ICT classes: Methodological manual / N.D. Ugrinovich - M.: BINOM. Knowledge Laboratory, p.;

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 a grid model of 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 works. In the future, we will consider only the MKR, which allows us to more clearly present the difference model of the process. In this case, conservative difference schemes are used, which are based on drawing up the balance of matter in a block (cell) related to each nodal point (composite cell method).

In this case, for each cell, convective inflows and outflows of migrants are determined using linear interpolation between neighboring nodes (which corresponds to the main difference of the ICR) or the concentration value from the node from which the migrant comes (which corresponds to the inverse difference of the ICR) is used. To determine the inflow and outflow of migrants due to dispersion, the first partial derivatives of the concentration are also used with perpendicular and parallel to the cell boundaries, which can be established bilinearly from neighboring values.

Let us consider the main provisions for solving the discretization problem in relation to a two-dimensional convective-dispersive flow in a homogeneous medium, taking into account the decay processes according to equation (3.8) at Kos-Y and the action of migration sources-sinks with intensity w. In this case, the differential equation for the convective-diffusion transport 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 / g\ ds \ , de i, ds,

ID, ------ І + ^і------------ ac 4- w = l0 -- . (7.1)

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

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 determined values ​​of c), the asymmetric matrix of coefficients of which indicates each four occupied upper and lower codiagonals along with the main diagonals. Computational migration models depicted in this way are approximately equivalent to models (matrix equations) formulated using normal MKR, as well as MK models. E using linear approximation of functions. The advantage of such a system is that it guarantees maximum clarity of the mathematical description of the process.

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

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

For Vе (0; 2/3; 1) the order of approximation is proved to be 0(D0 and for y=: 1/2-0 (Dt) . From the expansion of functions in the Taylor series it follows that the numerical dispersion is called as

Requires fine sampling. Even allowing the dispersion coefficient DKop to be corrected according to Eq.

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

Does not exclude significant costs for discretization^ To characterize the discretization of migration processes, measureless numbers are used, obtained from equation (7.3):

0 I v I Ah Ah Dtv* At I v I Redh = --! f and Di

And to characterize oscillations - by derivative characteristics

ReLd: P0 Ah Ah P0 Ah2

It follows from the equation that significant costs for spatial discretization of migration processes are justified only when the time discretization error also has the same order of magnitude. Therefore, the Craik-Nicholson 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]. In this case, according to the implicit solution scheme (Y = 1), the half-step At/2 is calculated at the initial position of all parameters at time t and the values ​​c*+A(12) are determined. Then, according to the Craik-Nicholson scheme (y = 1/2), the entire step is implemented At, and all migration parameters, source-sink terms, exchange and replacement, as well as the convection term are specified at 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 a one-, two-, or three-dimensional original 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 point n (this generally also applies to the source-sink terms ic and da), but also at 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].

In 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 cases where the numerical solution tends to be exact with decreasing width. step, i.e. when this method is convergent.

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

Numerical oscillations occur under certain conditions and, as a rule, are determined by comparison with the corresponding analytical solutions. The danger of oscillations arises primarily in processes with dominant convection. Particularly susceptible to oscillation are the Crank-Nicholson scheme, the basic difference terms of convection or accumulation, and the FEM formulation
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 MC formulation. 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 is, 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, 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 the work. Thus, by comparison with analytical solutions, the stability condition for a given spatial discretization is fixed by establishing the critical value of the time step through the critical numbers Di or Cr. The implicit solution scheme with y-1 is certainly stable, and as y decreases, the tendency to instability increases. The numerical solution of the compiled system of equations (matrix equation) is also fraught with the possibility of errors. Very large errors, which spread greatly 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 are insufficiently dominant 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 partial method of steps (for example, the implicit method of alternating directions) and transferring elements of the coefficient matrix to the right side of the equations by multiplying by time or iteratively dependent variables with backdating to create strip matrices with a small tape width (mainly tridiagonal coefficient matrices).For this reason, computer programs for numerical migration modeling should be carefully checked and monitored, especially by comparison with analytical solutions.

Based on the numerical solution, the initial 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 iteration step in a nonlinear solution indicates the number of determined locally discrete values ​​of the dependent variables (R or sometimes vx, vy, c) and thus affects the number of equations of the system. 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 of 124 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 added to this the time spent on adjusting the coefficient matrices and the right-hand side of the equations, 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 storage space for a subroutine for solving a system of equations.

mob_info