A method and device for image bit width conversion based on histogram statistics

By obtaining the gray histogram statistics results of the image frame and calculating the corrected values, the problem of lack of universality and image quality loss in the prior art image bit width conversion is solved, and high efficiency is achieved for different images Bit width conversion, suitable for infrared cameras.

CN118714333BActive Publication Date: 2024-11-19SICHUAN SDRISING INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411177946.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-27
Publication Date
2024-11-19
Estimated Expiration
2044-08-27

AI Technical Summary

Technical Problem

The prior art lacks versatility in image bit width conversion, making it difficult to adapt to images of different types and quality, resulting in image quality loss, especially during low bit width conversion.

Method used

By using the image bit width conversion method based on histogram statistics, the grayscale histogram statistics results of the image frame are obtained, the accumulation sum is determined and filtered, the grayscale minimum and maximum values ​​are obtained, and the correction value of each pixel is calculated to achieve Bit width conversion.

Benefits of technology

This method can easily adapt to the grayscale distribution characteristics of different images, reduce image quality loss, small calculation overhead, and occupies less logical resources. It is suitable for any bit width conversion of infrared cameras, making it convenient for subsequent image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714333B_ABST
    Figure CN118714333B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for image bit width conversion based on histogram statistics, which relate to the technical field of image processing. Based on grayscale histogram statistics, an image correction value is obtained, and bit width conversion is completed based on the image correction value. Complex operations such as image cutting are not required, the calculation overhead is small, the logical resources occupied are small, and the portability is strong. Any output bit width of an infrared camera can be converted very conveniently, which is convenient for subsequent image processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method and device for image bit width conversion based on histogram statistics. Background Art

[0002] With the rapid development of digital image processing technology, image data is increasingly used in various fields, such as medical imaging, remote sensing monitoring, security monitoring, etc. In the process of image data acquisition, transmission and storage, the demand for bandwidth and storage space is increasing. In order to improve the processing speed of image data and reduce storage costs, image compression and bit width conversion technology have become research hotspots. Among them, FPGA often encounters scenarios where bit width conversion is required when processing infrared camera image data, such as displaying a 14-bit infrared image with a bit width of 8 bits.

[0003] The existing technology often adopts a fixed bit width conversion method, which directly converts the bit width of the original image into a preset bit width, such as converting an 8-bit image into 6 or 4 bits. This method is simple and easy to implement, but it is difficult to adapt to the grayscale distribution characteristics of different images and easily leads to image quality loss. The bit width conversion method lacks versatility and is difficult to adapt to images of different types and qualities. During the bit width conversion process, the image quality loss is large, especially when converting low bit widths. Summary of the invention

[0004] The purpose of the present invention is to provide an image bit width conversion method and device based on histogram statistics, which solves the technical problems existing in the prior art.

[0005] The present invention is achieved through the following technical solutions:

[0006] On the one hand, the present invention provides an image bit width conversion method based on histogram statistics, comprising:

[0007] Acquire the image frame to be converted, and perform grayscale histogram statistical processing on the image frame to be converted to obtain the statistical result corresponding to the image frame to be converted;

[0008] Determining a histogram statistical cumulative sum based on the statistical results corresponding to the image frame to be converted, and filtering the histogram statistical cumulative sum to obtain a filtered histogram statistical cumulative sum;

[0009] Based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted, obtaining the minimum grayscale value and the maximum grayscale value;

[0010] Determining a correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value;

[0011] According to the grayscale minimum value, grayscale maximum value and the correction value corresponding to each pixel in the image frame to be converted, the bit width corresponding to the image frame to be converted is converted to the target bit width to complete the image bit width conversion.

[0012] In a possible implementation manner, grayscale histogram statistical processing is performed on the image frame to be converted to obtain statistical results corresponding to the image frame to be converted, including:

