A simplified quantization method for color images based on hierarchical statistics of effective edge transition regions
Through the method based on the hierarchical statistics of edge effective jump area, the problem that multi-level quantization of images in the prior art is difficult to retain detailed information, efficient image quantization and enhancement are achieved, and a method to evaluate the degree of information retention is provided.
Patent Information
- Application Number
- CN202411059696.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-08-05
AI Technical Summary
The prior art is difficult to effectively retain image detail information in multi-level image quantization, and the calculation complexity is high and the image enhancement effect cannot be quantified.
Using a simple quantization method of color images based on hierarchical statistics of edge effective jump area, the edge information is obtained through the Canny edge detection algorithm, the eight neighborhood jump range of edge points is calculated, the edge effective jump area is counted, and the maximum value is selected as the quantization threshold. Gradually carry out quantification.
The edge jump information of most images is retained under a few quantization levels, image enhancement and compression are achieved, and methods to evaluate the degree of image information retention are provided, which improves computing efficiency and image processing effect.
Smart Images

Figure CN118570243B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image information compression representation, in particular to a color image simplified quantization method based on hierarchical statistics of effective edge jump regions. Background Art
[0002] Images are the most important representation of the physical world. They record the rich texture information of the scene in detail and provide an important data source for visual tasks such as scene understanding and target recognition. However, the problem of large data volume in this way of recording scenes in the form of pixels is extremely prominent, which brings great challenges to the subsequent storage, compression and high-speed transmission of massive image data. Although the amount of data can be reduced by shortening the image size, this will lose a lot of image detail information. In addition, the quantization depth of image pixels will also affect the size of the image data. For example, in the classic 256-level RGB three-channel image storage mode, storing a color picture pixel requires 400 MHz. , using 8-level quantization, storing one pixel only requires , saving If 4-level quantization is used, storing one pixel only requires , saving The space used by the image is greatly improved, which greatly improves the efficiency of image storage. At the same time, since multi-level quantization stretches the different color levels of the image to a certain extent, appropriate multi-level quantization can also achieve image enhancement effects to a certain extent.
[0003] Among the existing image multi-level quantization algorithms, there is no relatively complete and independent theoretical system to support the optimal multi-level quantization algorithm. If the typical average value algorithm is used for multi-level quantization, it is completely impossible to show the rich details of the picture when the number of divisions is small. In addition, there is the most classic generalized multi-level quantization based on the OTSU maximum inter-class variance binarization method. If you want to traverse and obtain multi-level quantization of multiple intervals, its computational complexity increases very quickly, and this method will greatly reduce the efficiency of image processing. In addition, the OTSU optimization rule only relies on the histogram information of the image, and completely loses the position information of the grayscale, which may cause a lot of details to be lost. In terms of image enhancement, taking the traditional histogram equalization as an example, the algorithm does not consider the constraints of the dominant grayscale, and the algorithm is based on the image color level information for processing, and does not consider the position information of the image pixels. At present, under the existing image enhancement algorithms, there is no reasonable evaluation of the degree of image information retention, so the effect of image enhancement cannot be evaluated. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and propose a simplified quantization method for color images based on hierarchical statistics of effective edge jump areas. Not only can the edge jump information of most images be retained at fewer quantization levels, but after completing a certain degree of image enhancement and image compression, a set of methods for reasonably evaluating the degree of image information retention is also provided, thereby overcoming the defect that traditional image enhancement algorithms cannot quantitatively evaluate the enhancement effect.
[0005] The present invention solves the technical problem by adopting the following technical solutions:
[0006] The simplified quantization method of color images based on hierarchical statistics of effective edge transition regions includes the following steps:
[0007] Step 1: Set the input image to have RGB three-channel size Color map ,in Indicates the image width and height. Represents the color channel of the image, which is divided into three channels, RGB, and uses the Canny edge detection algorithm on each channel of the input image RGB to obtain the edge detection image of each channel ;
[0008] Step 2: For the edge point position in the edge detection image of each RGB channel, calculate its eight-neighborhood jump range to obtain the minimum color level of the edge point and maximum color level ;
[0009] Step 3: Based on all the edge points detected in step 2 and the minimum color level of the edge point obtained and maximum color level , calculate the edge effective transition area statistics of each RGB channel, and assign 1 to all color level statistical increments within the eight-neighborhood transition range of each edge point;
[0010] Step 4: Based on the statistical results of the effective transition areas of all edge points in step 3, select the color level corresponding to its maximum value as the first-level optimal quantization threshold ;
[0011] Step 5: Calculate the optimal quantization threshold at level 1 The distinguishable edge points are If it falls within the eight-neighborhood jump range of the edge point, it means that the edge point can be distinguished, and the first-level optimal quantization threshold is obtained. Distinguishing edge graph ;
[0012] Step 6: Edge detection images of each channel obtained in step 1 Eliminate the first level optimal quantization threshold The corresponding distinguishable edge map , get the remaining edges of each channel , and obtain the statistical map of the effective transition area of the remaining edges, and select the color level corresponding to its maximum value as the second-level optimal quantization threshold ;
[0013] Step 7: Determine whether the image edge information retention degree of each channel meets the requirements, or check whether the threshold number of each channel meets the set value. If at least one of the conditions is met, proceed to step 8. If none of them are met, continue to remove the edge points that can be distinguished by the previous threshold quantization value. , get the remaining edge graphs of other levels , and take the maximum value as the optimal quantization threshold for other levels based on the statistical map of the remaining edge effective transition areas , until one of the above two requirements is met;
[0014] Step 8: Arrange all obtained quantization thresholds from small to large for each channel;
[0015] Step 9: quantize each channel according to the arranged threshold sequence to obtain a color simplified quantized image.
[0016] Moreover, the specific implementation method of step 2 is:
[0017] ;
[0018] in, The range indicated is and centered on it Region, r, s is to satisfy An integer whose range does not exceed the index of the image width and height.
[0019] Moreover, the specific implementation method of calculating the edge effective transition area statistical map in step 3 is:
[0020] ;
[0021] in, Indicates the color level of this channel. This chart has 256 possible values.
[0022] Moreover, the first-level optimal quantization threshold in step 4 is The calculation method is:
[0023] .
[0024] Moreover, the first level optimal quantization threshold in step 5 is Distinguishing edge graph The calculation method is:
[0025] ;
[0026] in, is the edge detection result of the i-th row and j-th column of the c-th channel. If the point is an edge point, the value is 1, otherwise it is 0.
[0027] Moreover, the specific implementation method of step 7 is: determine whether the image edge information retention degree of each channel meets the requirements, and the information retention degree measurement index is :
[0028] ;
[0029] Or check whether the threshold number of each channel meets the set value. If one of the conditions is met, proceed to step 8. If none of them are met, continue to eliminate the edge points that can be distinguished by the previous threshold quantization value. ,
[0030] ;
[0031] Get the remaining edge graphs of other levels ;
[0032] If the kth quantization threshold is , then remove The distinguishable edge points are used to obtain the remaining edge graphs of other levels. for:
[0033] ;
[0034] in ,
[0035]
[0036] in, is the value of the i-th row and j-th column in the c-th channel of the remaining edge image. When k=0 Compared with the original edge detection result equivalence;
[0037] And according to the statistical map of the remaining edge effective transition area, take its maximum value as the optimal quantization threshold for other levels , until one of the above two requirements is met;
[0038] The calculation method of the remaining edge effective transition area statistical diagram is:
[0039] ;
[0040] Optimal quantization thresholds for other levels The calculation method is:
[0041] .
[0042] Moreover, the specific implementation method of step 8 is:
[0043] ;
[0044] in, , .
[0045] Moreover, the specific implementation method of step 9 is: The new image is obtained after multi-level quantization of gray levels ,in:
[0046] ;
[0047] Rounded to an integer between 0 and 255: , and finally the three channels are combined to obtain The image after level quantization is .
[0048] The advantages and positive effects of the present invention are:
[0049] The simplified multi-level quantization algorithm used in the present invention is a one-time algorithm. Each selected threshold value can ensure that the most information is depicted under the condition of the existing segmentation threshold number. There is no need to traverse multiple times to find the optimal threshold value, which greatly improves the operation efficiency. At the same time, the algorithm obtains the quantization threshold value based on the edge detection result. When considering the relationship between adjacent points of the image, it can ensure that the image edge information displayed under the existing threshold segmentation condition is the richest, and retains as many image details as possible after having to discard some detail information. The present invention can not only retain the edge jump information of most images at a relatively small number of quantization levels, but also provide a set of methods for reasonably evaluating the degree of image information retention after completing the effect of image enhancement and image compression to a certain extent, overcoming the defect that the traditional image enhancement algorithm cannot quantitatively evaluate the enhancement effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is the algorithm flow chart;
[0051] Figure 2 The input original color RGB image example A;
[0052] Figure 3 Figure A is the RGB synthesis result after 4-level quantization;
[0053] Figure 4 This is the Canny edge detection result image;
[0054] Figure 5 It is a statistical graph based on the effective edge transition area classification when the B channel does not obtain the threshold;
[0055] Figure 6 After detecting the first threshold for channel B, the remaining edge map is removed after the edge points with retained transitions are removed;
[0056] Figure 7 The first threshold of channel B can distinguish the transition edge map;
[0057] Figure 8 It is a statistical diagram of the B channel based on the edge effective transition area classification under an existing threshold;
[0058] Fig. 9 After detecting the second threshold for channel B, the remaining edge map is removed from the edge points that have been retained;
[0059] Fig.10 The second threshold of channel B can distinguish the transition edge map;
[0060] Fig.11 It is a statistical diagram of the B channel based on the edge effective transition area classification under the existing two thresholds;
[0061] Fig.12 Example B is the input original color RGB image;
[0062] Fig.13 Figure B is the RGB synthesis result after 4-level quantization;
[0063] Fig.14 For example C, the input original color RGB image;
[0064] Fig.15 Figure C is the RGB synthesis result after 4-level quantization. DETAILED DESCRIPTION
[0065] The present invention is further described in detail below with reference to the accompanying drawings.
[0066] A simplified quantization method for color images based on hierarchical statistics of effective edge transition regions, such as Figure 1 As shown, the following steps are included:
[0067] Step 1: Set the input image to have RGB three-channel size Color map ,in Indicates the image width and height. Represents the color channel of the image, which is divided into three channels, RGB, and uses the Canny edge detection algorithm on each channel of the input image RGB to obtain the edge detection image of each channel .
[0068] Among them, the Canny edge detection algorithm uses the setting of After smoothing the image with Gaussian filtering, the two Canny detection thresholds are set to 20 and 50; the edge detection images of each channel are obtained This example takes the Canny edge map of channel B as an example. Figure 4 shown.
[0069] Step 2: For the edge point position in the edge detection image of each RGB channel, calculate its eight-neighborhood jump range to obtain the minimum color level of the edge point and maximum color level .
[0070] Calculate the eight-neighborhood jump range corresponding to each edge point:
[0071] .
[0072] Step 3: Based on all the edge points detected in step 2 and the minimum color level of the edge point obtained and maximum color level , calculate the edge effective transition area statistics of each RGB channel, and assign 1 to all color level statistical increments within the eight-neighborhood transition range of each edge point.
[0073] The color change range of the 8 neighborhoods of the edge point and the position of the edge point, a total of 9 points, is counted, and the statistical weight increment of all color levels within the range is assigned 1 to obtain a classification sequence based on the effective edge jump area. , , used to indicate the color level of this channel, with a total of 256 values.
[0074]
[0075] like Figure 5 The statistical diagram of the effective edge transition area classification is shown in FIG. express.
[0076] Step 4: Based on the statistical results of the effective transition areas of all edge points in step 3, select the color level corresponding to its maximum value as the first-level optimal quantization threshold .
[0077] Step 5: Calculate the optimal quantization threshold at level 1 The distinguishable edge points are If it falls within the eight-neighborhood jump range of the edge point, it means that the edge point can be distinguished, and the first-level optimal quantization threshold is obtained. Distinguishing edge graph .
[0078] Step 6: Edge detection images of each channel obtained in step 1 Eliminate the first level optimal quantization threshold Distinguishable edge map , get the remaining edges of each channel , and obtain the statistical map of the effective transition area of the remaining edges, and select the color level corresponding to its maximum value as the second-level optimal quantization threshold .
[0079] Step 7: Determine whether the image edge information retention degree of each channel meets the requirements, or check whether the threshold number of each channel meets the set value. If at least one of the conditions is met, proceed to step 8. If none of them are met, continue to remove the edge points that can be distinguished by the previous threshold quantization value. , get the remaining edge graphs of other levels , and take the maximum value as the optimal quantization threshold for other levels based on the statistical map of the remaining edge effective transition areas , until one of the above two requirements is met.
[0080] Step 8: Arrange all obtained quantization thresholds for each channel from small to large.
[0081] Step 9: quantize each channel according to the arranged threshold sequence to obtain a color simplified quantized image.
[0082] In this example, the multi-level quantization is 4 levels. If you need to divide the image RGB channels into 4 gray levels, you need 3 thresholds , , let the edge effective transition region classification sequence corresponding to different thresholds be , ,
[0083] Among them in the channel Next The threshold value obtained by calculation is , then the statistical graph is:
[0084] ;
[0085] Among them, exclude The distinguishable edge points are used to obtain the remaining edges of the channel. The method is:
[0086] ;
[0087] And remember
[0088] ;
[0089] Channel B gets the first level threshold The remaining edge map like Figure 6 As shown, we get The edge map after like Fig. 9 As shown; Distinguishable edge points :
[0090] ;
[0091] B channel 1st level threshold Distinguishing edge graph like Figure 7 As shown, Distinguishing edge graph like Fig.10 As shown, suppose The threshold value obtained is ,in , can be obtained by recursion:
[0092] ;
[0093] in If you want to get , must be calculated . The histogram like Figure 8 As shown, the histogram like Fig.11 shown.
[0094] Take the R channel as an example, where Histogram like Figure 8 As shown, Histogram like Fig.11 shown.
[0095] Variables reflecting the degree of image information capture:
[0096] ;
[0097] It can be obtained by recursion , is the grayscale value corresponding to the maximum value of the previous histogram.
[0098] In this example, the three thresholds obtained in sequence for the R channel are for ;
[0099] In this example, the three thresholds obtained in sequence for the G channel are for ;
[0100] In this example, the three thresholds obtained in sequence for the B channel are for ;
[0101] Will Arrange from small to large to get:
[0102] set up The new image is obtained after multi-level quantization of gray levels ,in:
[0103] ;
[0104] Rounded to an integer between 0 and 255: ;
[0105] The original input image is Figure 2 Finally, the three channels are synthesized to obtain a 4-level quantized image: ,like Figure 3 shown.
[0106] According to the results, most of the information of the original image is retained after 4-level quantization. After all 7 thresholds are obtained, the capture degree of edge information of each channel of RGB channels reaches , , , have completed the basic complete representation of their respective edge information. In addition, this algorithm also achieves a certain enhancement effect on the original image.
[0107] Figure 12~Figure 15 is the result of using this algorithm, where Fig.12 , 14 For the original image, Fig.13 , 15 According to the calculation results of this patent, only a few quantization levels are needed to basically depict the jump detail information of the original image, and image enhancement is achieved, with good results in night and foggy scenes.
[0108] It should be emphasized that the embodiments described in the present invention are illustrative rather than restrictive. Therefore, the present invention includes but is not limited to the embodiments described in the specific implementation manner. Any other implementation manners derived by those skilled in the art based on the technical solution of the present invention also fall within the scope of protection of the present invention.
Claims
1. A simplified quantization method for color images based on hierarchical statistics of effective edge transition regions, characterized by: The following steps are involved: Step 1: Set the input image to have RGB three-channel size Color map ,in Indicates the image width and height. Represents the color channel of the image, which is divided into three channels, RGB, and uses the Canny edge detection algorithm on each channel of the input image RGB to obtain the edge detection image of each channel ; Step 2: For the edge point position in the edge detection image of each RGB channel, calculate its eight-neighborhood jump range to obtain the minimum color level of the edge point and maximum color level ; Step 3: Based on all the edge points detected in step 2 and the minimum color level of the edge point obtained and maximum color level , calculate the edge effective transition area statistics of each RGB channel, and assign 1 to all color level statistical increments within the eight-neighborhood transition range of each edge point; Step 4: Based on the statistical results of the effective transition areas of all edge points in step 3, select the color level corresponding to its maximum value as the first-level optimal quantization threshold ; Step 5: Calculate the optimal quantization threshold at level 1 The distinguishable edge points are If it falls within the eight-neighborhood jump range of the edge point, it means that the edge point can be distinguished, and the first-level optimal quantization threshold is obtained. Distinguishing edge graph ; Step 6: Edge detection images of each channel obtained in step 1 Eliminate the first level optimal quantization threshold The corresponding distinguishable edge map , get the remaining edges of each channel , and obtain the statistical map of the effective transition area of the remaining edges, and select the color level corresponding to its maximum value as the second-level optimal quantization threshold ; Step 7: Determine whether the image edge information retention degree of each channel meets the requirements, or check whether the threshold number of each channel meets the set value. If at least one of the conditions is met, proceed to step 8. If none of them are met, continue to remove the edge points that can be distinguished by the previous threshold quantization value. , get the remaining edge graphs of other levels , and take the maximum value as the optimal quantization threshold for other levels based on the statistical map of the remaining edge effective transition areas , until one of the above two requirements is met; Step 8: Arrange all obtained quantization thresholds from small to large for each channel; Step 9: quantize each channel according to the arranged threshold sequence to obtain a color simplified quantized image.
2. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 1 is characterized by: The specific implementation method of step 2 is: ; in, The range indicated is and centered on it Region, r, s is to satisfy An integer whose range does not exceed the index of the image width and height.
3. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 2 is characterized by: The specific implementation method of calculating the edge effective transition area statistical map in step 3 is: ; in, Indicates the color level of this channel. This chart has 256 possible values.
4. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 3 is characterized by: The optimal quantization threshold at level 1 in step 4 The calculation method is: 。 5. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 4 is characterized by: The first level optimal quantization threshold in step 5 Distinguishing edge graph The calculation method is: ; in, is the edge detection result of the i-th row and j-th column of the c-th channel. If the point is an edge point, the value is 1, otherwise it is 0.
6. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 5, characterized in that: The specific implementation method of step 7 is: determine whether the image edge information retention degree of each channel meets the requirements, and the information retention degree measurement index is : ; Or check whether the threshold number of each channel meets the set value. If one of the conditions is met, proceed to step 8. If none of them are met, continue to eliminate the edge points that can be distinguished by the previous threshold quantization value. , ; Get the remaining edge graphs of other levels ; If the kth quantization threshold is , then remove The distinguishable edge points are used to obtain the remaining edge graphs of other levels. for: ; in , , in, is the value of the i-th row and j-th column in the c-th channel of the remaining edge image. When k=0 Compared with the original edge detection result equivalence; And according to the statistical map of the remaining edge effective transition area, take its maximum value as the optimal quantization threshold for other levels , until one of the above two requirements is met; The calculation method of the remaining edge effective transition area statistics is: ; Optimal quantization thresholds for other levels The calculation method is: 。 7. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 6, characterized in that: The specific implementation method of step 8 is: ; in, , .
8. The color image simplified quantization method based on edge effective transition region hierarchical statistics according to claim 7, characterized in that: The specific implementation method of step 9 is: The new image is obtained after multi-level quantization of gray levels ,in: ; Rounded to an integer between 0 and 255: , and finally the three channels are combined to obtain The image after level quantization is .
Citation Information
Patent Citations
Image processor with edge selection functionality
CA2847120A1
Image blurring detecting algorithm combined with image obviousness region segmentation
CN103955934A