Image drawing method, display device and storage medium

文档序号:50742 发布日期:2021-09-28 浏览:26次 中文

阅读说明:本技术 一种图像绘制方法、显示装置及存储介质 (Image drawing method, display device and storage medium ) 是由 王显 马希通 吴聪睿 李彦孚 于 2020-03-27 设计创作,主要内容包括:本发明提供了一种图像绘制方法、显示装置及存储介质,涉及显示技术领域。该方法包括:确定显示图像中的每个目标像素的灰阶值;根据目标像素的灰阶值,确定每个预设灰阶等级的像素数量;通过第一进制表示像素数量中的最大数量,并读取最大数量第一进制数中预设位数范围的数值;确定该数值对应的比例系数;根据待绘制直方图高度、待绘制灰阶和比例系数,绘制直方图。本发明中,可根据灰阶中最大的像素数量,确定比例系数,并按照该比例系数绘制灰阶的柱状高度,以使各柱状高度按比例分配,从而在直方图中,较高和较低柱状都能保持显示高度适宜,有效绘制高度基本集中在直方图腰部,可清楚展示显示图像的灰阶集中情况,便于分析处理。(The invention provides an image drawing method, a display device and a storage medium, and relates to the technical field of display. The method comprises the following steps: determining a gray scale value of each target pixel in a display image; determining the number of pixels of each preset gray scale grade according to the gray scale value of the target pixel; expressing the maximum number in the pixel number through a first system, and reading the numerical value of a preset digit range in the maximum number first system; determining a proportional coefficient corresponding to the numerical value; and drawing the histogram according to the height of the histogram to be drawn, the gray scale to be drawn and the scale coefficient. According to the invention, the proportion coefficient can be determined according to the maximum pixel number in the gray scale, and the column height of the gray scale is drawn according to the proportion coefficient, so that the column heights are distributed in proportion, therefore, in the histogram, the higher column and the lower column can keep the display height appropriate, the effective drawing height is basically concentrated at the waist part of the histogram, the gray scale concentration condition of the display image can be clearly displayed, and the analysis and the processing are convenient.)

1. An image rendering method, comprising:

determining a gray scale value of each target pixel in a display image;

determining the number of pixels of each preset gray scale grade according to the gray scale value of each target pixel;

expressing the maximum number in each pixel number through a first system to obtain a maximum number first system number, and reading a numerical value in a preset digit range in the maximum number first system number;

determining a proportional coefficient corresponding to the numerical value;

and drawing the histogram according to the height of the histogram to be drawn, the gray scale to be drawn and the proportion coefficient.

2. The method of claim 1, wherein prior to determining the gray scale value for each target pixel in the display image, further comprising:

determining a plurality of equally divided numerical value ranges according to the maximum pixel number which can be reached by any gray scale in the display image and the height of the histogram to be drawn; a plurality of said numerical ranges are non-coincident and continuous;

determining the reciprocal of the median value of each of said ranges of values; the intermediate value is an integer;

multiplying each reciprocal by a preset coefficient to obtain a first product, wherein the first product is an integer;

determining a plurality of storage addresses according to the number of the numerical value ranges;

and taking each first product as a proportionality coefficient, and respectively storing the proportionality coefficients into the plurality of storage addresses in a one-to-one correspondence mode from small to large.

3. The method of claim 2, wherein said determining the scaling factor to which the value corresponds comprises:

and determining the proportionality coefficient stored in the target storage address by taking the numerical value as the target storage address.

4. The method of claim 2, wherein the number of the value ranges is a preset number, and a product of an inverse number of the value ranges and the preset coefficient is a preset product.

5. The method according to claim 2, wherein the maximum number of first bins is represented by a first data structure, the first data structure includes a first digit range and a second digit range from a last digit, the first digit range includes the preset digit range from a first digit of the first digit range, a value in the first digit range represents the height of the histogram to be plotted, a value in the second digit range represents any one of the value ranges corresponding to the maximum number of first bins, and a value in the preset digit range represents the value range corresponding to the maximum number of first bins.

6. The method of claim 1, wherein said rendering a histogram based on said height of the histogram to be rendered, the gray level to be rendered, and said scaling factor comprises:

drawing a first gray scale corresponding to the maximum number according to the height of the histogram to be drawn;

for any second gray scale to be drawn except the first gray scale, multiplying the number of pixels corresponding to the second gray scale by the proportional coefficient to obtain a second product;

determining the quotient of the second product and the preset coefficient to obtain the column height corresponding to the second gray scale;

and drawing a histogram according to the column height corresponding to the second gray scale.

7. The method of claim 6, wherein said drawing a histogram according to the column height corresponding to the second gray scale comprises:

subtracting the height of the histogram to be drawn from the height of the column corresponding to the second gray scale to obtain the height from the top of the column of the second gray scale to the height of the histogram to be drawn;

drawing the column top of the second gray scale to a blank area at the height of the histogram to be drawn according to the blank height;

and when the drawing of the margin area is finished, drawing the column shape of the second gray scale according to the column height corresponding to the second gray scale.

8. The method of claim 6, wherein the predetermined coefficient is a power of 2 to the nth power, and wherein determining the quotient of the second product and the predetermined coefficient to obtain the column height corresponding to the second gray scale comprises:

