Image enhancement method, device, electronic device and computer-readable storage medium

By obtaining the grayscale distribution information of the aluminum casting image, determining the equalization deviation coefficient and fusing the histogram equalization image, the problem of blurred details caused by aluminum casting image enhancement in the existing technology is solved, and an effective image enhancement effect is achieved.

CN120259091BActive Publication Date: 2025-09-09SHENZHEN XINRUN FULIAN DIGITAL TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510753249.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-06
Publication Date
2025-09-09
Estimated Expiration
2045-06-06

AI Technical Summary

Technical Problem

When existing image enhancement methods are used to enhance images of workpieces with low overall brightness and fine textures, such as aluminum castings, the grayscale of the bright areas is easily compressed, resulting in blurred or lost workpiece details.

Method used

By obtaining the grayscale distribution information of the image to be enhanced, determining the equalization deviation coefficient, and fusing the image to be enhanced with the histogram equalization image using the equalization deviation coefficient, a target enhanced image is generated.

Benefits of technology

It effectively preserves the details of the workpiece and achieves balanced intensity for images with low overall brightness and fine textures such as aluminum castings, avoiding blurring or loss of details.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120259091B_ABST
    Figure CN120259091B_ABST
Patent Text Reader

Abstract

The present invention proposes an image enhancement method, apparatus, electronic device, and computer-readable storage medium. The method includes the following steps: obtaining an image to be enhanced and determining grayscale distribution information of the image to be enhanced; determining an equalization deviation coefficient based on the grayscale distribution information; obtaining a histogram-equalized image corresponding to the image to be enhanced; and fusing the image to be enhanced with the histogram-equalized image using the equalization deviation coefficient to obtain a target enhanced image. By determining the grayscale distribution information of the image to be enhanced and determining an equalization deviation coefficient reflecting the grayscale balance based on the grayscale distribution information, the actual equalization requirements can be clarified. The image to be enhanced and the histogram-equalized image are then fused based on the equalization deviation coefficient, thereby achieving the desired equalization intensity and ensuring detail preservation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing, and in particular to an image enhancement method, device, electronic device and computer-readable storage medium. Background Art

[0002] In workpiece image acquisition, image enhancement is often performed through histogram equalization. However, for workpieces with low overall brightness and fine textures, such as aluminum castings, existing image enhancement methods will cause the grayscale of the bright areas to be compressed, resulting in blurred or lost workpiece details. Summary of the Invention

[0003] The main purpose of the present invention is to propose an image enhancement method, device, electronic device and computer-readable storage medium, aiming to solve the problem that the image enhancement method in the prior art causes the details of the workpiece to be blurred or lost.

[0004] To achieve the above object, the present invention provides an image enhancement method, comprising the steps of:

[0005] Acquiring an image to be enhanced, and determining grayscale distribution information of the image to be enhanced;

[0006] determining a balance deviation coefficient according to the grayscale distribution information;

[0007] Acquire a histogram equalized image corresponding to the image to be enhanced;

[0008] The image to be enhanced is fused with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image.

[0009] Optionally, determining the grayscale distribution information of the image to be enhanced includes:

[0010] Obtaining the grayscale corresponding to each pixel in the image to be enhanced;

[0011] The pixel point with a grayscale greater than or equal to a preset grayscale threshold is taken as the target pixel point;

[0012] The grayscale distribution information is obtained according to the grayscale corresponding to the target pixel point.

[0013] Optionally, determining the equalization deviation coefficient according to the grayscale distribution information includes:

[0014] Obtaining a preset comparison number, and determining a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced;

[0015] Determining the actual grayscale corresponding to each of the comparison pixel quantities according to the grayscale distribution information;

[0016] Determine a plurality of ideal grayscales according to the preset contrast number, wherein the number of the ideal grayscales is the preset contrast number;

[0017] The equalization deviation coefficient is obtained according to the corresponding difference between the ideal grayscale and the actual grayscale.

[0018] Optionally, the determining a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced includes:

[0019] Dividing the number of pixels by the preset comparison number to obtain a pixel interval;

[0020] The number corresponding to the integer multiple of the pixel interval is used as the comparison pixel number, wherein the maximum integer multiple is the preset comparison number.

[0021] Optionally, determining the actual grayscale corresponding to each number of the comparison pixels according to the grayscale distribution information includes:

[0022] Sort the target pixels in the grayscale distribution information by grayscale size;

[0023] For each of the number of compared pixels, determining target pixel points having the same order as the number of compared pixels;

[0024] The grayscale corresponding to the target pixel point is used as the actual grayscale corresponding to the number of compared pixels.

[0025] Optionally, determining a plurality of ideal grayscales according to the preset comparison quantity and the grayscale distribution information includes:

[0026] Obtaining a preset grayscale threshold, and subtracting the preset grayscale threshold from the total grayscale number to obtain a grayscale distribution number;

[0027] Dividing the grayscale distribution number by the preset contrast number to obtain a grayscale interval;

[0028] The grayscale corresponding to the integer multiple grayscale interval is used as the ideal grayscale, wherein the maximum integer multiple is the preset contrast number.

[0029] Optionally, fusing the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image includes:

[0030] Determining an enhanced deviation coefficient corresponding to the equalization deviation coefficient, wherein the sum of the equalization deviation coefficient and the enhanced deviation coefficient is 1;

[0031] The equalization deviation coefficient is used as the coefficient corresponding to the histogram equalization image, and the enhancement deviation coefficient is used as the coefficient corresponding to the image to be enhanced, and the two are fused to obtain the target enhanced image.

[0032] To achieve the above object, the present invention further provides an image enhancement device, comprising:

[0033] A first acquisition module is used to acquire an image to be enhanced and determine grayscale distribution information of the image to be enhanced;

[0034] A first determining module, configured to determine a balancing deviation coefficient according to the grayscale distribution information;

[0035] A second acquisition module is used to acquire a histogram equalized image corresponding to the image to be enhanced;

[0036] The first execution module is configured to fuse the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image.

[0037] To achieve the above objectives, the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and runnable on the processor, and when the computer program is executed by the processor, the steps of the image enhancement method described above are implemented.

[0038] To achieve the above object, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image enhancement method described above are implemented.

[0039] The present invention proposes an image enhancement method, apparatus, electronic device, and computer-readable storage medium. These methods include obtaining an image to be enhanced and determining grayscale distribution information of the image to be enhanced; determining an equalization deviation coefficient based on the grayscale distribution information; obtaining a histogram-equalized image corresponding to the image to be enhanced; and fusing the image to be enhanced with the histogram-equalized image using the equalization deviation coefficient to obtain a target enhanced image. By determining the grayscale distribution information of the image to be enhanced and determining an equalization deviation coefficient reflecting grayscale balance based on the grayscale distribution information, the actual equalization requirements can be determined. The image to be enhanced and the histogram-equalized image are then fused based on the equalization deviation coefficient, achieving the desired equalization intensity and ensuring detail preservation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0042] Figure 1 Schematic diagram of the process of the first embodiment of the image enhancement method of the present invention;

[0043] Figure 2 It is a schematic diagram of the module structure of the electronic device of the present invention. DETAILED DESCRIPTION

[0044] 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. In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work should fall within the scope of protection of this application.

[0045] The present invention provides an image enhancement method, referring to Figure 1 , Figure 1 This is a flow chart of a first embodiment of an image enhancement method according to the present invention, wherein the method comprises the following steps:

[0046] Step S10, obtaining an image to be enhanced, and determining grayscale distribution information of the image to be enhanced;

[0047] The image to be enhanced is an image that requires image enhancement; the image to be enhanced contains a workpiece; this embodiment and subsequent embodiments are described using an image to be enhanced containing an aluminum casting as an example. It can be understood that other images containing other types of objects with a dark background, low overall brightness, and fine texture of the workpiece can also be enhanced using this method.

[0048] The grayscale distribution information indicates the grayscale distribution of the image to be enhanced; the grayscale distribution information may specifically include the number of pixels corresponding to each grayscale, the grayscale value corresponding to each pixel in the image to be enhanced, and the like.

[0049] Step S20, determining a balance deviation coefficient according to the grayscale distribution information;

[0050] The balance deviation coefficient is used to indicate the degree of grayscale imbalance of the image to be enhanced.