[0013] The pixel values ​​in each frame of the image are written into a defined one-dimensional array to obtain the statistical results corresponding to the image frame to be converted; wherein the data bit width in the statistical results is the grayscale value bit width of the image frame to be converted, and the elements are all grayscale values ​​in the grayscale range corresponding to the bit width of the image to be converted.

[0014] In a possible implementation manner, based on the statistical results corresponding to the image frame to be converted, the histogram statistical cumulative sum is determined as:

[0015] ;

[0016] in, Indicates the gray value is i The histogram statistics of Indicates grayscale values ​​from 0 to k The cumulative sum of the histogram.

[0017] In a possible implementation, filtering the histogram statistical cumulative sum to obtain a filtered histogram statistical cumulative sum includes:

[0018] Get the pre-configured grayscale accumulation and upper threshold up_sum and grayscale accumulation and lower threshold down_sum;

[0019] Determine the valid interval as [down_sum, up_sum];

[0020] The histogram statistical cumulative sum outside the valid interval is filtered out to obtain the filtered histogram statistical cumulative sum.

[0021] In a possible implementation manner, obtaining the minimum grayscale value and the maximum grayscale value based on the filtered histogram statistical cumulative sum and the bit width of the image frame to be converted includes:

[0022] Based on the cumulative sum of the filtered histogram statistics and the grayscale cumulative sum lower threshold down_sum, the grayscale minimum value A is determined; wherein the grayscale minimum value A satisfies , Sum(A) represents the grayscale value from 0 to A The histogram of the cumulative sum, Sum (A-1) represents the gray value from 0 to A -1's histogram cumulative sum;

[0023] Determine that the grayscale range corresponding to the bit width of the image frame to be converted is 0-C;

[0024] Based on the cumulative sum of the filtered histogram statistics, the grayscale cumulative sum upper threshold up_sum and the upper limit C of the grayscale range, the grayscale maximum value B is determined; wherein the grayscale maximum value B satisfies && , Indicates grayscale values ​​from 0 to B The cumulative sum of histograms, Indicates grayscale values ​​from 0 to B -1's histogram cumulative sum, Indicates the gray value is j Histogram statistics results.

[0025] In a possible implementation manner, determining the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value includes:

[0026] The gray value corresponding to the pixel in the image frame to be converted , determine the gray value corresponding to the pixel Less than the grayscale minimum value A, if so, determine the correction value corresponding to the pixel hist_diff is 0, otherwise a second judgment is performed;

[0027] Determine whether the grayscale value corresponding to the pixel is greater than the grayscale minimum value A and less than the grayscale maximum value B. If so, determine the correction value corresponding to the pixel hist_diff for Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and determine the correction value corresponding to the pixel hist_diff is D;

[0028] Wherein, D represents the upper limit of the grayscale value range corresponding to the target bit width.

[0029] In a possible implementation, converting the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value, and the correction value corresponding to each pixel in the image frame to be converted includes:

[0030] For the pixel in the image frame to be converted, determine whether the corrected grayscale value corresponding to the pixel is less than the grayscale minimum value A. If so, convert the grayscale value corresponding to the pixel into the corrected value. hist_diff , otherwise make a second judgment;

[0031] Determine whether the grayscale value corresponding to the pixel is greater than the minimum grayscale value A and less than the maximum grayscale value B. If so, convert the grayscale value corresponding to the pixel into Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and convert the gray value corresponding to the pixel into a correction value hist_diff ;

[0032] Traverse each pixel in the image frame to be converted, and convert the bit width corresponding to the image frame to be converted into the target bit width.

[0033] In a possible implementation, it further includes:

[0034] The image frames to be converted are acquired in a pipeline manner, and the image bit width conversion is performed on the image frames to be converted in a parallel processing manner.

[0035] In a possible implementation manner, after converting the bit width corresponding to the image frame to be converted into the target bit width, the method further includes: adjusting the output image timing to align the data with the timing.

[0036] On the other hand, the present invention provides an image bit width conversion device based on histogram statistics, comprising: a histogram processing module, an accumulation and filtering module, a grayscale interval acquisition module, a correction module and an image bit width conversion module;