and expressing the second product by binary to obtain a second product binary number, and right-shifting the second product binary number by N bits to obtain the column height corresponding to the second gray scale.

9. The method of claim 1, wherein determining a gray scale value for each target pixel in the display image comprises:

splitting the display image into a plurality of display sub-images;

determining a gray scale value for each of the target pixels in each of the display sub-images.

10. The method of any of claims 1-9, wherein the first bin is a binary bin.

11. A display device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the image rendering method as claimed in any one of claims 1 to 10.

12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the image rendering method according to any one of claims 1 to 10.

Technical Field

The present invention relates to the field of display technologies, and in particular, to an image drawing method, a display device, and a storage medium.

Background

With the development of display technology, display devices are widely used in various fields, and in order to better analyze the color distribution of the image displayed on the display device, it is generally necessary to draw a histogram corresponding to the displayed image, such as an RGB histogram, a luminance histogram, and the like, where the abscissa is a gray scale and the ordinate is a number of pixels. The RGB histogram may show the distribution of the number of pixels corresponding to different gray levels for each color component, and the luminance histogram may show the distribution of the number of pixels corresponding to different luminance gray levels.

In practical applications, if the number of pixels corresponding to a certain gray scale is large, the number of columns corresponding to the certain gray scale exceeds the range of the histogram, that is, the higher columns are not easy to display. In addition, if the number of pixels corresponding to a certain gray scale is large, the number of columns corresponding to a large number of gray scales is not easy to be observed under the condition that the number of pixels corresponding to a large number of gray scales is small, that is, the number of columns corresponding to a small number of pixels is not easy to be observed. The use of such a histogram cannot accurately analyze and process an image, and is of low utility value.

Disclosure of Invention

The invention provides an image drawing method, a display device and a storage medium, which are used for solving the problems that when a histogram is drawn, if the number of pixels corresponding to gray scales is large, the drawing is high, the higher column is not easy to display, and the lower column is not easy to view.

In order to solve the above problems, the present invention discloses an image drawing method, comprising:

determining a gray scale value of each target pixel in a display image;

determining the number of pixels of each preset gray scale grade according to the gray scale value of each target pixel;

expressing the maximum number in each pixel number through a first system to obtain a maximum number first system number, and reading a numerical value in a preset digit range in the maximum number first system number;

determining a proportional coefficient corresponding to the numerical value;

and drawing the histogram according to the height of the histogram to be drawn, the gray scale to be drawn and the proportion coefficient.

Optionally, before determining the gray-scale value of each target pixel in the display image, the method further includes:

determining a plurality of equally divided numerical value ranges according to the maximum pixel number which can be reached by any gray scale in the display image and the height of the histogram to be drawn; a plurality of said numerical ranges are non-coincident and continuous;

determining the reciprocal of the median value of each of said ranges of values; the intermediate value is an integer;

multiplying each reciprocal by a preset coefficient to obtain a first product, wherein the first product is an integer;

determining a plurality of storage addresses according to the number of the numerical value ranges;

and taking each first product as a proportionality coefficient, and respectively storing the proportionality coefficients into the plurality of storage addresses in a one-to-one correspondence mode from small to large.

Optionally, the determining a scaling factor corresponding to the numerical value includes:

and determining the proportionality coefficient stored in the target storage address by taking the numerical value as the target storage address.

Optionally, the number of the numerical range is a preset number, and a product of a reciprocal of the number of the numerical range and the preset coefficient is a preset product.

Optionally, the maximum number of first bins is represented by a first data structure, the first data structure includes, starting from a last digit, a first digit range and a second digit range, the first digit range includes, starting from a first digit of the first digit range, the preset digit range, a value in the first digit range represents the height of the histogram to be drawn, a value in the second digit range represents any one of the value ranges corresponding to the maximum number of first bins, and a value in the preset digit range represents the value range corresponding to the maximum number of first bins.

Optionally, the drawing a histogram according to the height of the histogram to be drawn, the gray scale to be drawn, and the scale coefficient includes:

drawing a first gray scale corresponding to the maximum number according to the height of the histogram to be drawn;

for any second gray scale to be drawn except the first gray scale, multiplying the number of pixels corresponding to the second gray scale by the proportional coefficient to obtain a second product;

determining the quotient of the second product and the preset coefficient to obtain the column height corresponding to the second gray scale;

and drawing a histogram according to the column height corresponding to the second gray scale.

Optionally, the drawing a histogram according to the column height corresponding to the second gray scale includes:

subtracting the height of the histogram to be drawn from the height of the column corresponding to the second gray scale to obtain the height from the top of the column of the second gray scale to the height of the histogram to be drawn;

drawing the column top of the second gray scale to a blank area at the height of the histogram to be drawn according to the blank height;

and when the drawing of the margin area is finished, drawing the column shape of the second gray scale according to the column height corresponding to the second gray scale.

Optionally, the determining a quotient of the second product and the preset coefficient to obtain the column height corresponding to the second gray scale includes:

and expressing the second product by binary to obtain a second product binary number, and right-shifting the second product binary number by N bits to obtain the column height corresponding to the second gray scale.

Optionally, the determining a gray-scale value of each target pixel in the display image includes:

splitting the display image into a plurality of display sub-images;