[0051] It can be understood that the higher the degree of imbalance of the image to be enhanced, the more equalization processing is needed; the lower the degree of imbalance of the image to be enhanced, the more it can retain its own grayscale distribution, thereby retaining image details; therefore, in this embodiment, the equalization deviation coefficient is determined by grayscale distribution information, so that the equalization need of the image to be enhanced can be clarified.

[0052] Step S30, obtaining a histogram equalized image corresponding to the image to be enhanced;

[0053] The histogram equalized image is an image obtained after equalizing the image to be enhanced; the specific equalization operation can be set based on actual needs, such as histogram equalization, adaptive histogram equalization, and contrast-limited adaptive histogram equalization; this embodiment and subsequent embodiments use adaptive histogram equalization as an example for explanation.

[0054] Step S40 : fusing the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image.

[0055] Since the equalization deviation coefficient indicates the degree of imbalance of the image to be enhanced, in other words, the degree to which equalization is required; therefore, after obtaining the histogram equalized image corresponding to the image to be enhanced, the image to be enhanced can be fused with the histogram equalized image based on the equalization deviation coefficient, so that the details of the artifact on the image to be enhanced can be retained according to the actual grayscale of the image to be enhanced while combining the equalization effect of the histogram equalized image.

[0056] This embodiment determines the grayscale distribution information of the image to be enhanced, and determines the equalization deviation coefficient reflecting the grayscale balance based on the grayscale distribution information, so that the actual equalization needs can be clarified, and then the image to be enhanced is fused with the histogram equalization image based on the equalization deviation coefficient, so as to achieve the required equalization intensity and ensure the preservation of details.

[0057] Furthermore, in a second embodiment of the image enhancement method of the present invention proposed based on the first embodiment of the present invention, step S10 includes the following steps:

[0058] Step S11, obtaining the grayscale corresponding to each pixel in the image to be enhanced;

[0059] Step S12, taking the pixel point whose grayscale is greater than or equal to a preset grayscale threshold as the target pixel point;

[0060] Step S13: obtaining the grayscale distribution information according to the grayscale corresponding to the target pixel.

[0061] It is understandable that in some scenarios, aluminum castings are often captured against a black background. Therefore, the image to be enhanced will contain pixels with a lower grayscale corresponding to the black background. To ensure that subsequent enhancement operations are primarily based on the image corresponding to the aluminum casting, this embodiment removes the portion corresponding to the background to obtain the target pixels corresponding to the aluminum casting. Grayscale distribution information is then obtained based on the grayscale of the target pixels. This grayscale distribution information primarily reflects the grayscale of the pixels corresponding to the aluminum casting. The grayscale distribution information may also include the number of target pixels.

[0062] Because the background has a relatively low grayscale, this embodiment sets a preset grayscale threshold. Pixels with grayscales less than the preset grayscale threshold are considered background pixels, while pixels with grayscales greater than or equal to the preset grayscale threshold are considered target pixels. Background pixels are not used to generate grayscale distribution information; only target pixels are used to generate grayscale distribution information. The specific value of the preset grayscale threshold can be set based on actual needs, such as 10.

[0063] Furthermore, in a third embodiment of the image enhancement method of the present invention proposed based on the first embodiment of the present invention, step S20 includes the following steps:

[0064] Step S21, obtaining a preset comparison number, and determining a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced;

[0065] It is understandable that the number of grayscales of a general image is 256. If all grayscales are to be compared one by one, the amount of calculation will be too large, which will affect the efficiency of image enhancement. Therefore, in this embodiment, a preset number of comparisons is set, and the total number of pixels and the grayscale stage are evenly divided through the preset number of comparisons. The ideal values ​​of some grayscale points are compared with the actual values ​​through the preset number of comparisons, so as to determine the balanced deviation coefficient corresponding to the image to be enhanced. It is understandable that the larger the preset number of comparisons, the more grayscale points need to be compared, the more the balanced deviation coefficient can conform to the actual deviation of the image to be enhanced, and the greater the amount of calculation. Therefore, the specific value of the preset number of comparisons can be set based on actual needs. For example, the preset number of comparisons is 4, that is, the ideal value of 4 grayscale points is compared with the actual value.

[0066] The number of compared pixels is the cumulative number corresponding to a plurality of pixel points to be compared obtained by dividing the number of pixels based on the preset comparison number; specifically, step S21 includes the following steps:

[0067] Step S211, dividing the number of pixels by the preset comparison number to obtain a pixel interval;