[0037] The histogram processing module is used to obtain the image frame to be converted, and perform grayscale histogram statistical processing on the image frame to be converted to obtain the statistical result corresponding to the image frame to be converted;

[0038] The accumulation and filtering module is used to determine the histogram statistical accumulation sum based on the statistical results corresponding to the image frame to be converted, and filter the histogram statistical accumulation sum to obtain the filtered histogram statistical accumulation sum;

[0039] The grayscale interval acquisition module is used to obtain the grayscale minimum value and the grayscale maximum value based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted;

[0040] The correction module is used to determine the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value, so as to obtain the correction value corresponding to each pixel in the image frame to be converted;

[0041] The image bit width conversion module is used to convert the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value and the correction value corresponding to each pixel point in the image frame to be converted, so as to complete the image bit width conversion.

[0042] The present invention provides an image bit width conversion method and device based on histogram statistics, which obtain an image correction value based on grayscale histogram statistics, and complete the bit width conversion based on the image correction value. It does not require complex operations such as image cutting, has low calculation overhead, occupies less logical resources, and has strong portability. It can very conveniently convert any output bit width of an infrared camera, which is convenient for subsequent image processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope. For those of ordinary skill in the art, other relevant drawings can be obtained based on these drawings without creative work. In the drawings:

[0044] Figure 1 A flowchart of an image bit width conversion method based on histogram statistics is provided for Example 1 of the present invention.

[0045] Figure 2 An exemplary flow chart of an image bit width conversion method based on histogram statistics according to Embodiment 2 of the present invention is provided.

[0046] Figure 3 The present invention provides a histogram statistical result diagram of Example 2.

[0047] Figure 4 A structural schematic diagram of an image bit width conversion device based on histogram statistics is provided for Example 3 of the present invention.

[0048] Figure 5 A structural schematic diagram of an image bit width conversion device based on histogram statistics is provided for Example 4 of the present invention.

[0049] Marks and corresponding parts names in the attached drawings:

[0050] 401 - histogram processing module, 402 - accumulation and filtering module, 403 - grayscale interval acquisition module, 404 - correction module, 405 - image width conversion module, 501 - memory, 502 - processor, 503 - bus. DETAILED DESCRIPTION

[0051] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention.

[0052] Example 1.

[0053] like Figure 1 As shown, the present invention provides an embodiment of an image bit width conversion method based on histogram statistics, comprising:

[0054] S101, obtaining an image frame to be converted, and performing grayscale histogram statistical processing on the image frame to be converted to obtain a statistical result corresponding to the image frame to be converted;

[0055] S102, determining a histogram statistical cumulative sum based on the statistical result corresponding to the image frame to be converted, and filtering the histogram statistical cumulative sum to obtain a filtered histogram statistical cumulative sum;

[0056] S103, obtaining a grayscale minimum value and a grayscale maximum value based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted;

[0057] S104, determining a correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value;

[0058] S105 , converting the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value and the correction value corresponding to each pixel in the image frame to be converted, thereby completing the image bit width conversion.

[0059] In a possible implementation manner, grayscale histogram statistical processing is performed on the image frame to be converted to obtain statistical results corresponding to the image frame to be converted, including:

[0060] The pixel values ​​in each frame of the image are written into a defined one-dimensional array to obtain the statistical results corresponding to the image frame to be converted; wherein the data bit width in the statistical results is the grayscale value bit width of the image frame to be converted, and the elements are all grayscale values ​​in the grayscale range corresponding to the bit width of the image to be converted.

[0061] In a possible implementation manner, based on the statistical results corresponding to the image frame to be converted, the histogram statistical cumulative sum is determined as:

[0062] ;

[0063] in, Indicates the gray value is i The histogram statistics of Indicates grayscale values ​​from 0 to k The cumulative sum of the histogram.

[0064] In a possible implementation, filtering the histogram statistical cumulative sum to obtain a filtered histogram statistical cumulative sum includes:

[0065] Get the pre-configured grayscale accumulation and upper threshold up_sum and grayscale accumulation and lower threshold down_sum;

[0066] Determine the valid interval as [down_sum, up_sum];

[0067] The histogram statistical cumulative sum outside the valid interval is filtered out to obtain the filtered histogram statistical cumulative sum.

[0068] In a possible implementation manner, obtaining the minimum grayscale value and the maximum grayscale value based on the filtered histogram statistical cumulative sum and the bit width of the image frame to be converted includes:

[0069] Based on the cumulative sum of the filtered histogram statistics and the grayscale cumulative sum lower threshold down_sum, the grayscale minimum value A is determined; wherein the grayscale minimum value A satisfies , Indicates grayscale values ​​from 0 to A The cumulative sum of histograms, Indicates grayscale values ​​from 0 to A -1's histogram cumulative sum;

[0070] Determine that the grayscale range corresponding to the bit width of the image frame to be converted is 0-C;

[0071] Based on the cumulative sum of the filtered histogram statistics, the grayscale cumulative sum upper threshold up_sum and the upper limit C of the grayscale range, the grayscale maximum value B is determined; wherein the grayscale maximum value B satisfies && , Indicates grayscale values ​​from 0 to B The cumulative sum of histograms, Indicates grayscale values ​​from 0 to B -1's histogram cumulative sum, Indicates the gray value is j Histogram statistics results.

[0072] In a possible implementation manner, determining the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value includes:

[0073] The gray value corresponding to the pixel in the image frame to be converted , determine the gray value corresponding to the pixel Is it less than the grayscale minimum value A? If so, determine the correction value corresponding to the pixel point. hist_diff is 0, otherwise a second judgment is performed;

[0074] Determine whether the grayscale value corresponding to the pixel is greater than the grayscale minimum value A and less than the grayscale maximum value B. If so, determine the correction value corresponding to the pixel hist_diff for Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and determine the correction value corresponding to the pixel hist_diff is D;

[0075] Wherein, D represents the upper limit of the grayscale value range corresponding to the target bit width.

[0076] In a possible implementation, converting the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value, and the correction value corresponding to each pixel in the image frame to be converted includes:

[0077] For the pixel in the image frame to be converted, determine whether the corrected grayscale value corresponding to the pixel is less than the grayscale minimum value A. If so, convert the grayscale value corresponding to the pixel into the corrected value. hist_diff , otherwise make a second judgment;

[0078] Determine whether the grayscale value corresponding to the pixel is greater than the minimum grayscale value A and less than the maximum grayscale value B. If so, convert the grayscale value corresponding to the pixel into Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and convert the gray value corresponding to the pixel into a correction value hist_diff ;

[0079] For each pixel point in the image frame to be converted, the bit width corresponding to the image frame to be converted is converted into the target bit width.

[0080] In a possible implementation, it further includes:

[0081] The image frames to be converted are acquired in a pipeline manner, and the image bit width conversion is performed on the image frames to be converted in a parallel processing manner.

[0082] In a possible implementation manner, after converting the bit width corresponding to the image frame to be converted into the target bit width, the method further includes: adjusting the output image timing to align the data with the timing.

[0083] The present invention provides an image bit width conversion method based on histogram statistics, which obtains an image correction value based on grayscale histogram statistics and completes the bit width conversion based on the image correction value. It does not require complex operations such as image cutting, has low computational overhead, occupies few logical resources, and has strong portability. It can very conveniently convert any output bit width of an infrared camera, which is convenient for subsequent image processing.

[0084] Example 2.

[0085] This embodiment is a further example based on the first embodiment, and is explained by taking a specific case where the input image has a bit width of 14 bits and the target bit width is 8 bits.