determining a gray scale value for each of the target pixels in each of the display sub-images.

Optionally, the first scale is binary.

In order to solve the above problem, the present invention also discloses a display device comprising a processor, a memory and a computer program stored on the memory and operable on the processor, wherein the computer program, when executed by the processor, implements the steps of the image rendering method as described above.

In order to solve the above problem, the present invention also discloses a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the steps of the image rendering method as described above.

Compared with the prior art, the invention has the following advantages:

in the embodiment of the invention, the gray-scale value of each target pixel in the display image can be determined, then the number of pixels of each preset gray-scale level is determined according to the gray-scale value of each target pixel, then the maximum number in each pixel number can be represented by a first system, the maximum number first system number is obtained, the numerical value in the range of the preset digit number in the maximum number first system number is read, then the proportional coefficient corresponding to the numerical value can be determined, and finally the histogram can be drawn according to the height of the histogram to be drawn, the gray scale to be drawn and the searched proportional coefficient. In the embodiment of the invention, the proportion coefficient required by drawing can be determined according to the maximum pixel number in the gray scale, and the column heights corresponding to the gray scale to be drawn are drawn according to the proportion coefficient, so that the column heights can be distributed in proportion, therefore, in the drawn histogram, the higher column height and the lower column height can keep the display height appropriate, the effective drawing height is basically concentrated at the waist of the histogram, the gray scale concentration condition of the display image can be clearly shown, and the analysis processing is convenient.

Drawings

Fig. 1 is a flowchart illustrating an image rendering method according to a first embodiment of the present invention;

FIG. 2 is a schematic diagram of effective rendering areas of an RGB fused histogram and a luminance histogram according to a first embodiment of the present invention;

FIG. 3 is a schematic diagram illustrating an effective rendering area of an RGB separated histogram according to a first embodiment of the present invention;

FIG. 4 illustrates a first data structure for representing a maximum number of respective pixel quantities, in accordance with a first embodiment of the present invention;

fig. 5 shows another first data structure for representing the maximum number among the numbers of respective pixels according to the first embodiment of the present invention;

fig. 6 is a partial schematic diagram of a histogram according to a first embodiment of the present invention.

Detailed Description

In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.

Example one

Referring to fig. 1, a flowchart illustrating steps of an image rendering method according to a first embodiment of the present invention is shown, where the method includes the following steps:

step 101: a gray scale value for each target pixel in the displayed image is determined.

In an embodiment of the present invention, the method may be implemented by an image drawing device, where the image drawing device may be, for example, an FPGA (Field-Programmable Gate Array), and accordingly, the method may be applied to an electronic device including an FPGA, such as a high-definition or ultra-high-definition monitor, or a high-definition computer, and this is not particularly limited in this embodiment of the present invention.

Alternatively, step 101 may be implemented by: splitting the display image into a plurality of display sub-images; determining a gray scale value for each of the target pixels in each of the display sub-images.

Specifically, when the image drawing apparatus receives a display image to be displayed, the display image may be split into a plurality of display sub-images. For example, in an 8K video system, the resolution of an image that can be input is 7680 × 4320, and optionally, for a display image with the resolution of 7680 × 4320, the display image can be split into 16 regions along the vertical direction, resulting in 16 display sub-images, wherein the resolution of each display sub-image is 480 × 4320.

For any display sub-image, the image drawing device may determine a gray-scale value of each target pixel in each display sub-image, where the target pixel may be a pixel sampled from the display sub-image, or may be all pixels in the display sub-image, and this is not particularly limited in the embodiment of the present invention.

The sampling of the pixels can accurately reflect the whole gray scale condition of the image, and simultaneously save the time for subsequently counting the number of the pixels, thereby saving the time for drawing the histogram.

For example, for a display sub-image having a resolution of 480 × 4320, 1 pixel may be sampled every 4 pixels in the horizontal direction, traversing all rows in the vertical direction. In a specific application, the pixel sampling can be performed in coordination with the clock signal, the pixel data arriving at the high level of each clock is counted first, and the gray-scale value of the pixel data is recorded every time the 4 th pixel data arrives. Thus, 1 display sub-image can be acquired to obtain the gray-scale values of 480 × 4320 × (1/4) ═ 518400 target pixels, and for the display image, that is, 16 display sub-images, the gray-scale values of 518400 × 16 ═ 8294400 target pixels can be acquired in total.

In practical applications, the gray-scale value data of 16 display sub-images may be stored in 16 different second storage modules, respectively. Optionally, the second storage module may specifically be a RAM (volatile random Access Memory).

In addition, in a specific application, optionally, this step may perform parallel processing on a plurality of display sub-images, that is, may determine the gray-scale value of each target pixel in each display sub-image simultaneously, so that the time for counting the gray-scale values may be saved, and the time for drawing the histogram may be saved.

In addition, in the embodiment of the present invention, when it is required to analyze histograms of different color components, the gray scale value of the target pixel may include R (red), G (green), and B (blue) gray scales, or Y (luminance), U (chrominance), and V (chrominance) gray scales, and the like. When the luminance histogram needs to be analyzed, the gray scale value of the target pixel may include a luminance gray scale.

Optionally, before the present step, the method may further include the following steps (1) to (5):

