Image enhancement method and device, storage medium and equipment
Through multi-scale pyramid decomposition and improved processing algorithms on images, the problem of insufficient PSNR value of image enhancement in the prior art is solved, and a higher quality image enhancement effect is achieved.
Patent Information
- Application Number
- CN202411927157.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-22
AI Technical Summary
The prior art has a peak signal-to-noise ratio PSNR of 0.890 in image enhancement, which needs to be further improved to meet scenes requiring high-quality images.
By performing multi-scale pyramid decomposition on the image, high-frequency components and low-frequency components are obtained, the low-frequency components are equalized by an improved histogram equalization algorithm, and the high-frequency components are filtered by an improved high-pass filter, and the processed components are fused proportionally, and the multi-scale pyramid decomposition step is performed in reverse to obtain the enhanced image.
The peak signal-to-noise ratio of the image is improved, and the contrast and details of the image are enhanced, making the image quality higher.
Smart Images

Figure CN119863412A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image enhancement technology, and in particular to an image enhancement method, device, storage medium and equipment. Background Art
[0002] Prior art CN116563166A discloses an image enhancement method, device, storage medium and equipment, including the following steps: step A, scanning the target workpiece, acquiring an image, and performing multi-scale decomposition on the image to obtain the irradiation component and the reflection component of the image; step B, equalizing the irradiation component by an improved histogram equalization algorithm; step C, filtering the reflection component by an improved high-pass filter; step D, proportionally fusing the processed reflection component and irradiation component, and reversely executing step S2 to obtain an enhanced image. After the image is enhanced by this method, the peak signal-to-noise ratio (PSNR) of the image is about 0.890, and the closer the value is to 1, the higher the image quality. X-ray imaging technology is widely used in industrial non-destructive testing, medical, military and other fields, which require higher quality images. However, the peak signal-to-noise ratio (PSNR) of the prior art is 0.890, which needs to be further improved. Summary of the invention
[0003] One of the objectives of the present invention is to provide an image enhancement method that can further improve the peak signal-to-noise ratio (PSNR) to meet the needs of high-quality images.
[0004] In order to achieve the above object, an image enhancement method is provided, comprising the following steps:
[0005] S1, scan the target workpiece and obtain an image;
[0006] S2, performing multi-scale pyramid decomposition on the image to obtain high-frequency components and low-frequency components of the image;
[0007] In the decomposition step, the image F1 is mainly decomposed layer by layer into high-frequency images G i and the low frequency image F i+1 , the specific steps are as follows:
[0008] S201, filter the image F1 using a Gaussian low-pass filter, and then downsample to obtain a low-frequency image F2 of the next layer;
[0009] S202, up-sampling the low-frequency image F2, and then performing Gaussian low-pass filtering to obtain an intermediate image, and finally subtracting the intermediate image from F1 to obtain G1;
[0010] S203, use a Gaussian low-pass filter to filter the low-frequency image F i+1 Filter and then downsample to obtain the low-frequency image F of the next layer i+2 ;
[0011] S204, for the low frequency image F i+2 Upsample, then perform Gaussian low-pass filtering to get the intermediate image, and finally use F i+1 Subtract the intermediate image to get G i+1 ;
[0012] S205, repeating the above steps S203 and S204, decomposing the image a set number of times n (i=1, 2, ..., L), and obtaining a decomposed multi-scale pyramid, wherein the multi-scale pyramid includes a Gaussian pyramid and a Laplacian pyramid, wherein F i (i=1,2,…,n+1) form a Gaussian pyramid and serve as the low-frequency component, G i (i=1,2,…,n) forms a Laplacian pyramid and serves as a high-frequency component;
[0013] S3, performing equalization processing on the low-frequency components by using a histogram equalization algorithm;
[0014] S4, filtering the high frequency components through a high pass filter;
[0015] S5, the processed high-frequency component and low-frequency component are fused in proportion, and step S2 is reversely performed to obtain an enhanced image.
[0016] A second object of the present invention is to provide an image enhancement device, which uses the above-mentioned image enhancement method and specifically includes the following modules:
[0017] Image acquisition module: used to scan the target workpiece and acquire the image;
[0018] Component processing module: used to perform multi-scale pyramid decomposition on the image to obtain the high-frequency component and low-frequency component of the image;
[0019] Equalization processing module: used to equalize the low-frequency components through the histogram equalization algorithm;
[0020] Filter processing module: used to filter high-frequency components through high-pass filtering algorithm;
[0021] The image enhancement module is used to fuse the processed high-frequency components and low-frequency components in proportion, and reversely execute step S2 to obtain an enhanced image.
[0022] A third object of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium includes an image enhancement program, and when the image enhancement program is executed by a processor, the steps of an image enhancement method as described above are implemented.
[0023] A fourth object of the present invention is to provide a computer device, which includes the storage medium and a processor, wherein the processor is used to execute the image enhancement program in the storage medium.
[0024] Principles and advantages:
[0025] This solution obtains the high-frequency and low-frequency components of the image by performing multi-scale decomposition on the image; uses a histogram equalization algorithm to enhance the low-frequency component, making the grayscale distribution of the image wider and evenly distributed, thereby improving the contrast of the image; and uses a high-pass filter to filter the high-frequency component to enhance the details of the image, making the edges and details of the image stand out. This further improves the peak signal-to-noise ratio (PSNR) to meet the needs of scenes that require high-quality images. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A flowchart of an image enhancement method according to an embodiment of the present invention;
[0027] Figure 2 Schematic diagram of the image decomposition and reconstruction process. DETAILED DESCRIPTION
[0028] The following is further described in detail through specific implementation methods:
[0029] Example
[0030] An image enhancement method, basically as Figure 1 As shown, the following steps are included:
[0031] S1, scan the target workpiece and obtain an image;
[0032] S2, performing multi-scale pyramid decomposition on the image to obtain high-frequency components and low-frequency components of the image;
[0033] like Figure 2 As shown, in the decomposition step, the image F1 is mainly decomposed layer by layer into high-frequency images G i and the low frequency image F i+1 , the specific steps are as follows:
[0034] S201, filter the image F1 using a Gaussian low-pass filter, and then downsample with a step size of 2 (corresponding to Figure 2 LP↓), and obtain the low-frequency image F2 of the next layer; in this embodiment, the Gaussian low-pass filter specifically uses a 7*7 Gaussian low-pass filter (the entire solution uses the same 7*7 Gaussian filter template).
[0035] S202, up-sampling the low-frequency image F2 rows (interpolating the rows and columns of the image, usually inserting 0 values, corresponding to Figure 2LP↑), then perform Gaussian low-pass filtering to get the intermediate image, and finally subtract the intermediate image from F1 to get H1;
[0036] S203, use a Gaussian low-pass filter to filter the low-frequency image F i+1 Filter and then downsample to obtain the low-frequency image F of the next layer i+2 ;
[0037] S204, for the low frequency image F i+2 Upsample, then perform Gaussian low-pass filtering to get the intermediate image, and finally use F i+1 Subtract the intermediate image to get G i+1 ;
[0038] S205, repeat the above steps S203 and S204, decompose the image a set number of times n (i=1, 2, ..., L) (the number of decompositions is adaptively calculated according to the size of the image, usually decomposed 4 times, that is, L=4), and obtain a decomposed multi-scale pyramid, wherein the multi-scale pyramid includes a Gaussian pyramid and a Laplacian pyramid, wherein F i (i=1,2,…,n+1) form a Gaussian pyramid and serve as the low-frequency component, G i (i=1,2,…,n) forms a Laplacian pyramid and serves as a high-frequency component;
[0039] S3, performing equalization processing on the low-frequency components by using a histogram equalization algorithm;
[0040] The illumination component (i.e., low-frequency component) reflects the edge information of the image. For the low-frequency part of the image, the traditional histogram equalization algorithm is prone to cause the grayscale of the image to be missing and obvious step phenomenon to appear, which will cause the details of the image to be torn; at the same time, if the limit function is not selected properly, artifacts will appear on the edge of the image; therefore, the present application adopts an improved histogram equalization algorithm to map the grayscale of the input image to the output image, so that the grayscale distribution of the output image is wider and relatively uniform, so that the contrast of the image is enhanced, and based on the CLAHE algorithm (Contrast-Limited Adaptive Histogram Equalization), the low-frequency component is enhanced to improve the overall quality of the image, which belongs to the prior art, and its process is as follows:
[0041] (1) The original image is divided into M×N continuous, non-overlapping sub-regions, where the size of M×N is determined by the enhancement strength of local details.
[0042] (2) Calculate the grayscale histogram H(i) of each sub-block area respectively.
[0043] (3) Construct a limiting function to uniformly adjust the segmented regions of the original image. Make full use of the conversion function between the image pixels and the grayscale of the segmented regions to perform bilinear interpolation calculations, and then perform interpolation processing on each segmented region near the pixel points to reduce the mutual influence between sub-blocks.
[0044] Set a limit value T. When H(i) ≥ T, H(i) = H max ; when H(i) < T, H(i) = H(i) + L. Among them, T, L, and H max The relationship among the three should be: H max = L + T, and the value of L is:
[0045]
[0046] Among them, Ng is the number of gray levels in the sub-region, S is the shadow, and N∑S is the total number of pixels in the shadow part.
[0047] The process of calculating the conversion function in the traditional histogram is very time-consuming. Therefore, interpolation calculation is used in CLAHE, which can improve the efficiency of the algorithm and has no impact on the image quality.
[0048] S4. Filter the high-frequency components through a high-pass filter to enhance the details of the image;
[0049] The high-pass filter is a Butterworth high-pass filter. The transfer function of the Butterworth high-pass filter with a cut-off frequency D0 from the origin and of order N is:
[0050]
[0051] Among them, D0 is a specified non-negative value, and D(u, v) is the distance of the point (u, v) from the center of the frequency rectangle. The transfer function of the improved Butterworth high-pass filter is:
[0052] H hfe (u, v) = a + bH hp (n, v)
[0053] Among them, a is the offset; b is the multiplier, and H hp (n, v) is the transfer function of the Butterworth high-pass filter. The illumination component (i.e., the low-frequency component) is processed by the improved histogram equalization to have good contrast. The reflection component (i.e., the high-frequency component) is enhanced in details by the improved Butterworth high-pass filter.
[0054] S5, the processed high-frequency component and low-frequency component are fused in proportion, and step S2 is reversed to obtain an enhanced image. The image reconstruction process is the reverse process of decomposition. The high-frequency image and low-frequency image obtained by each level of decomposition are contrast enhanced and added, and then upsampled, and the calculation is performed to the highest layer in sequence and step S2 is reversed to obtain an enhanced image. Finally, the processed high-frequency component and low-frequency component (reflection component and illumination component) are fused in proportion. Its expression is:
[0055] F=w I L′ I +w p R′ I
[0056] In the formula, w I and w p Respectively represent the weights of image fusion, and w I +w p =1; L' I Represents the low-frequency component (irradiation component) after preprocessing; R I ' represents the high frequency component (reflection component) after processing.
[0057] By performing multi-scale decomposition processing on the image, the high-frequency and low-frequency components of the image are obtained; the improved histogram equalization algorithm is used to enhance the low-frequency components, so that the grayscale distribution of the image is wider and uniform, thereby improving the contrast of the image; the improved high-pass filter is used to filter the high-frequency components, enhance the details of the image, and make the edges and details of the image stand out.
[0058] In order to verify the effectiveness of the present invention, an experimental verification is carried out on the collected radiographic images, and the image enhancement effect is analyzed by combining subjective evaluation with objective evaluation.
[0059]
[0060] PSNR represents the peak signal-to-noise ratio of an image, and the closer its value is to 1, the higher the image quality. Analysis of the above experimental results shows that compared with the above two enhancement algorithms, the image enhancement algorithm described in this embodiment has a higher quality improvement.
[0061] An image enhancement device, which uses the above-mentioned image enhancement method, specifically includes the following modules:
[0062] Image acquisition module: used to scan the target workpiece and acquire the image;
[0063] Component processing module: used to perform multi-scale pyramid decomposition on the image to obtain the high-frequency component and low-frequency component of the image;
[0064] Equalization processing module: used to equalize the low-frequency components through the histogram equalization algorithm;
[0065] Filter processing module: used to filter high-frequency components through high-pass filtering algorithm;
[0066] The image enhancement module is used to fuse the processed high-frequency components and low-frequency components in proportion, and reversely execute step S2 to obtain an enhanced image.
[0067] A computer-readable storage medium includes an image enhancement program. When the image enhancement program is executed by a processor, the steps of an image enhancement method as described above are implemented.
[0068] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned image enhancement method can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of various embodiments of the above-mentioned image enhancement method. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0069] A computer device, comprising the storage medium and a processor, the processor being used to execute the image enhancement program in the storage medium. The computer device can be implemented as various types of devices, such as a personal computer (PC), a server device, a mobile device, etc. The processor controls all functions of the electronic device by executing the program stored in the storage medium on the electronic device.
[0070] The above is only an embodiment of the present invention. The common sense such as the known specific structure and characteristics in the scheme is not described in detail here. The ordinary technicians in the relevant field know all the common technical knowledge in the technical field of the invention before the application date or priority date, can obtain all the existing technologies in the field, and have the ability to apply the conventional experimental means before that date. The ordinary technicians in the relevant field can improve and implement this scheme in combination with their own abilities under the enlightenment given by this application. Some typical known structures or known methods should not become obstacles for ordinary technicians in the relevant field to implement this application. It should be pointed out that for those skilled in the art, without departing from the structure of the present invention, several deformations and improvements can be made, which should also be regarded as the protection scope of the present invention, which will not affect the effect of the implementation of the present invention and the practicality of the patent. The protection scope required by this application shall be based on the content of its claims, and the specific implementation methods and other records in the specification can be used to interpret the content of the claims.
Claims
1. An image enhancement method, characterized in that: The following steps are involved: S1, scan the target workpiece and obtain an image; S2, performing multi-scale pyramid decomposition on the image to obtain high-frequency components and low-frequency components of the image; In the decomposition step, the image F1 is mainly decomposed layer by layer into high-frequency images G i and the low frequency image F i+1 , the specific steps are as follows: S201, filter the image F1 using a Gaussian low-pass filter, and then downsample to obtain a low-frequency image F2 of the next layer; S202, up-sampling the low-frequency image F2, and then performing Gaussian low-pass filtering to obtain an intermediate image, and finally subtracting the intermediate image from F1 to obtain G1; S203, use a Gaussian low-pass filter to filter the low-frequency image F i+1 Filter and then downsample to obtain the low-frequency image F of the next layer i+2 ; S204, for the low frequency image F i+2 Upsample, then perform Gaussian low-pass filtering to get the intermediate image, and finally use F i+1 Subtract the intermediate image to get G i+1 ; S205, repeating the above steps S203 and S204, decomposing the image a set number of times n (o=1, 2, ..., L), and obtaining a decomposed multi-scale pyramid, wherein the multi-scale pyramid includes a Gaussian pyramid and a Laplacian pyramid, wherein F i (i=1,2,…,n+1) form a Gaussian pyramid and serve as the low-frequency component, G i (i=1,2,…,n) forms a Laplacian pyramid and serves as a high-frequency component; S3, performing equalization processing on the low-frequency components by using a histogram equalization algorithm; S4, filtering the high frequency components through a high pass filter; S5, the processed high-frequency component and low-frequency component are fused in proportion, and step S2 is reversely performed to obtain an enhanced image.
2. An image enhancement device, characterized in that: The image enhancement method as claimed in claim 1 is used, which specifically includes the following modules: Image acquisition module: used to scan the target workpiece and acquire the image; Component processing module: used to perform multi-scale pyramid decomposition on the image to obtain the high-frequency component and low-frequency component of the image; Equalization processing module: used to equalize the low-frequency components through the histogram equalization algorithm; Filter processing module: used to filter high-frequency components through high-pass filtering algorithm; The image enhancement module is used to fuse the processed high-frequency components and low-frequency components in proportion, and reversely execute step S2 to obtain an enhanced image.
3. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes an image enhancement program, and when the image enhancement program is executed by a processor, the steps of an image enhancement method as claimed in claim 1 are implemented.
4. A computer device, characterized in that: The computer device comprises the storage medium of claim 3 and a processor configured to execute the image enhancement program in the storage medium.
Citation Information
Patent Citations
Image enhancement method and device, storage medium and equipment
CN116563166A
Cited By
Real-time image quality enhancement method for EMC test of vehicle-mounted camera
CN120997075A