[0086] like Figure 2 As shown, this embodiment provides an image bit width conversion method based on histogram statistics. This method is implemented using FPGA (Field-Programmable Gate Array). Different from the ISP (Image Signal Processor) module on the software processor, it can be more flexible and lightweight. FPGA has a natural advantage in processing image data streams. There is no need for separate window buffering, and a pipeline method is used to output frame by frame. The algorithm processing can be divided into the following 7 steps. Figure 2 The specific processing steps are as follows:

[0087] Grayscale histogram statistics: Write the pixel values ​​in each frame of the image into a defined one-dimensional array. The data bit width is the image grayscale value bit width (the grayscale value bit width is 14 bits as shown in the figure above), and the elements are all grayscale values ​​in the grayscale range corresponding to the image bit width to be converted.

[0088] Calculate the cumulative sum of histogram statistics: Calculate the arithmetic cumulative sum of each grayscale value of a frame of image input by pipeline: ,in, Indicates the gray value is i The histogram statistics of Indicates grayscale values ​​from 0 to k The cumulative sum of the histogram.

[0089] Set grayscale accumulation and upper and lower thresholds: configure grayscale accumulation and upper and lower thresholds down_sum and up_sum (usually designed as a percentage of the number of pixels in the entire frame image) through parameters, that is, the grayscale statistical results "falling" within the upper and lower thresholds are "valid" areas, and the results falling outside are filtered, mainly filtering salt and pepper noise in the image, that is, values ​​that are too large and too small that are very different from the grayscale values ​​of the overall image, to avoid noise causing image "distortion".

[0090] like Figure 3 As shown in the figure, the histogram statistics of a 14-bit grayscale image are shown. Points A and B are the lower and upper thresholds of the grayscale accumulation, respectively. The statistically valid area is between AB, and the upper and lower thresholds are set according to 5% of the number of pixels in the entire frame image.

[0091] Calculate the upper and lower grayscale range of the histogram: According to the threshold and histogram statistics, calculate the corresponding pixel grayscale value when the upper and lower thresholds are reached. down_sum is the grayscale accumulation and the lower threshold, and up_sum is the grayscale accumulation and the upper threshold, satisfying:

[0092] ;

[0093] ;

[0094] Among them, the 14-bit grayscale range is 0-16383; A is the minimum grayscale value corresponding to the lower grayscale threshold, and B is the maximum grayscale value corresponding to the upper grayscale threshold.

[0095] Determine the relationship between the current grayscale value and the grayscale range: Determine the relative position of the current grayscale value and the grayscale range of the histogram statistics to obtain the correction value:

[0096] ;

[0097] Among them, g(x,y) represents the grayscale value of the current pixel. When it "falls" between the valid area AB, the grayscale difference is the difference between the current grayscale value and the minimum grayscale value. When it is less than the minimum value, it is treated as 0 (the minimum value of 8-bit image mapping), and when it exceeds the maximum value, it is treated as 255 (the maximum value of 8-bit image mapping).

[0098] Grayscale value mapping: By calling the official divider IP, since the grayscale range of the 8-bit image is 0-255, the grayscale range of the 14-bit image is the grayscale difference (i.e., correction value) obtained in the previous step, the mapping process is performed according to the proportional relationship:

[0099] The calculation formula is as follows, That is the 8-bit image grayscale value after histogram mapping.

[0100] ;

[0101] Adjust output timing: adjust the output image timing, mainly to align data and timing.

[0102] The image bit width conversion method based on histogram statistics has the following advantages: it mainly converts image video streams in real time, does not require complex operations such as image cutting, has low computational overhead, occupies less logic resources, and is highly portable; the conversion speed is fast, and parallel processing is used inside the FPGA to achieve real-time processing. The algorithm uses a pipeline method. Taking a 100Mhz image clock as an example, the data stream processed by the algorithm can be obtained 270ns after the image is input (the first frame is pipeline input); FPGA has a rich image interface, and the algorithm can be used to easily convert any output bit width of the infrared camera, which is convenient for subsequent image processing; for different usage scenarios, the grayscale histogram threshold parameters can be dynamically configured.

[0103] Example 3.