[0068] Step S212: taking the number corresponding to the integer multiple of the pixel interval as the number of comparison pixels, wherein the maximum integer multiple is the preset comparison number.

[0069] The number of pixels is the number of pixels contained in the image to be enhanced. The number of pixels is divided by the preset number of contrasts, that is, the number of pixels is divided into the preset number of contrasts. The number of pixels contained in each portion is the pixel interval. Specifically:

[0070]

[0071] Where i is the pixel interval; N is the number of pixels; and s is the preset number of comparisons.

[0072] It should be noted that when the grayscale distribution information is obtained by the grayscale corresponding to the target pixel, the grayscale distribution information indicates the state of the target pixel. Therefore, N in the above formula is set to the number of target pixels.

[0073] After determining the pixel interval, multiple numbers of comparison pixels can be obtained based on the pixel interval, that is, the number of comparison pixels includes [i, 2×i, 3×i...s×i]; taking s as 4 as an example, the obtained number of comparison pixels includes [i, 2×i, 3×i, 4×i].

[0074] Step S22, determining the actual grayscale corresponding to each of the comparison pixel quantities according to the grayscale distribution information;

[0075] The actual grayscale is the grayscale of the pixels corresponding to the number of contrasting pixels in the image to be enhanced; specifically, step S22 includes the following steps:

[0076] Step S221, sorting the target pixels in the grayscale distribution information by grayscale size;

[0077] Step S222, for each of the number of compared pixels, determining target pixel points having the same order as the number of compared pixels;

[0078] Step S223 : Taking the grayscale corresponding to the target pixel as the actual grayscale corresponding to the number of compared pixels.

[0079] The grayscale value of each target pixel is determined according to the grayscale distribution information, and the grayscale values ​​are sorted from small to large, that is, [n1+v, n2+v, n3+v......n255] is obtained, where v is the preset grayscale threshold; each item represents the number of pixels corresponding to the grayscale value. Taking the preset grayscale threshold as 10 as an example, n1+v represents the number of target pixels corresponding to the grayscale value of 1+10=11, n2+v represents the number of target pixels corresponding to the grayscale value of 2+10=12, and so on.

[0080] In the number of compared pixels, s×i is the number of target pixels. Therefore, the number of compared pixels must be able to find a corresponding and unique target pixel in the above grayscale sorting; if n1+v<i<n2+v, then the grayscale value corresponding to the target pixel corresponding to the number of compared pixels i is n2+v, that is, the actual grayscale value k1 corresponding to the number of compared pixels i is n2+v; if n55+v<2×i<n56+v, then the grayscale value corresponding to the target pixel corresponding to the number of compared pixels 2×i is n56+v, that is, the actual grayscale value k2 corresponding to the number of compared pixels 2×i is n56+v, and so on. The actual grayscale of all the numbers of compared pixels can be determined, and the actual grayscale is recorded as [k1, k2, k3......ks].

[0081] Step S23, determining a plurality of ideal grayscales according to the preset contrast number, where the number of the ideal grayscales is the preset contrast number;

[0082] The grayscale value is evenly divided by a preset contrast quantity to obtain a plurality of ideal grayscales. Specifically, the step S23 includes the steps of:

[0083] Step S231, obtaining a preset grayscale threshold, and subtracting the preset grayscale threshold from the total grayscale number to obtain a grayscale distribution number;

[0084] Step S232, dividing the grayscale distribution number by the preset contrast number to obtain a grayscale interval;

[0085] Step S233 , taking the grayscale corresponding to the integer multiple grayscale interval as the ideal grayscale, wherein the maximum integer multiple is the preset contrast quantity.

[0086]

[0087] Where, j is the grayscale interval;

[0088] It should be noted that when the grayscale distribution information is obtained through the grayscale corresponding to the target pixel point, the grayscale distribution information indicates the state of the target pixel point. Therefore, 255-v is used to obtain the grayscale covered by the target pixel point, that is, the grayscale distribution number, and the grayscale distribution number is divided by the preset contrast number to obtain the grayscale interval.

[0089] After determining the grayscale interval, the required ideal grayscale can be determined based on the grayscale interval, that is, the ideal grayscale includes [j, 2×j, 3×j...s×j]; taking s as 4 as an example, the obtained ideal grayscale includes [v+j, v+2×j, v+3×j, v+4×j].