(1) determining a plurality of equally divided numerical value ranges according to the maximum pixel number which can be reached by any gray scale in the display image and the height of the histogram to be drawn; a plurality of said numerical ranges are non-coincident and continuous.

In step (1), the maximum number of pixels that can be reached by any gray level in the display image, i.e. the sum of the number of pixels in the complete display image, is 7680 × 4320, for example, for a display image with a resolution of 7680 × 4320, the maximum number of pixels that can be reached by any gray level in the display image is 7680 × 4320 — 33177600, that is, the gray levels of all pixels in the display image are the same, for example, a display image with a pure white or pure black screen.

Fig. 2 shows a schematic diagram of effective rendering regions of an RGB (red green blue) fused histogram and a luminance histogram, and fig. 3 shows a schematic diagram of effective rendering regions of an RGB separated histogram, each of which is 1920 × 1080 in size. Referring to fig. 2, only 1 effective rendering region P1 is provided, and the other regions are left blank and can be displayed transparently, wherein the size of P1 is 1536 × 896, and therefore, the highest value of the histogram is 896 for the RGB fusion histogram and the luminance histogram. Referring to fig. 3, there are 3 effective rendering regions P2, P3 and P4, P2, P3 and P4 may be used to render R histogram, G histogram and B histogram, respectively, and the other regions are left blank and may be displayed transparently, wherein the sizes of P2, P3 and P4 are 1536 × 256, so that the highest value of the histogram is 256 for the RGB separation histogram.

In the embodiment of the present invention, the column height corresponding to the gray scale with the largest pixel number may be set as the highest value allowed to be drawn in the effective drawing area, and if the column height corresponding to the gray scale with the largest pixel number is set as k, that is, the column height corresponding to the gray scale with the largest pixel number is drawn according to a certain proportion, the column heights corresponding to the other gray scales are allocated according to the proportion. For example, in a displayed image, the maximum number of pixels of a gray scale is max, then the corresponding column height of the maximum number max is k, and the number of pixels of a certain gray scale Q is m, then the corresponding column height of the gray scale Q is m/(max/k).

For example, for the RGB-split histogram shown in fig. 3, if the maximum number of pixels of a gray scale in the displayed image is max, the corresponding column height of the maximum number max may be 256, and if there are m pixels of a certain gray scale Q, the corresponding column height of the certain gray scale Q should be m/(max/256).

In the embodiment of the present invention, the height of the histogram to be rendered, that is, the highest value allowed to be rendered in the effective rendering area of the histogram to be rendered is also included. For example, for the effective rendering region shown in fig. 3, the height of the histogram to be rendered is 256. For another example, for the effective rendering region shown in fig. 2, the height of the histogram to be rendered is 896, but 896 is not an integer power of 2, which is not favorable for obtaining an integer in the subsequent calculation, so in practical application, when the height of the histogram to be rendered is 896, 1024 (2) can be used in the subsequent calculation10) Instead, in the subsequent drawing, all the 7 th bits of the binary data of the other column heights except the highest column height are set to 0. Since the maximum representable number of the last 7 bits of the binary data is 127, and for the maximum value allowed to be rendered to be 1024, 1023 is theoretically the maximum rendering height that can be achieved by other columns than the highest column, therefore, the last 7 bits of the binary data with other column heights than the highest column height are all set to 0 (127 can be subtracted at most), so that the final column height of rendering does not exceed 896(1023 + 127 ═ 896). And the highest columns will eventually be drawn directly to a height of 896 and not as high as 1024, so the height of all columns will not exceed 896.

It should be noted that the histogram size and the effective rendering area size shown in fig. 2 and 3 are merely examples, and do not limit the present invention.

In step (1), 0 to (maximum number of pixels MA/height k of histogram to be rendered) may be segmented into a plurality of equally divided numerical ranges, the equally divided numerical ranges indicating that the number of numerical values included in each numerical range is the same.

Optionally, when the number of the numerical ranges is a preset number, the step (1) may specifically include: and determining a plurality of equally divided numerical value ranges according to the maximum pixel number which can be reached by any gray scale in the display image, the height of the histogram to be drawn and the preset number.

Specifically, the maximum number of pixels may be divided by the height of the histogram to be drawn and then divided by the preset number to obtain a division interval, where the division interval indicates how many values each value range includes.

For example, for an RGB split histogram, the height of the histogram to be rendered is 256, the preset number may be 2025, that is, the number of the value ranges is 2025, and the division interval is 33177600/256/2025-64, that is, 0 to 129600(MA/k 33177600/256-129600) may be segmented every 64 values, to obtain [0,63], [64,127] … … and 2025 (129600/64-2025) equally divided value ranges, which are not overlapped and continuous, and each value range includes 64 values.

For example, for the RGB fused histogram and the luminance histogram, the height of the histogram to be rendered is 1024, the preset number may be 2025, that is, the number of the value ranges is 2025, and the division interval is 33177600/1024/2025 ═ 16, that is, 0 to 32400(MA/k ═ 33177600/1024 ═ 32400) may be segmented every 16 values, so as to obtain [0,15], [16,31] … … and 2025(32400/16 ═ 2025) equally divided value ranges, which are not overlapped and continuous, and each value range includes 16 values.

(2) Determining the reciprocal of the median value of each of said ranges of values; the intermediate value is an integer.