[0104] like Figure 4As shown, the present invention provides an image bit width conversion device based on histogram statistics, comprising: a histogram processing module 401, an accumulation and filtering module 402, a grayscale interval acquisition module 403, a correction module 404 and an image bit width conversion module 405;

[0105] The histogram processing module 401 is used to obtain the image frame to be converted, and perform grayscale histogram statistical processing on the image frame to be converted to obtain the statistical result corresponding to the image frame to be converted;

[0106] The accumulation and filtering module 402 is used to determine the histogram statistical accumulation sum based on the statistical results corresponding to the image frame to be converted, and filter the histogram statistical accumulation sum to obtain the filtered histogram statistical accumulation sum;

[0107] The grayscale interval acquisition module 403 is used to acquire the grayscale minimum value and the grayscale maximum value based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted;

[0108] The correction module 404 is used to determine the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value, so as to obtain the correction value corresponding to each pixel in the image frame to be converted;

[0109] The image bit width conversion module 405 is used to convert the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value and the correction value corresponding to each pixel in the image frame to be converted, so as to complete the image bit width conversion.

[0110] The image bit width conversion device based on histogram statistics provided in this embodiment can implement the technical solution described in Example 1 or Example 2. Its principles and beneficial effects are similar and will not be repeated here.

[0111] like Figure 5 As shown, this embodiment provides an image bit width conversion device based on histogram statistics, including a memory 501 and a processor 502 , and the memory 501 and the processor 502 are connected to each other via a bus 503 .

[0112] The memory 501 stores computer executable instructions.

[0113] The processor 502 executes the computer-executable instructions stored in the memory, so that the processor executes the image bit width conversion method based on histogram statistics as described in Embodiment 1 or 2.

[0114] For example, the memory may include, but is not limited to, random access memory (RAM), read only memory (ROM), flash memory, first input first output (FIFO) and / or first in last out (FILO), etc. Specifically, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). At the same time, the processor may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state.

[0115] Example 4.

[0116] This embodiment provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement an image bit width conversion method based on histogram statistics as described in Embodiment 1 or 2.

[0117] Example 5.

[0118] An embodiment of the present application may also provide a computer program product, including a computer program, which, when executed by a processor, implements an image bit width conversion method based on histogram statistics as described in Embodiment 1 or 2.

[0119] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for image bit width conversion based on histogram statistics, characterized in that: include: Acquire the image frame to be converted, and perform grayscale histogram statistical processing on the image frame to be converted to obtain the statistical result corresponding to the image frame to be converted; Based on the statistical results corresponding to the image frame to be converted, determine the histogram statistical cumulative sum, and obtain a pre-configured grayscale cumulative sum upper threshold up_sum and a grayscale cumulative sum lower threshold down_sum; Determine the valid interval as [down_sum, up_sum]; The histogram statistical accumulation sum outside the valid interval is filtered out to obtain the filtered histogram statistical accumulation sum; Based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted, the minimum grayscale value and the maximum grayscale value are obtained, including: based on the statistical cumulative sum of the filtered histogram and the grayscale cumulative sum lower threshold down_sum, the minimum grayscale value A is determined; wherein the minimum grayscale value A satisfies , Sum(A) represents the grayscale value from 0 to A The histogram of the cumulative sum, Sum (A-1) represents the gray value from 0 to A -1; determine the grayscale range corresponding to the bit width of the image frame to be converted as 0-C; ​​determine the maximum grayscale value as B based on the statistical cumulative sum of the filtered histogram, the grayscale cumulative sum upper threshold up_sum and the upper limit C of the grayscale range; wherein the grayscale maximum value B satisfies && , Indicates grayscale values ​​from 0 to B The cumulative sum of histograms, Indicates grayscale values ​​from 0 to B -1's histogram cumulative sum, Indicates the gray value is j Histogram statistics of ; Determining the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value includes: The gray value corresponding to the pixel in the image frame to be converted , determine the gray value corresponding to the pixel Less than the grayscale minimum value A, if so, determine the correction value corresponding to the pixel hist_diff is 0, otherwise a second judgment is performed; Determine whether the grayscale value corresponding to the pixel is greater than the grayscale minimum value A and less than the grayscale maximum value B. If so, determine the correction value corresponding to the pixel hist_diff for Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and determine the correction value corresponding to the pixel hist_diff D is D; where D represents the upper limit of the grayscale value range corresponding to the target bit width; According to the grayscale minimum value, grayscale maximum value and the correction value corresponding to each pixel in the image frame to be converted, the bit width corresponding to the image frame to be converted is converted to the target bit width, and the image bit width conversion is completed, including: For the pixel in the image frame to be converted, determine whether the corrected grayscale value corresponding to the pixel is less than the grayscale minimum value A. If so, convert the grayscale value corresponding to the pixel into the corrected value. hist_diff , otherwise make a second judgment; Determine whether the grayscale value corresponding to the pixel is greater than the minimum grayscale value A and less than the maximum grayscale value B. If so, convert the grayscale value corresponding to the pixel into Otherwise, determine that the gray value corresponding to the pixel is greater than the gray value maximum value B, and convert the gray value corresponding to the pixel into a correction value hist_diff ; Traverse each pixel in the image frame to be converted, and convert the bit width corresponding to the image frame to be converted into the target bit width.