[0090] Step S24 , obtaining the equalization deviation coefficient according to the corresponding difference between the ideal grayscale and the actual grayscale.

[0091] After obtaining the ideal grayscale and the actual grayscale, the equalization deviation coefficient can be determined by comparing the ideal grayscale and the actual grayscale. Specifically:

[0092]

[0093] Where C is the equilibrium deviation coefficient; k m is the mth actual grayscale.

[0094] The absolute value indicates the grayscale difference between the actual grayscale and the ideal grayscale. The average value of multiple groups of grayscale differences is used as the balanced deviation coefficient, so that the balanced deviation coefficient can reflect the overall grayscale deviation of the image to be enhanced.

[0095] Furthermore, in a fourth embodiment of the image enhancement method of the present invention proposed based on the first embodiment of the present invention, step S40 includes the following steps:

[0096] Step S41, determining an enhancement deviation coefficient corresponding to the equalization deviation coefficient, wherein the sum of the equalization deviation coefficient and the enhancement deviation coefficient is 1;

[0097] Step S42 : Taking the equalization deviation coefficient as the coefficient corresponding to the histogram equalization image and taking the enhancement deviation coefficient as the coefficient corresponding to the image to be enhanced, and fusing them to obtain the target enhanced image.

[0098] In this embodiment, the image to be enhanced and the histogram equalized image are fused by weighted averaging. After the equalization deviation coefficient C is determined, 1-C is used as the enhancement deviation coefficient.

[0099] It can be understood that the equalization deviation coefficient reflects the grayscale difference between the actual grayscale and the ideal grayscale. The greater the grayscale difference between the actual grayscale and the ideal grayscale, the more histogram equalization is needed. Therefore, the histogram equalization image should have more components. Therefore, the equalization deviation coefficient is used as the coefficient of the histogram equalization image, and the enhancement deviation coefficient is used as the coefficient of the image to be enhanced to perform image fusion to obtain the target enhanced image; specifically:

[0100]

[0101] Among them, P r is the target enhanced image; P is the image to be enhanced; P a is the histogram equalized image.

[0102] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0103] Through the description of the above embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0104] The present application also provides an image enhancement device for implementing the above-mentioned image enhancement method, the image enhancement device comprising:

[0105] A first acquisition module is used to acquire an image to be enhanced and determine grayscale distribution information of the image to be enhanced;

[0106] A first determining module, configured to determine a balancing deviation coefficient according to the grayscale distribution information;

[0107] A second acquisition module is used to acquire a histogram equalized image corresponding to the image to be enhanced;

[0108] The first execution module is configured to fuse the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image.

[0109] The image enhancement device determines the grayscale distribution information of the image to be enhanced and determines the equalization deviation coefficient reflecting the grayscale balance based on the grayscale distribution information, so that the actual equalization needs can be clarified. Then, the image to be enhanced is fused with the histogram equalization image based on the equalization deviation coefficient, thereby achieving the required equalization intensity and ensuring the preservation of details.

[0110] It should be noted that the first acquisition module in this embodiment can be used to execute step S10 in the embodiment of the present application, the first determination module in this embodiment can be used to execute step S20 in the embodiment of the present application, the second acquisition module in this embodiment can be used to execute step S30 in the embodiment of the present application, and the first execution module in this embodiment can be used to execute step S40 in the embodiment of the present application.

[0111] Furthermore, the first acquisition module includes:

[0112] A first acquisition unit is used to acquire the grayscale corresponding to each pixel in the image to be enhanced;

[0113] A first execution unit, configured to take the pixel point having a grayscale greater than or equal to a preset grayscale threshold as a target pixel point;

[0114] The second execution unit is configured to obtain the grayscale distribution information according to the grayscale corresponding to the target pixel.

[0115] Furthermore, the first determining module includes:

[0116] a second acquiring unit, configured to acquire a preset comparison number, and determine a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced;

[0117] a first determining unit, configured to determine an actual grayscale corresponding to each of the numbers of compared pixels according to the grayscale distribution information;

[0118] a second determining unit, configured to determine a plurality of ideal grayscales according to the preset contrast number, wherein the number of the ideal grayscales is the preset contrast number;