In step (2), the reciprocal of the median value of each numerical range may be taken, wherein, since each numerical value includes an even number (64) of numerical values, the median value may take any one of the middle 2 numerical values, for example, the median value of the numerical range of [0,63] may take 32, and the median value of the numerical range of [0,15] may take 8.

After taking the intermediate values in a segmentation, the inverse of the intermediate values are calculated, and it can be found that, for the RGB fused histogram and the luminance histogram, the inverse is actually 4 times the inverse corresponding to the RGB separate histogram.

(3) And multiplying each reciprocal by a preset coefficient to obtain a first product, wherein the first product is an integer.

In step (3), a first product of each reciprocal with a preset coefficient may be determined to expand each of the reciprocals into an integer. Wherein the predetermined coefficients are used to expand each reciprocal to an integer representation for ease of computation and storage. Alternatively, for an RGB separate histogram, the preset coefficient may be 218(ii) a For the RGB fused histogram and the luminance histogram, the preset coefficient may be 216(218/2164 times).

(4) And determining a plurality of storage addresses according to the number of the numerical value ranges.

In step (4), if there are M number of value ranges, M memory addresses may be determined, and optionally, the memory addresses may start from 0, and each memory address is 0 to (M-1).

For example, the number of the value ranges may be 2025, and then 2025 memory addresses, each of which is 0,1, 2, … …, 2023, 2024, respectively, may be determined.

In practical applications, the storage address may be a storage address included in the first storage module, and optionally, the first storage module may specifically be a ROM (Read Only Memory).

(5) And taking each first product as a proportionality coefficient, and respectively storing the proportionality coefficients into the plurality of storage addresses in a one-to-one correspondence mode from small to large.

In step (5), each first product may be used as a scaling factor, and stored into a plurality of storage addresses in a one-to-one correspondence manner according to a sequence from small to large, wherein the smallest first product is stored into the smallest storage address 0, and the largest first product is stored into the largest storage address. For example, the smallest first product is stored at the smallest memory address 0 and the largest first product is stored at the memory address 2024. These scaling factors are also the ROM parameters.

In addition, optionally, the number of the numerical range may be a preset number, and a product of the reciprocal of the number of the numerical ranges and the preset coefficient may be a preset product.

In the embodiment of the present invention, when the number of the value ranges is the preset number, no matter what the maximum number of pixels and the height of the histogram to be drawn are, as long as the number of the value ranges is determined (equal to the preset number), for example, 2025, so as to ensure that the maximum number of pixels × the height of the histogram to be drawn are not changed, the storage address in step (5) can be ensured to be not changed, and the storage address is 0 to 2024.

Under the condition that the product of the reciprocal of the number of the numerical values (namely, the division intervals) in the numerical value range and the preset coefficient is the preset product, the proportionality coefficients in the step (5) can be ensured to be unchanged, and the proportionality coefficients are all the first products. For example, the predetermined product may be 1/64 × 218For the RGB split histogram, the reciprocal 1/64 × the preset coefficient 2 of the number of values in the value range18Is 1/64 x 218For the RGB fused histogram and the luminance histogram, the reciprocal 1/16 × the preset coefficient 2 of the number of values in the numerical range16Is also 1/64 x 218Thus, the scaling factors in step (5) are guaranteed to be unchanged, and the scaling factors are all the first products.

Therefore, under the condition that the number in the numerical range is the preset number, and the product of the reciprocal of the number in the numerical range and the preset coefficient is the preset product, the corresponding relation (ROM parameters) between the storage address and the proportional coefficient in the step (5) is unchanged, the storage addresses are all 0-2024, and the proportional coefficients are all the first products, so that only one set of ROM parameters is needed for drawing the RGB separation type, the RGB fusion type and the brightness histogram, and a plurality of sets of ROM parameters do not need to be stored, so that the storage resources can be saved.

Of course, in practical applications, the number of values in each value range and the number of value ranges are also variable, and accordingly, there may be multiple sets of ROM parameters, which is not specifically limited in this embodiment of the present invention.

Step 102: and determining the number of pixels of each preset gray scale grade according to the gray scale value of each target pixel.

In the embodiment of the present invention, one predetermined gray scale level may include a plurality of gray scales, that is, the plurality of gray scales belong to the same predetermined gray scale level. Of course, a preset gray scale level may also include a gray scale, that is, a gray scale is a preset gray scale level, which is not limited in the embodiment of the present invention. In a specific application, each of the second memory modules may use each of the predetermined gray scale levels as a memory address, for example, 512 predetermined gray scale levels are used, and 512 addresses are used for each of the second memory modules.

The second storage module corresponding to the display sub-image a is a, and for any target pixel in the display sub-image a, the image drawing device may determine that the gray-scale value of the target pixel belongs to the preset gray-scale level X, and may count the target pixel in the address X of the second storage module a for storage.