2. The image bit width conversion method based on histogram statistics according to claim 1, characterized in that: Perform grayscale histogram statistical processing on the image frame to be converted to obtain statistical results corresponding to the image frame to be converted, including: The pixel values ​​in each frame of the image are written into a defined one-dimensional array to obtain the statistical results corresponding to the image frame to be converted; wherein the data bit width in the statistical results is the grayscale value bit width of the image frame to be converted, and the elements are all grayscale values ​​in the grayscale range corresponding to the bit width of the image to be converted.

3. The image bit width conversion method based on histogram statistics according to claim 1, characterized in that: Based on the statistical results corresponding to the image frame to be converted, the histogram statistical cumulative sum is determined as: ; in, Indicates the gray value is i The histogram statistics of Indicates grayscale values ​​from 0 to k The cumulative sum of the histogram.

4. The image bit width conversion method based on histogram statistics according to claim 1, characterized in that: Also includes: The image frames to be converted are acquired in a pipeline manner, and the image bit width conversion is performed on the image frames to be converted in a parallel processing manner.

5. The image bit width conversion method based on histogram statistics according to claim 4 is characterized in that: After converting the bit width corresponding to the image frame to be converted into the target bit width, the method further includes: adjusting the output image timing to align the data with the timing.

6. A device for image bit width conversion based on histogram statistics, applied to the method for image bit width conversion based on histogram statistics according to any one of claims 1 to 5, characterized in that: include: Histogram processing module, accumulation and filtering module, grayscale interval acquisition module, correction module and image bit width conversion module; The histogram processing module is used to obtain the image frame to be converted, and perform grayscale histogram statistical processing on the image frame to be converted to obtain the statistical result corresponding to the image frame to be converted; The accumulation and filtering module is used to determine the histogram statistical accumulation sum based on the statistical results corresponding to the image frame to be converted, and filter the histogram statistical accumulation sum to obtain the filtered histogram statistical accumulation sum; The grayscale interval acquisition module is used to obtain the grayscale minimum value and the grayscale maximum value based on the statistical cumulative sum of the filtered histogram and the bit width of the image frame to be converted; The correction module is used to determine the correction value corresponding to each pixel in the image frame to be converted according to the grayscale minimum value and the grayscale maximum value, so as to obtain the correction value corresponding to each pixel in the image frame to be converted; The image bit width conversion module is used to convert the bit width corresponding to the image frame to be converted into the target bit width according to the grayscale minimum value, the grayscale maximum value and the correction value corresponding to each pixel point in the image frame to be converted, so as to complete the image bit width conversion.