Global and local flicker suppression method and system and storage medium
By extracting image blocks in the image frame sequence, determining whether local smoothing between frames is required and local smoothing weights are calculated, the problem of local contrast enhancement effect and detail loss caused by flicker suppression in the prior art is solved, and adaptive flickering is achieved Suppression effect.
Patent Information
- Application Number
- CN202411281607.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-09-13
AI Technical Summary
When suppressing image flicker, the prior art usually results in less obvious local contrast enhancement effect or loss of image details, and it is difficult to adaptively determine whether smoothing is required, resulting in unnecessary loss of detail.
By extracting image blocks from the image frame sequence, we determine whether local smoothing is required between frames, calculate local smoothing weights, and generate correction control parameters according to the preset method, and only image blocks that need smoothing are performed. Handle to avoid unnecessary loss of detail.
It effectively suppresses the flickering phenomenon caused by chunking, while retaining the local contrast enhancement effect, avoiding the loss of details when the scene changes dramatically, and achieving adaptive smoothing processing.
Smart Images

Figure CN119251082A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular relates to a global plus local flicker suppression method, system and storage medium. Background Art
[0002] In visual display technology, "flicker" usually refers to the rapid and irregular changes in the brightness or color of an image. Flicker suppression methods are needed to deal with flicker problems in the entire image (global) and in specific areas of the image (local).
[0003] In the existing block-based local contrast enhancement methods, in order to avoid flickering, it is usually achieved by reducing the number of image blocks. This solution increases the number of pixels contained in each image block to avoid drastic changes in the pixel distribution of the image block as small targets enter and exit. However, the fewer the number of blocks, the smaller the effect of local contrast enhancement will be, and there are certain side effects. In addition, there are also some methods that suppress flickering by increasing the global brightness and contrast smoothing, but when the scene changes drastically, it will cause abnormal brightness and contrast parameters used in the current scene, resulting in loss of image details in a shorter period of time, or some image blocks are smoothed when they do not need to be smoothed, resulting in loss of details.
[0004] However, the method of reducing the number of blocks in the above-mentioned prior art will result in unclear local contrast enhancement, and the method of global brightness and contrast smoothing will easily lead to the loss of local details. Summary of the invention
[0005] In order to solve the above problems, it is necessary to provide a global plus local flicker suppression method, which can effectively suppress the flicker phenomenon caused by block segmentation while ensuring the local contrast enhancement effect, and at the same time perform simple adaptive judgment on the scene, and only smooth the image blocks that need to be smoothed, so as to further avoid the loss of details caused by smoothing. The present invention provides a global plus local flicker suppression method, system and storage medium to solve the problems in the prior art.
[0006] In order to achieve the above-mentioned object of the invention, the present invention proposes a global plus local flicker suppression method, comprising:
[0007] S1: extracting a frame of image from an image frame sequence and setting it as an analysis image, setting a frame of image previous to the analysis image as a comparison image, and dividing the analysis image and the comparison image into a plurality of image blocks based on a preset selection frame;
[0008] S2: Determine whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3. If not, set the mapping relationship function of each image block based on a preset method, and calculate the mapping control parameters of all the image blocks.
[0009] S3: Counting the differences between the previous and next frames of all the image blocks based on the comparison image, calculating the local smoothing weights of all the image blocks in the analysis image, smoothing the mapping control parameters of the image blocks based on the local smoothing weights, and calculating the corrected control parameters, setting them as corrected control parameters, completing the local smoothing process, and generating an enhanced image corresponding to the analysis image based on the preset method and the corrected control parameter mapping;
[0010] S4: assigning all the correction control parameters to the mapping control parameters of the comparison image for smoothing calculation of the next frame image corresponding to the analysis image.
[0011] Furthermore, the step of setting the mapping relationship function of each image block based on a preset method comprises the following steps:
[0012] Based on the first formula, the image block is mapped to generate an image block with local contrast enhancement, which is set as the local enhanced image block. The mapping relationship function is set based on the first formula, and the first formula is: y1=f p (x1), wherein x1 is the input data corresponding to the image block, y1 is the output data corresponding to the local enhanced image block, f is the mapping relationship function, and p is the mapping control parameter.
[0013] Furthermore, the preset method includes a linear method and a histogram equalization method. If the preset method is set to the linear method, the mapping control parameters include a brightness parameter and a contrast parameter. If the preset method is set to the histogram equalization method, the mapping control parameters include a complete mapping table.
[0014] Furthermore, the determining whether the analyzed image needs to be locally smoothed between frames comprises the following steps:
[0015] Accumulating and counting the number of pixels corresponding to all the same pixel grayscales in the analysis image and the comparison image, respectively, setting them as a first number and a second number, generating a cumulative histogram of the analysis image based on the first number corresponding to all pixel grayscales, and generating a cumulative histogram of the comparison image based on the second number corresponding to all pixel grayscales;
[0016] The scene difference value delt between the analysis image and the comparison image is calculated based on a second formula, where the second formula is: Wherein, H is the total number of column pixels in the analysis image, W is the total number of row pixels in the analysis image, i is an integer from 0 to 16383, i represents the pixel grayscale, hist_cur(i) is the first number corresponding to the pixel grayscale i in the cumulative histogram of the analysis image, and hist_last(i) is the second number corresponding to the pixel grayscale i in the cumulative histogram of the comparison image;
[0017] If the scene abnormal value is greater than a first threshold, it is determined that the analysis image does not need to be subjected to inter-frame local smoothing processing; otherwise, it is determined that the analysis image needs to be subjected to inter-frame local smoothing processing.
[0018] Furthermore, the calculating of the local smoothing weights of all the image blocks comprises the following steps:
[0019] Based on the second formula, the difference between the previous and next frames of the image block at the same position in the analysis image and the comparison image is counted, and if the difference between the previous and next frames of the image block is greater than a second threshold, the image block in the analysis image is set as the image block to be smoothed;
[0020] The local smoothing weight g of the image block to be smoothed is calculated based on the third formula, and the third formula is: Wherein, e is an exponential function, Δm is the absolute value of the difference between the grayscale means of the image block to be smoothed at the same position in the analysis image and the comparison image, and mTh is a local smoothing strength control parameter.
[0021] Further, calculating the modified control parameter includes:
[0022] The local smoothing weights corresponding to all the image blocks to be smoothed in the analysis image are calculated, and local smoothing processing of the image blocks to be smoothed is completed based on a smoothing calculation formula, where the smoothing calculation formula is: Among them, p cor is the modified control parameter, p last is the mapping relationship control parameter corresponding to the contrast image, p cur is the mapping relationship control parameter corresponding to the analysis image, g is the local smoothing weight of the image block to be smoothed, and G is the global smoothing weight.
[0023] Further, the generating the enhanced image corresponding to the analyzed image based on the preset method and the modified control parameter mapping includes:
[0024] If the preset method is a linear method, the types of the correction control parameters include brightness correction and contrast correction, brightness correction control parameters and contrast correction control parameters are generated based on the smoothing calculation formula, and the pixel value y2 corresponding to the enhanced image is calculated based on the mapping formula, and the mapping formula is: Among them, x2 is the input data corresponding to the image block to be smoothed, c cor is the contrast correction control parameter, b cor is the brightness correction control parameter, c last is the contrast control parameter corresponding to the contrast image, c cur is the contrast control parameter corresponding to the analysis image, b last is the brightness control parameter corresponding to the contrast image, b cur is a brightness control parameter corresponding to the analyzed image;
[0025] If the preset method is a histogram equalization method, a mapping table is constructed, a plurality of correction control parameters are generated based on the mapping table, and all the correction control parameters are mapped to the pixel values of the image block to be smoothed based on a cumulative distribution function to generate pixel values corresponding to the enhanced image.
[0026] Furthermore, the larger the value corresponding to the local smoothing weight is, the greater the local smoothness of the analysis image is, and the stronger the flicker suppression capability is.
[0027] The present invention also provides a global plus local flicker suppression system, which is used to implement the global plus local flicker suppression method described above. The system mainly includes:
[0028] An image acquisition module extracts an image frame from an image frame sequence and sets it as an analysis image, sets an image frame previous to the analysis image as a comparison image, and divides the analysis image and the comparison image into a plurality of image blocks based on a preset selection frame;
[0029] A global judgment module determines whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3; if not, set the mapping relationship function of each image block based on a preset method and calculate the mapping control parameters of all the image blocks;
[0030] A smoothing processing module, which counts the differences between the previous and next frames of all the image blocks based on the comparison image, calculates the local smoothing weights of all the image blocks in the analysis image, smoothes the mapping control parameters of the image blocks based on the local smoothing weights, calculates the corrected control parameters, sets them as corrected control parameters, completes the local smoothing processing, and generates an enhanced image corresponding to the analysis image based on the preset method and the corrected control parameter mapping;
[0031] The image output module assigns all the correction control parameters to the mapping control parameters of the comparison image for smoothing calculation of the next frame image corresponding to the analysis image.
[0032] The present invention also provides a computer storage medium storing program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above-mentioned global plus local flicker suppression method.
[0033] Compared with the prior art, the beneficial effects of the present invention are at least as follows:
[0034] The present invention can adaptively determine whether smoothing is needed according to the scene, and prevent the loss of details caused by smoothing when the scene changes drastically. At the same time, a global plus local smoothing method is adopted to fine-tune the smoothing weight for each image block, which can better retain the enhancement effect advantage of the local contrast enhancement method based on block division. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of the steps of a global plus local flicker suppression method of the present invention;
[0036] Figure 2 This is a structural diagram of a global plus local flicker suppression system of the present invention. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0038] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.
[0039] like Figure 1 As shown, a global plus local flicker suppression method includes:
[0040] S1: extracting a frame of image from the image frame sequence and setting it as the analysis image, setting the previous frame of image of the analysis image as the comparison image, and dividing both the analysis image and the comparison image into a plurality of image blocks based on a preset selection frame.
[0041] Specifically, in this embodiment, the image frame sequence is a sequence set generated by sequentially combining images corresponding to multiple adjacent frames, such as a video image, wherein the comparison image and the analysis image are upper and lower frame images adjacent to each other. The preset selection box is used to randomly divide each image into a preset size, and the image block refers to the image corresponding to any segmented area in the analysis image.
[0042] S2: Determine whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3. If not, set the mapping relationship function of each image block based on a preset method and calculate the mapping control parameters of all image blocks.
[0043] Specifically, in this embodiment, local smoothing between frames means that by comparing and analyzing the differences between consecutive frames, local flickering can be effectively analyzed. If necessary, local image processing, i.e., local smoothing processing, is performed according to step S3 to generate an enhanced image corresponding to the analysis image. Otherwise, it is necessary to complete the mapping processing of the global image to generate an enhanced image corresponding to the analysis image, wherein the enhanced image refers to an image after flicker suppression. The preset method refers to a mapping algorithm adopted by a preset mapping relationship function, including but not limited to a linear method and a histogram equalization method, wherein the mapping relationship function refers to a mapping function formula corresponding to the preset method, and the mapping control parameter refers to a parameter used to control the mapping relationship function.
[0044] S3: Based on the comparison image, the differences between the previous and next frames of all image blocks are counted, and the local smoothing weights of all image blocks in the analysis image are calculated. Based on the local smoothing weights, the mapping control parameters of the image blocks are smoothed, and the corrected control parameters are calculated and set as the corrected control parameters to complete the local smoothing process. Based on the preset method and the corrected control parameter mapping, an enhanced image corresponding to the analysis image is generated.
[0045] Specifically, in this embodiment, if the analyzed image needs to be locally smoothed, it is necessary to statistically analyze the difference between the previous and next frames of all image blocks in the image by comparing the images, wherein the difference between the previous and next frames refers to the amount of change in the pixel value in the image block. The local smoothing weight refers to a weight parameter used to balance the smoothness of the local area and the retention of details, and is statistically calculated by the difference between the previous and next frames of the image block. The correction control parameter refers to the correction value corresponding to the mapping control parameter after the smoothing process, which is the value used for the smoothing process, that is, the local smoothing process is completed based on the correction control parameter. Then, the mapping of the image block is completed by the preset method and the correction control parameter to generate an enhanced image.
[0046] S4: assigning all correction control parameters to the mapping control parameters of the comparison image for smoothing calculation of the next frame image corresponding to the analysis image.
[0047] Specifically, in this embodiment, after the mapping is completed, the calculated correction control parameters need to be assigned to the mapping control parameters of the previous frame image for use in the smoothing calculation of the next frame of the image analysis. Steps S1 to S4 are repeated to complete the flicker suppression of all images in the image frame sequence.
[0048] As a preferred technical solution of the present invention, setting the mapping relationship function of each image block based on a preset method includes the following steps:
[0049] Based on the first formula, the image block is mapped to generate an image block with local contrast enhancement, which is set as the local enhanced image block. The mapping relationship function is set based on the first formula. The first formula is: y1=f p (x1), where x1 is the input data corresponding to the image block, y1 is the output data corresponding to the local enhanced image block, f is the mapping relationship function, and p is the mapping control parameter.
[0050] Specifically, in this embodiment, y1 in the first formula is the output data generated by the f function, where the f function is set by the mapping control parameter. Since the mapping control parameter p is calculated in real time according to the data of each frame, it is easy for the calculated data of the previous and next frames to change dramatically, resulting in flickering of the picture, so a block-based local contrast enhancement method is needed to suppress flicker.
[0051] As a preferred technical solution of the present invention, the preset method includes a linear method and a histogram equalization method. If the preset method is set to the linear method, the mapping control parameters include a brightness parameter and a contrast parameter. If the preset method is set to the histogram equalization method, the mapping control parameters include a complete mapping table.
[0052] Specifically, for example, if the preset method is a linear method, the first formula may be set as: y1=c×x1+b, wherein c and b are respectively a contrast parameter and a brightness parameter included in the mapping control parameter p.
[0053] As a preferred technical solution of the present invention, judging and analyzing whether the image needs to be locally smoothed between frames includes the following steps:
[0054] The number of pixels corresponding to all the same pixel grayscales in the analysis image and the comparison image are respectively accumulated and statistically set as a first number and a second number. Based on the first number corresponding to the grayscales of all pixels, a cumulative histogram of the analysis image is generated. Based on the second number corresponding to the grayscales of all pixels, a cumulative histogram of the comparison image is generated.
[0055] The scene difference value delt between the analysis image and the comparison image is calculated based on the second formula, and the second formula is: Wherein, H is the total number of column pixels in the analysis image, W is the total number of row pixels in the analysis image, i is an integer from 0 to 16383, i represents the pixel grayscale, hist_cur(i) is the first number corresponding to the pixel grayscale i in the cumulative histogram of the analysis image, and hist_last(i) is the second number corresponding to the pixel grayscale i in the cumulative histogram of the comparison image.
[0056] If the scene abnormality value is greater than the first threshold, it is determined that the analysis image does not need to be subjected to inter-frame local smoothing processing; otherwise, it is determined that the analysis image needs to be subjected to inter-frame local smoothing processing.
[0057] Specifically, in this embodiment, the analysis image and the comparison image are images of adjacent upper and lower frames, so there will be similarities. Pixel grayscale refers to the gray level or gray value of a single pixel, and cumulative statistics refers to accumulating the number of pixels belonging to the same pixel grayscale in the analysis image and the comparison image, respectively, to generate a first number corresponding to the analysis image and a second number corresponding to the comparison image. For example, if the total number of pixels with a pixel grayscale of 12 in the analysis image is 10, then the first number is 10. Cumulative histogram refers to setting the value corresponding to the pixel grayscale as the horizontal axis variable, setting the value corresponding to the first number or the second number as the vertical axis value, and drawing the generated histogram by the horizontal axis variable and the vertical axis value, so as to generate the cumulative histogram of the analysis image and the cumulative histogram of the comparison image respectively.
[0058] After completing the cumulative histogram statistics of the previous and next frames, it is necessary to calculate the scene difference between the previous and next frame images based on the cumulative histogram of the previous and next frames, that is, the scene difference value. 16383 is the maximum value of 14-bit data, which means that the 14-bit grayscale image contains 2 14 different levels, namely 0 to 16383, therefore, the value range of the pixel grayscale i in the second formula is 0 to 16383.
[0059] When the scene difference value delt is greater than the set first threshold, it means that the scene changes dramatically. At this time, even if there is flicker, local smoothing processing is not required. The mapping control parameters calculated in step S1 are directly used for mapping to obtain an enhanced image, that is, an enhanced image. Otherwise, local smoothing processing is required.
[0060] As a preferred technical solution of the present invention, calculating the local smoothing weights of all image blocks includes the following steps:
[0061] The difference between the previous and next frames of the image block at the same position in the analysis image and the comparison image is counted based on the second formula. If the difference between the previous and next frames of the image block is greater than a second threshold, the image block in the analysis image is set as the image block to be smoothed.
[0062] The local smoothing weight g of the image block to be smoothed is calculated based on the third formula, and the third formula is: Wherein, e is an exponential function, Δm is the absolute value of the difference between the grayscale mean values of the image blocks to be smoothed at the same position in the analysis image and the comparison image, and mTh is a local smoothing strength control parameter.
[0063] Specifically, in this embodiment, if the image block in the analyzed image needs to be locally smoothed, the scene difference value of all image blocks, that is, the difference between the previous and next frames, can be calculated based on the second formula. If it is greater than the set second threshold, the image block needs to be smoothed, and therefore, the image block is set as the image block to be smoothed.
[0064] In the third formula, the larger the value of the local smoothing strength control parameter mTh is, the greater the degree of local smoothing is and the stronger the ability to suppress flicker is.
[0065] As a preferred technical solution of the present invention, calculating the corrected control parameter includes:
[0066] The local smoothing weights corresponding to all the image blocks to be smoothed in the image are calculated and analyzed, and the local smoothing processing of the image blocks to be smoothed is completed based on the smoothing calculation formula. The smoothing calculation formula is: Among them, p cor To correct the control parameters, p last is the mapping relationship control parameter corresponding to the contrast image, p cur To analyze the mapping relationship control parameters corresponding to the image, g is the local smoothing weight of the image block to be smoothed, and G is the global smoothing weight.
[0067] Specifically, in this embodiment, the global smoothing weight refers to a parameter or coefficient used to control the smoothness of the entire image in image processing. The larger the value, the greater the global smoothness and the stronger the ability to suppress flicker. last It refers to the value calculated by comparing the image, analyzing the mapping relationship corresponding to the image to control the parameter p cur Refers to the value calculated from the analyzed image.
[0068] As a preferred technical solution of the present invention, generating an enhanced image corresponding to the analysis image based on a preset method and a modified control parameter mapping includes:
[0069] If the preset method is a linear method, the types of correction control parameters include brightness correction and contrast correction. Brightness correction control parameters and contrast correction control parameters are generated based on the smoothing calculation formula, and the pixel value y2 corresponding to the enhanced image is calculated based on the mapping formula. The mapping formula is: Among them, x2 is the input data corresponding to the image block to be smoothed, c cor is the contrast correction control parameter, bcor is the brightness correction control parameter, c last is the contrast control parameter corresponding to the contrast image, c cur To analyze the contrast control parameters corresponding to the image, b last is the brightness control parameter corresponding to the contrast image, b cur The brightness control parameters corresponding to the analyzed image.
[0070] If the preset method is the histogram equalization method, a mapping table is constructed, a plurality of correction control parameters are generated based on the mapping table, and all the correction control parameters are mapped to the pixel values of the image block to be smoothed based on the cumulative distribution function to generate pixel values corresponding to the enhanced image.
[0071] Specifically, taking the linear method as an example, after calculating the corrected mapping relationship control parameters, it is necessary to perform mapping to obtain the final enhanced image, that is, use the contrast correction control parameters and the brightness correction control parameters to perform local smoothing on the analysis image to generate the corresponding enhanced image. If the histogram equalization method is used, it is necessary to construct a mapping table according to the number of parameters, and then use the cumulative distribution function to generate new pixel values, and the enhanced image is composed of the new pixel values. Among them, the mapping table refers to a numerical set table generated after mapping multiple types of parameters between the contrast image and the analysis image. The cumulative distribution function is another way of expressing probability distribution. It accumulates the probability of each possible value of the random variable and all values below this value, where the random variable is the parameter variable corresponding to the mapping table.
[0072] As a preferred technical solution of the present invention, the larger the value corresponding to the local smoothness weight is, the greater the local smoothness of the analyzed image is, and the stronger the flicker suppression capability is.
[0073] Specifically, the global smoothing weight only affects the global smoothing degree, and the local smoothing weight only affects the local smoothing degree.
[0074] like Figure 2 As shown, the present invention also provides a global plus local flicker suppression system, which is used to implement the above-mentioned global plus local flicker suppression method, and the system mainly includes:
[0075] The image acquisition module extracts a frame of image from the image frame sequence and sets it as the analysis image, sets the previous frame of image of the analysis image as the comparison image, and divides the analysis image and the comparison image into multiple image blocks based on a preset selection frame.
[0076] The global judgment module judges whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3. If not, set the mapping relationship function of each image block based on the preset method and calculate the mapping control parameters of all image blocks.
[0077] The smoothing processing module counts the differences between the previous and next frames of all image blocks based on the comparison image, calculates the local smoothing weights of all image blocks in the analysis image, smoothes the mapping control parameters of the image blocks based on the local smoothing weights, calculates the corrected control parameters, sets them as the corrected control parameters, completes the local smoothing processing, and generates an enhanced image corresponding to the analysis image based on the preset method and the corrected control parameter mapping.
[0078] The image output module assigns all correction control parameters to the mapping control parameters of the comparison image, which is used for smoothing calculation of the next frame image corresponding to the analysis image.
[0079] The present invention also provides a computer storage medium storing program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above-mentioned global plus local flicker suppression method.
[0080] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0081] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program. The above-mentioned program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0082] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0083] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for those of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
[0084] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A global plus local flicker suppression method, characterized in that: The method comprises the following steps: S1: extracting a frame of image from an image frame sequence and setting it as an analysis image, setting a frame of image previous to the analysis image as a comparison image, and dividing the analysis image and the comparison image into a plurality of image blocks based on a preset selection frame; S2: Determine whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3. If not, set the mapping relationship function of each image block based on a preset method, and calculate the mapping control parameters of all the image blocks. S3: Counting the differences between the previous and next frames of all the image blocks based on the comparison image, calculating the local smoothing weights of all the image blocks in the analysis image, smoothing the mapping control parameters of the image blocks based on the local smoothing weights, and calculating the corrected control parameters, setting them as corrected control parameters, completing the local smoothing process, and generating an enhanced image corresponding to the analysis image based on the preset method and the corrected control parameter mapping; S4: assigning all the correction control parameters to the mapping control parameters of the comparison image for smoothing calculation of the next frame image corresponding to the analysis image.
2. The method according to claim 1, characterized in that The step of respectively setting the mapping relationship function of each image block based on a preset method comprises the following steps: Based on the first formula, the image block is mapped to generate an image block with local contrast enhancement, which is set as the local enhanced image block. The mapping relationship function is set based on the first formula, and the first formula is: y1=f p (x1), wherein x1 is the input data corresponding to the image block, y1 is the output data corresponding to the local enhanced image block, f is the mapping relationship function, and p is the mapping control parameter.
3. The method according to claim 2, characterized in that The preset method includes a linear method and a histogram equalization method. If the preset method is set to the linear method, the mapping control parameter includes a brightness parameter and a contrast parameter. If the preset method is set to the histogram equalization method, the mapping control parameter includes a complete mapping table.
4. The method according to claim 1, characterized in that The determining whether the analyzed image needs to be locally smoothed between frames comprises the following steps: Accumulating and counting the number of pixels corresponding to all the same pixel grayscales in the analysis image and the comparison image, respectively, setting them as a first number and a second number, generating a cumulative histogram of the analysis image based on the first number corresponding to all pixel grayscales, and generating a cumulative histogram of the comparison image based on the second number corresponding to all pixel grayscales; The scene difference value delt between the analysis image and the comparison image is calculated based on a second formula, where the second formula is: Wherein, H is the total number of column pixels in the analysis image, W is the total number of row pixels in the analysis image, i is an integer from 0 to 16383, i represents the pixel grayscale, hist_cur(i) is the first number corresponding to the pixel grayscale i in the cumulative histogram of the analysis image, and hist_last(i) is the second number corresponding to the pixel grayscale i in the cumulative histogram of the comparison image; If the scene abnormal value is greater than a first threshold, it is determined that the analysis image does not need to be subjected to inter-frame local smoothing processing; otherwise, it is determined that the analysis image needs to be subjected to inter-frame local smoothing processing.
5. The method according to claim 4, characterized in that The calculating of the local smoothing weights of all the image blocks comprises the following steps: Based on the second formula, the difference between the previous and next frames of the image block at the same position in the analysis image and the comparison image is counted, and if the difference between the previous and next frames of the image block is greater than a second threshold, the image block in the analysis image is set as the image block to be smoothed; The local smoothing weight g of the image block to be smoothed is calculated based on the third formula, and the third formula is: Wherein, e is an exponential function, Δm is the absolute value of the difference between the grayscale means of the image block to be smoothed at the same position in the analysis image and the comparison image, and mTh is a local smoothing strength control parameter.
6. The method according to claim 5, characterized in that Calculating the modified control parameter includes: The local smoothing weights corresponding to all the image blocks to be smoothed in the analysis image are calculated, and local smoothing processing of the image blocks to be smoothed is completed based on a smoothing calculation formula, where the smoothing calculation formula is: Among them, p cor is the modified control parameter, p last is the mapping relationship control parameter corresponding to the contrast image, p cur is the mapping relationship control parameter corresponding to the analysis image, g is the local smoothing weight of the image block to be smoothed, and G is the global smoothing weight.
7. The method according to claim 6, characterized in that The generating of the enhanced image corresponding to the analyzed image based on the preset method and the modified control parameter mapping comprises: If the preset method is a linear method, the types of the correction control parameters include brightness correction and contrast correction, brightness correction control parameters and contrast correction control parameters are generated based on the smoothing calculation formula, and the pixel value y2 corresponding to the enhanced image is calculated based on the mapping formula, and the mapping formula is: Among them, x2 is the input data corresponding to the image block to be smoothed, c cor is the contrast correction control parameter, b cor is the brightness correction control parameter, c last is the contrast control parameter corresponding to the contrast image, c cur is the contrast control parameter corresponding to the analysis image, b last is the brightness control parameter corresponding to the contrast image, b cur is a brightness control parameter corresponding to the analyzed image; If the preset method is a histogram equalization method, a mapping table is constructed, a plurality of correction control parameters are generated based on the mapping table, and all the correction control parameters are mapped to the pixel values of the image block to be smoothed based on a cumulative distribution function to generate pixel values corresponding to the enhanced image.
8. A global plus local flicker suppression system, used to implement the method according to any one of claims 1 to 7, characterized in that: The system includes the following modules: An image acquisition module extracts an image frame from an image frame sequence and sets it as an analysis image, sets an image frame previous to the analysis image as a comparison image, and divides the analysis image and the comparison image into a plurality of image blocks based on a preset selection frame; A global judgment module determines whether the analyzed image needs to be locally smoothed between frames. If so, jump to S3; if not, set the mapping relationship function of each image block based on a preset method and calculate the mapping control parameters of all the image blocks; A smoothing processing module, which counts the differences between the previous and next frames of all the image blocks based on the comparison image, calculates the local smoothing weights of all the image blocks in the analysis image, smoothes the mapping control parameters of the image blocks based on the local smoothing weights, calculates the corrected control parameters, sets them as corrected control parameters, completes the local smoothing processing, and generates an enhanced image corresponding to the analysis image based on the preset method and the corrected control parameter mapping; The image output module assigns all the correction control parameters to the mapping control parameters of the comparison image for smoothing calculation of the next frame image corresponding to the analysis image.
9. A computer storage medium, characterized in that The computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Enhancement processing method and apparatus for traffic video image
CN105046677A
Multi-view depth video recovery method based on Kinect camera
CN106056622A
Image local contrast enhancement method for optimizing CLAHE
CN114092361A
Global contrast enhancement using block based local contrast improvement
KR1020090092909A
Image processing method and apparatus, storage medium and terminal
WO2021238655A1