[0119] The third execution unit is configured to obtain the equalization deviation coefficient according to a difference between the corresponding ideal grayscale and the actual grayscale.

[0120] Furthermore, the second acquiring unit includes:

[0121] A first calculation subunit, configured to obtain a pixel interval by dividing the number of pixels by the preset comparison number;

[0122] The first execution subunit is configured to use a number corresponding to an integer multiple of the pixel interval as the number of comparison pixels, wherein a maximum integer multiple is the preset comparison number.

[0123] Furthermore, the first determining unit includes:

[0124] A first sorting subunit, configured to sort the target pixels in the grayscale distribution information by grayscale size;

[0125] A first determining subunit is configured to determine, for each number of compared pixels, target pixel points having the same order as the number of compared pixels;

[0126] The second execution subunit is configured to use the grayscale corresponding to the target pixel as the actual grayscale corresponding to the number of compared pixels.

[0127] Furthermore, the second determining unit includes:

[0128] A first acquisition subunit is configured to acquire a preset grayscale threshold value and subtract the preset grayscale threshold value from the total grayscale value to obtain a grayscale distribution value;

[0129] A second calculation subunit, configured to obtain a grayscale interval by dividing the grayscale distribution number by the preset contrast number;

[0130] The third execution subunit is configured to use the grayscale corresponding to the integer multiple grayscale interval as the ideal grayscale, wherein the maximum integer multiple is the preset comparison number.

[0131] Furthermore, the first execution module includes:

[0132] a third determining unit, configured to determine an enhancement deviation coefficient corresponding to the equalization deviation coefficient, wherein the sum of the equalization deviation coefficient and the enhancement deviation coefficient is 1;

[0133] The fourth execution is to use the equalization deviation coefficient as the coefficient corresponding to the histogram equalization image and the enhancement deviation coefficient as the coefficient corresponding to the image to be enhanced, and fuse them to obtain the target enhanced image.

[0134] Reference Figure 2 In terms of hardware structure, the electronic device may include components such as a communication module 10, a memory 20, and a processor 30. In the electronic device, the processor 30 is connected to the memory 20 and the communication module 10 respectively. The memory 20 stores a computer program, which is simultaneously executed by the processor 30. When the computer program is executed, the steps of the above-mentioned method embodiment are implemented.

[0135] The communication module 10 can be connected to an external communication device via a network. The communication module 10 can receive requests from the external communication device and can also send requests, instructions and information to the external communication device. The external communication device can be other electronic devices, servers or IoT devices, such as TVs, etc.

[0136] Memory 20 can be used to store software programs and various data. Memory 20 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function (such as acquiring an image to be enhanced and determining grayscale distribution information of the image to be enhanced). The data storage area may include a database and may store data or information generated based on system usage. Memory 20 may also include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0137] The processor 30 is the control center of the electronic device. It connects all parts of the electronic device using various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 20 and accessing data stored in the memory 20, it performs various functions of the electronic device and processes data, thereby providing overall monitoring of the electronic device. The processor 30 may include one or more processing units; optionally, the processor 30 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 30.

[0138] although Figure 2 Although not shown, the electronic device may further include a circuit control module, which is used to connect to the power supply to ensure the normal operation of other components. Figure 2 The electronic device structure shown in the figure does not constitute a limitation to the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0139] The present invention also provides a computer-readable storage medium on which a computer program is stored. The computer-readable storage medium may be Figure 2 The memory 20 in the electronic device may also be at least one of a ROM (Read-Only Memory) / RAM (Random Access Memory), a magnetic disk, and an optical disk. The computer-readable storage medium includes a number of instructions for enabling a terminal device with a processor (which may be a television, a car, a mobile phone, a computer, a server, a terminal, or a network device, etc.) to execute the methods described in various embodiments of the present invention.