For example, in a 10-bit system, RGB and YUV gray scales of all pixels are between 0 and 1023, and there are 1024 gray scales, and in the embodiment of the present invention, every 2 gray scales can be calculated as the same gray scale as a preset gray scale level, so that there are 512 preset gray scale levels between 0 and 511. The 512 predetermined gray scale levels can be used as 512 addresses, so that each of the 16 RAMs has 512 addresses, and the data corresponding to each address represents the number of pixels. For any display sub-image, the number of target pixels of the display sub-image in 512 preset gray scale levels of the RAM1 is recorded corresponding to the RAM 1. For example, if the R grayscale value of a target pixel is 612, 1 is added to the data stored in the 306 th (612/2 is 306, and if the address is counted beginning with 0, the address corresponding to the 306 th address is represented as 305) address of the RAM1, and the initial data stored in each address is 0.

In this way, after the data corresponding to the 16 display sub-images are completely counted, the data of the 16 RAMs can be taken out for summation, that is, the number of pixels belonging to the same address (the same preset gray scale level) in each RAM is summed, so that the number of pixels of each preset gray scale level can be obtained.

In the embodiment of the present invention, it is necessary to count the number of pixels with the maximum preset gray scale level in the displayed image and perform histogram drawing by using the number as the highest histogram, so that in the process of accumulating the number of pixels, it is necessary to record the number of pixels with the maximum preset gray scale level, that is, a comparison mechanism is set, in the process of counting, the initial value of the maximum number may be set to 0, and the maximum number is updated every time a higher number of pixels occurs, and may be recorded as max mentioned above.

It should be noted that, for the RGB fused histogram, the R, G, B columns appear from the bottom of the same effective rendering area, so when taking the maximum number max, the maximum number corresponding to all gray levels R, G, B should be taken. For the RGB histogram, the R, G, B columns appear from the bottom of the different effective rendering areas, so when the maximum number max is taken, the maximum number corresponding to R, G, B gray levels should be taken, and the heights of the columns corresponding to R, G, B gray levels should be calculated. For the luminance histogram, only the luminance Y is needed, and the maximum number max corresponding to the Y gray scale is selected.

Step 103: and expressing the maximum number in each pixel number through a first system to obtain the maximum number first system number, and reading the value of a preset digit range in the maximum number first system number.

Optionally, the maximum number of first bins is represented by a first data structure, the first data structure includes, starting from a last digit, a first digit range and a second digit range, the first digit range includes, starting from a first digit of the first digit range, the preset digit range, a value in the first digit range represents the height of the histogram to be drawn, a value in the second digit range represents any one of the value ranges corresponding to the maximum number of first bins, and a value in the preset digit range represents the value range corresponding to the maximum number of first bins.

Optionally, the first scale is binary. Accordingly, the maximum number first binary number is also the maximum number binary number.

In the embodiment of the present invention, the maximum number among the respective numbers of pixels may be represented by binary. Referring to fig. 4, a first data structure for representing the maximum number of respective pixel numbers is shown, which is applicable to rendering of an RGB separate histogram. Referring to fig. 5, another first data structure for representing the maximum number among the respective pixel numbers is shown, which is applicable to rendering of RGB fusion histograms and luminance histograms.

As shown in fig. 4 and 5, the maximum number max among the numbers of pixels can be represented by 32 bits, which is 25-bit data because the maximum possible value max is 33177600(7680 × 4320), but only data to the power of 2 is calculated due to device operation limitation, so that in order to ensure 25-bit valid data, the minimum power of 2 to 2, that is, 32 (2) can be taken5). Referring to fig. 4 and 5, since only 25 bits are valid, the upper 7 bits of 32 bits are both 0 by default, serving as a placeholder.

In the data structure shown in fig. 4, the lower 8 bits (i.e., the first bit number range, bits 8 to 1) may represent 256 (2)8) I.e., the 8 th to 1 st digit of the maximum number of binary numbers, may represent the height 256 of the histogram to be rendered. For the RGB histogram, because it is desired to calculate the column height m/(max/256) corresponding to any gray level Q finally, and the maximum possible value of max is 33177600, so that it would consume a lot of resources to directly divide max/256 by dividing, so that max can be represented by binary, and then 8 bits lower (equal to dividing by 256) are omitted, i.e. 17 bits in the middle of fig. 4, which is 11+6 bits, can represent the size of max/256, and max/256 is any value in the value range to which the maximum number of binary belongs. Therefore, division operation of large numerical values can be avoided, and system resources of equipment are saved.

Similarly, in the data structure shown in FIG. 5, the lower 10 bits (i.e., the first bit number range, bits 10 to 1) may represent 1024 (2)10) That is, the value of the 10 th to 1 st bit in the maximum number of binary numbers may represent the height 1024 of the histogram to be rendered. For theSince the RGB fusion histogram and the luminance histogram are intended to calculate the column height m/(max/1024) corresponding to any gray level Q, and the maximum possible value of max is 33177600, so that it would consume a lot of resources to directly divide max/1024 by division, so that max can be represented by binary, and then 10 bits lower (equivalent to divide by 1024) are ignored, i.e. 15 bits in the middle 11+4 of fig. 5 can represent the size of max/1024, and max/1024 is any value in the range of values to which the maximum number of binary belongs. Therefore, division operation of large numerical values can be avoided, and system resources of equipment are saved.

