Image compression methods, electronic devices and computer-readable storage media
By interpolating and filtering the RGB data of the image, expanding the brightness range and making non-linear adjustments, the problems of detail loss and poor contrast during image compression are solved, achieving a higher quality image compression effect.
Patent Information
- Application Number
- CN202210254469.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-15
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2042-03-15
AI Technical Summary
Existing image compression schemes suffer from loss of detail and poor contrast, especially when high dynamic range original images need to be compressed before being displayed on image display devices.
By interpolating the RGB data of the original image, the first brightness data of each pixel is determined, and then filtered to obtain the first grayscale histogram. After expanding its range, it is converted to the logarithmic domain for nonlinear adjustment, and the compressed target image is determined by combining the gain coefficient.
It reduces the loss of detail during image compression, improves the contrast of the compressed target image, and enhances image quality.
Smart Images

Figure CN114708157B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image compression method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] Existing image display devices typically have a low dynamic range; for example, grayscale images have a display bit width of 8 bits, and color images have a display bit width of 24 bits. However, image acquisition devices generally use a high dynamic range bit width to store the original image in order to capture as much image information as possible. Therefore, the original image needs to be compressed before it can be displayed on the image display device. Existing image compression schemes generally suffer from loss of detail and poor contrast. In view of this, how to reduce the loss of detail during image compression and improve the contrast of the compressed target image has become an urgent problem to be solved. Summary of the Invention
[0003] The main technical problem addressed by this application is to provide an image compression method, electronic device, and computer-readable storage medium that can reduce detail loss during image compression and improve the contrast of the compressed target image.
[0004] To address the aforementioned technical problems, this application provides an image compression method. The method includes: obtaining an original image to be compressed; performing interpolation on the RGB data of the original image; determining first luminance data for each pixel in the original image based on the interpolated RGB data; filtering the first luminance data for each pixel to obtain a first grayscale histogram and expanding the range of the first grayscale histogram to obtain a second grayscale histogram; converting the first luminance data for each pixel to the logarithmic domain and performing nonlinear adjustment; converting the nonlinearly adjusted first luminance data to the constant domain to obtain second luminance data; and determining a target image after compression of the original image based on the ratio of the second luminance data to the first luminance data corresponding to each pixel and the second grayscale histogram.
[0005] To address the aforementioned technical problems, a second aspect of this application provides an electronic device comprising: a memory and a processor coupled to each other, wherein the memory stores program data, and the processor invokes the program data to execute the method described in the first aspect.
[0006] To solve the above-mentioned technical problems, a third aspect of this application provides a computer storage medium storing program data thereon, wherein the program data, when executed by a processor, implements the method described in the first aspect.
[0007] The above scheme, after obtaining the original image to be compressed, first performs interpolation on the RGB data of the original image to facilitate image compression and reconstruction, improving image storage and transmission efficiency. Based on the interpolated RGB data, it obtains the first brightness data of each pixel in the original image, filters the first brightness data of each pixel to obtain a first grayscale histogram, expands the range of the first grayscale histogram to obtain a second grayscale histogram, thereby expanding the brightness range of the original image, converts the first brightness data of each pixel to the logarithmic domain for nonlinear adjustment, and divides it into at least two data segments for adjustment, so that the second brightness data obtained after conversion to the constant domain after adjustment is more uniform. The ratio of the second brightness data to the first brightness data corresponding to each pixel is used as the gain coefficient. Based on the gain coefficient of each pixel and the second grayscale histogram, the compressed target image is determined. The second grayscale histogram, after range expansion, stretches the contrast of the target image. The nonlinear adjustment determines the compression gain, thereby reducing the loss of details in the target image and improving the quality of the compressed target image. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0009] Figure 1 This is a flowchart illustrating one embodiment of the image compression method of this application;
[0010] Figure 2 yes Figure 1 A schematic diagram of an application scenario corresponding to step S103 in the middle;
[0011] Figure 3 This is a flowchart illustrating one embodiment of the image compression method of this application;
[0012] Figure 4 yes Figure 3 A schematic diagram of an application scenario corresponding to step S301 in the middle;
[0013] Figure 5 yes Figure 3 A schematic diagram of an application scenario corresponding to step S304 in the middle;
[0014] Figure 6 This is a schematic diagram of the structure of one embodiment of the electronic device of this application;
[0015] Figure 7This is a schematic diagram of one embodiment of the computer storage medium of this application. Detailed Implementation
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0017] In this paper, the terms "system" and "network" are often used interchangeably. The term "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this paper means two or more.
[0018] Please see Figure 1 , Figure 1 This is a flowchart illustrating one embodiment of the image compression method of this application, which includes:
[0019] S101: Obtain the original image to be compressed and perform interpolation on the RGB data of the original image.
[0020] Specifically, the original image to be compressed is acquired by an image acquisition device. The original image is captured from a real natural environment. In order to capture the brightness information in the natural scene as completely as possible, the image acquisition device uses high dynamic range to store the original image. After obtaining the original image, the RGB data of the original image is interpolated to facilitate image compression and reconstruction, thereby improving the storage and transmission efficiency of the image.
[0021] In one application method, interpolation operations are performed on the R and B channels of the original image based on at least one of the interpolation methods of nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation, and interpolation operations are performed on the G channel of the original image based on gradient information, so that the G channel retains more high-frequency information during interpolation operations and reduces the loss of details.
[0022] S102: Determine the first brightness data of each pixel in the original image based on the RGB data after interpolation.
[0023] Specifically, the first brightness data of each pixel in the original image is calculated based on the RGB data after interpolation.
[0024] In one application, the first brightness data of each pixel is obtained by weighted averaging the values around the G pixel in the interpolated RGB data. Since the human eye is more sensitive to green, calculating the brightness data based on the G pixel can more accurately reflect the brightness information of each pixel.
[0025] In a specific application scenario, the first brightness data of each pixel is calculated based on the mean or median value around the G pixel in the RGB data after interpolation.
[0026] S103: Filter the first brightness data of each pixel to obtain a first grayscale histogram, and expand the range of the first grayscale histogram to obtain a second grayscale histogram.
[0027] Specifically, please refer to Figure 2 , Figure 2 yes Figure 1 A schematic diagram of an application scenario corresponding to step S103 shows that the first brightness data of each pixel is filtered to obtain the following result: Figure 2 The upper half of the first grayscale histogram is shown. Expanding the range of the first grayscale histogram to a larger dynamic range results in a newly established histogram, as shown in the figure above. Figure 2 The second grayscale histogram shown in the lower middle section expands the dynamic range of the grayscale histogram, thereby stretching the contrast of the target image obtained based on the second grayscale histogram.
[0028] In one application method, the first brightness data of each pixel is low-pass filtered to separate the low-frequency and high-frequency information of the first brightness data, so as to obtain a first gray-level histogram based on the high-frequency information. The initial range of the first gray-level histogram is divided into multiple K parts, as shown below. Figure 2 As shown in the figure, k is 4. The first gray-level histogram is divided into four gray-level sub-histograms, and the original dynamic range is expanded to L gray levels. Each gray-level sub-histogram is obtained by L and the area ratio, and a new gray-level histogram is re-established to obtain the second gray-level histogram.
[0029] S104: Convert the first brightness data of each pixel to the logarithmic domain and perform non-linear adjustment. Convert the non-linearly adjusted first brightness data to the constant domain to obtain the second brightness data.
[0030] Specifically, the first brightness data of each pixel is transformed to obtain the logarithmic domain data of the first brightness data in the logarithmic domain. Based on the logarithmic domain data, a nonlinear adjustment is performed, and the data is divided into at least two data segments for adjustment. The adjusted first brightness data is then transformed to the constant domain to obtain the second brightness data. The change of the adjusted second brightness data is made more stable through nonlinear adjustment. In turn, the target image obtained after adjusting the ratio of the second brightness data to the first brightness data has a more uniform contrast, reducing the probability of false contour phenomena.
[0031] In one application scenario, the first brightness data is denoted as Y. Y is converted to the logarithmic domain and a non-linear adjustment is made to logY. The non-linear adjustment is a curve composed of multiple data segments for mapping. Each data segment corresponds to a curve. Smoothing inflection points are set between adjacent curves to make the contrast of the mapped low dynamic range image more uniform.
[0032] It should be noted that steps S103 and S104 can be executed in parallel or sequentially.
[0033] S105: Based on the ratio of the second brightness data to the first brightness data corresponding to each pixel and the second grayscale histogram, determine the target image after compression of the original image.
[0034] Specifically, the gain coefficient is determined based on the ratio of the second brightness data to the first brightness data corresponding to each pixel. Each pixel is multiplied by the corresponding gain coefficient and the second grayscale histogram to obtain the compressed low dynamic range target image. The gain coefficient of each grayscale compression level is determined by a non-linear adjustment method. Compared with the general global dynamic range mapping method, this reduces the loss of details. Compared with the local dynamic range mapping method, it reduces the computational complexity and reduces the computation time.
[0035] In one application method, the value of the second brightness data corresponding to each pixel is less than the first brightness data. The ratio of the second brightness data to the first brightness data corresponding to each pixel is used as the gain coefficient of each pixel. Each pixel is multiplied by its corresponding gain coefficient and the second grayscale histogram, thereby compressing the original image with high dynamic range into a target image with low dynamic range.
[0036] The above scheme, after obtaining the original image to be compressed, first performs interpolation on the RGB data of the original image to facilitate image compression and reconstruction, improving image storage and transmission efficiency. Based on the interpolated RGB data, it obtains the first brightness data of each pixel in the original image, filters the first brightness data of each pixel to obtain a first grayscale histogram, expands the range of the first grayscale histogram to obtain a second grayscale histogram, thereby expanding the brightness range of the original image, converts the first brightness data of each pixel to the logarithmic domain for nonlinear adjustment, and divides it into at least two data segments for adjustment, so that the second brightness data obtained after conversion to the constant domain after adjustment is more uniform. The ratio of the second brightness data to the first brightness data corresponding to each pixel is used as the gain coefficient. Based on the gain coefficient of each pixel and the second grayscale histogram, the compressed target image is determined. The second grayscale histogram, after range expansion, stretches the contrast of the target image. The nonlinear adjustment determines the compression gain, thereby reducing the loss of details in the target image and improving the quality of the compressed target image.
[0037] Please see Figure 3 , Figure 3 This is a flowchart illustrating one embodiment of the image compression method of this application, which includes:
[0038] S301: Obtain the original image to be compressed, perform interpolation on the G channel of the original image based on gradient information, and perform interpolation on the R and B channels of the original image based on a non-adaptive interpolation algorithm to obtain the interpolated RGB data.
[0039] Specifically, the original image is high-bit image data that has been decompressed or synthesized by the module. After obtaining the original image to be compressed, interpolation is performed on the G channel of the original image based on gradient information. The gradient information includes the gradient in the horizontal and vertical directions and the chromaticity. Considering the gradient information when interpolating the G channel can reduce the loss of high-frequency information in the image after interpolation. The R channel and G channel are interpolated using a non-adaptive interpolation algorithm to facilitate image compression and reconstruction, thereby improving the storage and transmission efficiency of the image.
[0040] In one application scenario, please refer to Figure 4 , Figure 4 yes Figure 3 The diagram illustrates an application scenario of one embodiment corresponding to step S301. The original image is a high-bit image in Bayer format (RGGB). Interpolation is performed on the G channel based on gradient information, and on the R and B channels based on bilinear interpolation to enrich the data of the original image, facilitating image compression and reconstruction.
[0041] S302: Determine the first brightness data of each pixel in the original image based on the RGB data after interpolation.
[0042] Specifically, the first brightness data of each pixel is calculated using its RGB data. Optimizing the first brightness data after extraction can improve the contrast of the compressed image.
[0043] In one application, the first brightness data of each pixel is determined based on the weighted mean of the G channel in the interpolated RGB data. The weighted mean can be the average value, median value, or obtained by weighting based on gradient information, so as to calculate the brightness data based on green, which is more sensitive to the human eye, thereby improving the calculation efficiency.
[0044] In another application, the interpolated RGB data is converted into YUV data, and the Y channel is extracted from the converted YUV data to determine the first brightness data of each pixel. In this method, the Y channel in the YUV data accurately reflects the brightness data after the RGB data is converted to YUV data, thus improving the accuracy of the data.
[0045] S303: Filter the first brightness data of each pixel to obtain a first grayscale histogram, and expand the range of the first grayscale histogram to obtain a second grayscale histogram.
[0046] Specifically, the first brightness data of each pixel is low-pass filtered to obtain the first gray-level histogram corresponding to the original image after interpolation. Based on the starting and ending values of the first gray-level histogram, the first gray-level histogram is divided into multiple gray-level sub-historical maps. Each gray-level sub-historical map is expanded based on preset coefficients. The expanded gray-level sub-historical maps are then merged to obtain the second gray-level histogram.
[0047] In one application scenario, please refer again. Figure 2 The first brightness data of each pixel is low-pass filtered to obtain a first gray-level histogram. The start and end values in the first gray-level histogram are determined, and the data between the start and end values is evenly divided to obtain multiple gray-level sub-historics on the first gray-level histogram. Each gray-level sub-historical image is multiplied by a preset coefficient to expand the area of each gray-level sub-historical image, resulting in an expanded gray-level sub-historical image. The expanded gray-level sub-historical images are then merged to obtain a second gray-level histogram. The dynamic range between the start and end values of the second gray-level histogram is greater than that of the first gray-level histogram. As a result, the contrast of the target image obtained based on the second gray-level histogram is stretched, thereby improving the contrast of the target image.
[0048] In a specific application scenario, the step of performing low-pass filtering on the first brightness data of each pixel to obtain the first gray-level histogram corresponding to the interpolated original image includes: performing low-pass filtering on the first brightness data based on at least one filtering method among non-local mean filtering, bilateral filtering, and guided filtering; and summing the filtering results of each pixel to obtain the first gray-level histogram that retains high-frequency information. Among these methods, non-local mean filtering, bilateral filtering, guided filtering, and other filtering methods that preserve edge characteristics, or combinations of multiple filtering methods, retain as much high-frequency information as possible and reduce the loss of details in the original image.
[0049] S304: Convert the first brightness data of each pixel to the logarithmic domain to obtain logarithmic domain data.
[0050] Specifically, the first brightness data of each pixel is converted to the logarithmic domain to obtain the corresponding logarithmic domain data for each pixel, so as to adjust the first brightness data.
[0051] S305: Divide the logarithmic field data into multiple data segments and perform nonlinear adjustments to obtain the adjusted logarithmic field data.
[0052] Specifically, the logarithmic domain data is divided into multiple data segments, and then each data segment is adjusted to achieve nonlinear adjustment of the logarithmic domain data, resulting in adjusted logarithmic domain data. At least one data segment is adjusted based on the parameters obtained by weighted summation of the power function of the logarithmic domain data.
[0053] Furthermore, after converting the first brightness data of each pixel to the logarithmic domain to obtain logarithmic domain data, the method further includes: determining the upper limit value of the logarithmic domain data based on the target compression ratio corresponding to the dynamic range of the original image; wherein the upper limit value is proportional to the target compression ratio corresponding to the dynamic range of the original image.
[0054] Specifically, please refer to Figure 5 , Figure 5 yes Figure 3 The diagram illustrates an application scenario of one embodiment corresponding to step S304, where mc is the upper limit value of the logarithmic domain data. The upper limit value depends on the target compression ratio corresponding to the dynamic range of the original image. The larger the target compression ratio value, the higher the upper limit value, so that the target compression ratio is associated with the upper limit value of the logarithmic domain data. Thus, the compression ratio of the original image to the target image is adjusted by changing the upper limit value. The target compression ratio is 0-1.
[0055] In a specific application scenario, the step of dividing logarithmic domain data into multiple data segments and performing nonlinear adjustments to obtain adjusted logarithmic domain data includes: dividing the logarithmic domain data into two data segments for separate adjustments; wherein the data segments include a first data segment with values less than the median value, and a second data segment between the median value and the upper limit value; determining the adjusted logarithmic domain data within the first data segment based on the product of the logarithmic domain data within the first data segment and its corresponding first coefficient; and determining the adjusted logarithmic domain data within the second data segment based on the product of the power functions of different powers of the logarithmic domain data within the second data segment and their respective corresponding second coefficients.
[0056] The above process can be expressed by the following formula:
[0057]
[0058] Among them, Y in For logarithmic field data, Y out For the adjusted logarithmic field data, t c To take the median value, m c The upper limit of the range is denoted by , and a, b, c, and d are the second coefficients, with the first coefficient being 1.
[0059] Specifically, the logarithmic domain data is divided into a first segment (below the median value) and a second segment (between the median and the upper limit value) by using an intermediate value. A first coefficient is multiplied by the logarithmic domain data within the first segment to obtain the adjusted logarithmic domain data for that segment. Then, the power functions corresponding to the 0th, 1st, 2nd, and 3rd powers of the logarithmic domain data in the second segment are calculated, and these power function data are multiplied by their respective second coefficients and then summed to obtain the adjusted logarithmic domain data for that segment. The median value serves as the inflection point for the segmented adjustment. Setting a smooth inflection point makes the contrast of the adjusted low dynamic range image more uniform, reducing the probability of false contours. The upper limit value of the logarithmic domain data is adjusted using a target compression ratio, ensuring good performance for low dynamic range images of different bit widths after compression.
[0060] S306: Take the inverse of the adjusted logarithmic field data to obtain the second brightness data for each pixel.
[0061] Specifically, the inverse of the adjusted logarithmic domain data is taken to obtain the second brightness data of each pixel converted to the constant domain.
[0062] S307: Based on the ratio of the second brightness data to the first brightness data corresponding to each pixel and the second grayscale histogram, determine the target image after compression of the original image.
[0063] Specifically, the gain coefficient is determined based on the ratio of the second brightness data to the first brightness data corresponding to each pixel, and the compressed target image is determined by multiplying each pixel with the corresponding gain coefficient and the second grayscale histogram, so that the target image has better contrast.
[0064] In this embodiment, interpolation is performed on the G channel of the original image based on gradient information to reduce the loss of high-frequency information in the image after interpolation. Based on the original image after interpolation, first brightness data is determined. The first brightness data is filtered using a filtering method with edge-preserving characteristics or a combination of multiple filtering methods to obtain a first gray-level histogram, which retains as much high-frequency information as possible and reduces the loss of details in the original image. The first gray-level histogram is expanded into a second gray-level histogram to improve the contrast of the target image. The first brightness data is converted to the logarithmic domain for nonlinear adjustment. By setting a smooth inflection point, the contrast of the adjusted low dynamic range image is made more uniform, reducing the probability of false contours.
[0065] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device 60 includes a memory 601 and a processor 602 coupled to each other. The memory 601 stores program data (not shown in the figure), and the processor 602 calls the program data to implement the method in any of the above embodiments. For the description of the relevant content, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0066] Please see Figure 7 , Figure 7 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 70 stores program data 700. When the program data 700 is executed by the processor, it implements the method in any of the above embodiments. For related descriptions, please refer to the detailed description of the above method embodiments, which will not be repeated here.
[0067] It should be noted that the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0068] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0069] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0070] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. An image compression method, characterized in that, The method includes: Obtain the original image to be compressed, and perform interpolation operations on the RGB data of the original image; specifically, this includes performing interpolation operations on the R channel, G channel, and B channel of the original image; The first brightness data of each pixel in the original image is determined based on the RGB data after interpolation. The first brightness data of each pixel is filtered to obtain a first grayscale histogram, and the range of the first grayscale histogram is expanded to obtain a second grayscale histogram; and... The first brightness data of each pixel is converted to the logarithmic domain and nonlinearly adjusted. The nonlinearly adjusted first brightness data is then converted to the constant domain to obtain the second brightness data. Based on the ratio of the second brightness data to the first brightness data corresponding to each pixel and the second grayscale histogram, the target image after compression of the original image is determined; wherein, the value of the second brightness data corresponding to each pixel is less than the first brightness data, a gain coefficient is determined based on the ratio of the second brightness data to the first brightness data corresponding to each pixel, and the compressed target image is determined based on the gain coefficient and the second grayscale histogram of each pixel, wherein the gain coefficient is used to determine the compression gain, and the second grayscale histogram is used to stretch the contrast of the target image.
2. The image compression method according to claim 1, characterized in that, The step of converting the first brightness data of each pixel to the logarithmic domain and performing nonlinear adjustment, and then converting the nonlinearly adjusted first brightness data to the constant domain to obtain the second brightness data includes: The first brightness data of each pixel is converted to the logarithmic domain to obtain logarithmic domain data; The logarithmic domain data is divided into multiple data segments and nonlinearly adjusted to obtain adjusted logarithmic domain data; wherein at least one data segment is adjusted based on the parameters of the weighted summation of the power function of the logarithmic domain data. The second brightness data for each pixel is obtained by taking the inverse of the adjusted logarithmic field data.
3. The image compression method according to claim 2, characterized in that, After the step of converting the first brightness data of each pixel to the logarithmic domain to obtain logarithmic domain data, the method further includes: Based on the target compression ratio corresponding to the dynamic range of the original image, the upper limit value of the logarithmic domain data is determined; wherein the upper limit value is proportional to the target compression ratio corresponding to the dynamic range of the original image.
4. The image compression method according to claim 3, characterized in that, The step of dividing the logarithmic field data into multiple data segments and performing nonlinear adjustments to obtain the adjusted logarithmic field data includes: The logarithmic field data is divided into two data segments for adjustment; wherein, the data segment includes a first data segment that is less than the median value, and a second data segment that is between the median value and the upper limit value. Based on the product of the logarithmic field data and its corresponding first coefficient in the first data segment, the adjusted logarithmic field data in the first data segment is determined. Based on the product of the power functions of different powers of the logarithmic field data in the second data segment and their respective corresponding second coefficients, the adjusted logarithmic field data in the second data segment is determined.
5. The image compression method according to claim 1, characterized in that, The step of filtering the first brightness data of each pixel to obtain a first grayscale histogram and expanding the range of the first grayscale histogram to obtain a second grayscale histogram includes: The first brightness data of each pixel is low-pass filtered to obtain the first grayscale histogram corresponding to the original image after interpolation. Based on the starting and ending values of the first gray-level histogram, the first gray-level histogram is divided into multiple gray-level sub-histograms. Each gray-level sub-histogram is expanded based on a preset coefficient, and the expanded gray-level sub-histograms are merged to obtain the second gray-level histogram.
6. The image compression method according to claim 5, characterized in that, The step of performing low-pass filtering on the first brightness data of each pixel to obtain the first grayscale histogram corresponding to the original image after interpolation includes: Based on at least one of the filtering methods of nonlocal mean filtering, bilateral filtering, and guided filtering, the first brightness data is low-pass filtered, and the filtering results of each pixel are summarized to obtain the first grayscale histogram that retains high-frequency information.
7. The image compression method according to claim 1, characterized in that, The step of interpolating the RGB data of the original image includes: Interpolation is performed on the G channel of the original image based on gradient information, and interpolation is performed on the R and B channels of the original image based on a non-adaptive interpolation algorithm to obtain the interpolated RGB data. The gradient information includes gradients in the horizontal and vertical directions and chromaticity.
8. The image compression method according to claim 7, characterized in that, The step of determining the first brightness data of each pixel in the original image based on the RGB data after interpolation includes: The first luminance data of each pixel is determined based on the weighted average of the G channel in the interpolated RGB data; or, The interpolated RGB data is converted into YUV data, the Y channel in the converted YUV data is extracted, and the first brightness data of each pixel is determined.
9. An electronic device, characterized in that, include: A memory and a processor are coupled to each other, wherein the memory stores program data, and the processor invokes the program data to perform the method as described in any one of claims 1-8.
10. A computer-readable storage medium storing program data thereon, characterized in that, When the program data is executed by the processor, it implements the method as described in any one of claims 1-8.
Citation Information
Patent Citations
Image processing method and apparatus, computer apparatus and computer readable storage medium
CN108230256A
Image processing method and device, equipment and storage medium
CN112381743A