[0140] In the present invention, the terms "first", "second", "third", "fourth" and "fifth" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0141] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0142] Although the embodiments of the present invention have been shown and described above, the scope of protection of the present invention is not limited thereto. It should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Persons skilled in the art may make changes, modifications, and substitutions to the above embodiments within the scope of the present invention, and such changes, modifications, and substitutions should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. An image enhancement method, characterized in that: The image enhancement method comprises: Acquiring an image to be enhanced, and determining grayscale distribution information of the image to be enhanced; determining a balance deviation coefficient according to the grayscale distribution information; Acquire a histogram equalized image corresponding to the image to be enhanced; fusing the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image; Determining the equalization deviation coefficient according to the grayscale distribution information includes: Obtaining a preset comparison number, and determining a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced; Determining the actual grayscale corresponding to each of the comparison pixel quantities according to the grayscale distribution information; Determine a plurality of ideal grayscales according to the preset contrast number, wherein the number of the ideal grayscales is the preset contrast number; Obtaining the equalization deviation coefficient according to the corresponding difference between the ideal grayscale and the actual grayscale; The step of fusing the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image includes: Determining an enhanced deviation coefficient corresponding to the equalization deviation coefficient, wherein the sum of the equalization deviation coefficient and the enhanced deviation coefficient is 1; The equalization deviation coefficient is used as the coefficient corresponding to the histogram equalization image, and the enhancement deviation coefficient is used as the coefficient corresponding to the image to be enhanced, and the two are fused to obtain the target enhanced image.

2. The image enhancement method according to claim 1, wherein: Determining the grayscale distribution information of the image to be enhanced includes: Obtaining the grayscale corresponding to each pixel in the image to be enhanced; The pixel point with a grayscale greater than or equal to a preset grayscale threshold is taken as the target pixel point; The grayscale distribution information is obtained according to the grayscale corresponding to the target pixel point.

3. The image enhancement method according to claim 1, wherein: The determining of a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced includes: Dividing the number of pixels by the preset comparison number to obtain a pixel interval; The number corresponding to the integer multiple of the pixel interval is used as the comparison pixel number, wherein the maximum integer multiple is the preset comparison number.

4. The image enhancement method according to claim 1, wherein: Determining the actual grayscale corresponding to each of the numbers of compared pixels according to the grayscale distribution information includes: Sort the target pixels in the grayscale distribution information by grayscale size; For each of the number of compared pixels, determining target pixel points having the same order as the number of compared pixels; The grayscale corresponding to the target pixel point is used as the actual grayscale corresponding to the number of compared pixels.

5. The image enhancement method according to claim 1, wherein: Determining a plurality of ideal grayscales according to the preset comparison quantity and the grayscale distribution information includes: Obtaining a preset grayscale threshold, and subtracting the preset grayscale threshold from the total grayscale number to obtain a grayscale distribution number; Dividing the grayscale distribution number by the preset contrast number to obtain a grayscale interval; The grayscale corresponding to the integer multiple grayscale interval is used as the ideal grayscale, wherein the maximum integer multiple is the preset contrast number.

6. An image enhancement device, characterized in that: The image enhancement device comprises: A first acquisition module is used to acquire an image to be enhanced and determine grayscale distribution information of the image to be enhanced; A first determining module, configured to determine a balancing deviation coefficient according to the grayscale distribution information; A second acquisition module is used to acquire a histogram equalized image corresponding to the image to be enhanced; a first execution module, configured to fuse the image to be enhanced with the histogram equalized image using the equalization deviation coefficient to obtain a target enhanced image; The first determining module includes: a second acquiring unit, configured to acquire a preset comparison number, and determine a plurality of comparison pixel numbers according to the preset comparison number and the number of pixels of the image to be enhanced; a first determining unit, configured to determine an actual grayscale corresponding to each of the numbers of compared pixels according to the grayscale distribution information; a second determining unit, configured to determine a plurality of ideal grayscales according to the preset contrast number, wherein the number of the ideal grayscales is the preset contrast number; a third execution unit, configured to obtain the equalization deviation coefficient according to a corresponding difference between the ideal grayscale and the actual grayscale; The first execution module includes: a third determining unit, configured to determine an enhancement deviation coefficient corresponding to the equalization deviation coefficient, wherein the sum of the equalization deviation coefficient and the enhancement deviation coefficient is 1; The fourth execution is to use the equalization deviation coefficient as the coefficient corresponding to the histogram equalization image and the enhancement deviation coefficient as the coefficient corresponding to the image to be enhanced, and fuse them to obtain the target enhanced image.

7. An electronic device, characterized in that: The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the image enhancement method according to any one of claims 1 to 5 when executed by the processor.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the image enhancement method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Dynamic range-adjustment apparatuses and methods

    US20140348428A1