In the data structure shown in fig. 4, the middle 6 bits (i.e., the range of bits other than the range of the preset number of bits in the second range of bits) may represent 0 to 63 (2) with the lower 8 bits being ignored6-1), the range of the middle 6 bits is always the 64 values no matter what the middle 11 bits are, just the dividing interval 64 of the value range corresponding to the RGB histogram, and since 0 to (33177600/256) are previously divided into 2025 value ranges every 64 values, it is possible to read the middle 11 bits (2)112048 > 2025), i.e., 25 th to 15 th bits of the 32 bits, it is possible to obtain which value range max/256 belongs to, i.e., 25 th to 15 th bits of the 32 bits, which can represent the value range corresponding to the maximum number of second digits. Therefore, for the RGB separate histogram, the preset bit number range may be set to 25 th to 15 th bits of the 32 bits.

Similarly, in the data structure shown in fig. 5, the middle 4 bits (i.e., the range of bits other than the range of the preset number of bits in the second range of bits) can represent 0 to 15 (2) with the lower 10 bits being ignored4-1) the middle 4 bits range is always the 16 values no matter what the middle 11 bits are, just the division interval 16 of the value range corresponding to the RGB fused histogram and the luminance histogram, since previously 0 to (33177600/1024) were divided into 2025 value ranges every 16 values, it is possible to read the middle 11 bits (2)112048 > 2025), i.e. 25 th to 15 th of the 32 bits, it is possible to obtain which value range max/1024 belongs to, i.e. in the 32 bitsThe 25 th to 15 th digits of (b) may represent a numerical range corresponding to the maximum number of digits of the number. Therefore, for the RGB separate histogram, the preset bit number range may be set to 25 th to 15 th bits of the 32 bits.

In the embodiment of the present invention, the numerical value of the preset digit range in the read maximum number first scale number may represent a numerical range to which max/height of the histogram to be plotted belongs. In the previous step, the ordinal numbers (0-2024) corresponding to the numerical range are set to 2025 storage addresses, so that the read numerical value is a certain storage address.

Specifically, after counting max of the display image and expressing max by the first progressive, resulting in the maximum number of binary numbers, max [24:14], i.e., 25 th to 15 th bits of the maximum number of binary numbers, may be read from the maximum number of binary numbers.

Step 104: and determining a scaling coefficient corresponding to the numerical value.

In the embodiment of the present invention, since the scaling factor may be stored in a storage address included in the first storage module (ROM), the step may be specifically implemented by: and determining the proportionality coefficient stored in the target storage address by taking the numerical value as the target storage address.

The read numerical value of the preset digit range in the maximum number first scale number can be used as a target storage address to be inquired, and then the proportionality coefficient stored in the target storage address can be searched from the first storage module.

Specifically, the 25 th to 15 th digits of the maximum number of binary numbers can be read by max [24:14] to serve as a destination storage address to be queried, and then addressing can be performed from the first storage module to search the destination storage address in the first storage module, so that the scaling factor stored in the destination storage address can be obtained.

Step 105: and drawing the histogram according to the height of the histogram to be drawn, the gray scale to be drawn and the proportion coefficient.

In the embodiment of the present invention, optionally, the step may be specifically implemented by:

drawing a first gray scale corresponding to the maximum number according to the height of the histogram to be drawn;

for any second gray scale to be drawn except the first gray scale, multiplying the number of pixels corresponding to the second gray scale by the proportional coefficient to obtain a second product;

determining the quotient of the second product and the preset coefficient to obtain the column height corresponding to the second gray scale;

and drawing a histogram according to the column height corresponding to the second gray scale.

And for the first gray scale corresponding to the maximum number max, drawing the first gray scale as the highest height allowed by the effective drawing area, namely the height of the histogram to be drawn. For the RGB separate histogram, the column height of the first gray scale corresponding to the maximum number max may be plotted as the histogram height to be plotted 256. For the RGB fused histogram and the luminance histogram, the column height of the first gray scale corresponding to the maximum number max may be plotted as the height 896 of the histogram to be plotted, instead of the value 1024 of the height of the histogram to be plotted used in the calculation.

In addition, for any second gray scale to be drawn except the first gray scale, namely, the gray scale with the pixel number smaller than the max, a second product of the pixel number corresponding to the second gray scale and the proportionality coefficient is determined, and then a quotient of the second product and a preset coefficient can be determined, so that the column height corresponding to the second gray scale is obtained. Since each reciprocal was previously expanded to an integer by a preset coefficient for ease of calculation and storage, thereby expanding the scaling coefficient by a multiple of the preset coefficient, at this point, the quotient of the second product and the preset coefficient may be determined again, thereby reducing the second product by a multiple of the preset coefficient. Simply put, the reciprocal of the middle value of the numerical range is expanded by 2nMultiple to integer, multiply with the number m of pixels of certain gray scale, and reduce by 2nAnd (5) returning the column height of the gray scale to the correct range. Then, based on the column height corresponding to the second gray scale narrowed back to the correct range,and drawing a column corresponding to the second gray level in the histogram.

In the RGB fusion histogram and the luminance histogram, when the column height corresponding to the second gray scale is represented as a binary value, all of the latter 7 positions should be set to 0 so that the column height does not exceed 896.

In addition, optionally, the number of pixels corresponding to each gray level may be read from a second storage module, such as a RAM.

In the embodiment of the invention, because the column corresponding to the maximum number is drawn as the allowed maximum height, and the heights of other columns can be distributed according to the scaling of the column heights corresponding to the maximum number, the drawn histogram can keep appropriate height no matter what display image is received, and dynamic height adjustment is realized, so that the effective drawing height is basically concentrated at the waist of the histogram, thereby clearly showing the gray scale concentration condition of the display image and facilitating analysis processing.

Further optionally, the step of drawing a histogram according to the column height corresponding to the second gray scale may specifically include:

subtracting the height of the histogram to be drawn from the height of the column corresponding to the second gray scale to obtain the height from the top of the column of the second gray scale to the height of the histogram to be drawn;

drawing the column top of the second gray scale to a blank area at the height of the histogram to be drawn according to the blank height;

and when the drawing of the margin area is finished, drawing the column shape of the second gray scale according to the column height corresponding to the second gray scale.

Referring to fig. 6, since the number of pixels represented by a column is counted from bottom to top when the histogram is drawn, but the drawing timing is similar to the display timing and is drawn from top to bottom, for a second gray scale with a column height smaller than the height of the histogram to be drawn, a blank area above the column needs to be drawn first, and then the column needs to be drawn. Correspondingly, the height of the margin area above the column needs to be determined, and after the margin area is drawn, the column below the margin area is drawn according to the height of the column.

Specifically, the difference between the heights of the columns of the to-be-drawn histogram and the height of the column corresponding to the second gray scale may be determined, that is, the height from the top of the effective drawing area to the top of the column of the second gray scale is determined, and the height of the effective drawing area is the height of the blank area above the column of the second gray scale. And then, drawing a blank area above the column shape of the second gray scale according to the blank height, and drawing the column shape of the second gray scale according to the column height corresponding to the second gray scale after the blank area is drawn.

During drawing, counting is performed from top to bottom, for example, the blank height should be drawn for 96 pixels, when the count is less than 96, the blank area should be drawn, and when the count is greater than or equal to 96, the column should be drawn.

Further optionally, in a case that the preset coefficient is an nth power of 2, the determining a quotient of the second product and the preset coefficient to obtain the column height corresponding to the second gray scale may specifically include: and expressing the second product by binary to obtain a second product binary number, and right-shifting the second product binary number by N bits to obtain the column height corresponding to the second gray scale.

In the case that the predetermined coefficient is the nth power of 2, the binary number right shift is used as a rule of division operation, the second product is represented as a second product binary number by the binary number, and the second product binary number is right-shifted by N bits, which is equivalent to dividing the second product by the predetermined coefficient, so that the value obtained by right shift can be determined as the column height corresponding to the second gray scale. Therefore, division operation of large numerical values can be avoided, and system resources of equipment are saved.

Referring to fig. 2 and 3, a 1920 × 1080 histogram image is finally drawn, wherein 512 grayscales are represented by 3 pixels each, and the horizontal direction is exactly 512 × 3 — 1536.

In summary, the main flow of drawing the histogram can be summarized as: after the maximum number max of pixels of the display image is first counted and max is expressed by binary, the 25 th to 15 th bits can be read from the maximum number binary. The read value can then be used as the destination memory address, and the scaling factor (expanded by 2) stored in the destination memory address can be searched from the ROMnMultiple times), then histogram drawing can be carried out, specifically, for the column shape of the first gray scale corresponding to max, the column shape can be directly drawn as the maximum height allowed by the effective drawing area, for other second gray scales with the number of pixels smaller than max, the number of pixels corresponding to the second gray scale can be multiplied by a scale factor, and then the column shape is reduced by 2nAnd multiplying to obtain the column height corresponding to the second gray scale, and then drawing the column shape of the second gray scale according to the column height, thereby drawing a histogram.

In the embodiment of the invention, the gray-scale value of each target pixel in the display image can be determined, then the number of pixels of each preset gray-scale level is determined according to the gray-scale value of each target pixel, then the maximum number in each pixel number can be represented by a first system, the maximum number first system number is obtained, the numerical value in the range of the preset digit number in the maximum number first system number is read, then the proportional coefficient corresponding to the numerical value can be searched, and finally the histogram can be drawn according to the height of the histogram to be drawn, the gray scale to be drawn and the searched proportional coefficient. In the embodiment of the invention, the proportion coefficient required by drawing can be determined according to the maximum pixel number in the gray scale, and the column heights corresponding to the gray scale to be drawn are drawn according to the proportion coefficient, so that the column heights can be distributed in proportion, therefore, in the drawn histogram, the higher column height and the lower column height can keep the display height appropriate, the effective drawing height is basically concentrated at the waist of the histogram, the gray scale concentration condition of the display image can be clearly shown, and the analysis processing is convenient.

The embodiment of the invention also discloses a display device, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein when the computer program is executed by the processor, the steps of the image drawing method are realized.

The embodiment of the invention also discloses a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the image drawing method are realized.

While, for purposes of simplicity of explanation, the foregoing method embodiments have been described as a series of acts or combination of acts, it will be appreciated by those skilled in the art that the present invention is not limited by the illustrated ordering of acts, as some steps may occur in other orders or concurrently with other steps in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.

The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.

Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.

The image drawing method, the display device and the storage medium provided by the invention are described in detail, and the principle and the implementation mode of the invention are explained by applying specific examples, and the description of the embodiments is only used for helping to understand the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种音乐钢琴的音弦校准装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类