X-ray image defect enhancement method and device, equipment and storage medium
By decomposing and enhancing the X-ray image, the problems of noise interference and low contrast are solved, and the image clarity and interpretation efficiency are improved to meet the needs of different types of images.
Patent Information
- Application Number
- CN202510274771.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-07-18
AI Technical Summary
There is noise interference, low spatial contrast and detailed contrast in the existing X-ray image imaging process, resulting in poor image displayability and difficulty in accurately judgement.
By decomposing the initial ray image, the decomposition base layer and detail layer are obtained, the contrast is adjusted using compression factors, and the details are enhanced in combination with high-frequency emphasis filtering and limiting contrast adaptive histogram equalization algorithm to form a low dynamic range image.
It improves the clarity and interpretation accuracy of X-ray images, simplifies the image processing flow, enhances the visibility and contrast of details in the image, and adapts to the needs of different types of images.
Smart Images

Figure CN120339171A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image enhancement, and particularly relates to an X-ray image defect enhancement method, device, equipment and storage medium. Background Art
[0002] X-rays are electromagnetic waves with extremely high frequency, extremely short wavelength and great energy. Their frequency range is between 30 PHz and 30 EHz, the wavelength is from 0.01 to 10 nanometers, and the energy is from 124 electron volts to 124 kiloelectron volts. X-rays have penetrability and can penetrate many substances. During the penetration process, they will be absorbed differently by substances with different densities, which makes X-rays widely used in fields such as medicine, materials science and security inspection, especially X-Ray based detection.
[0003] Existing X-Ray detection schemes use X-ray images for imaging and artificially compare the image results. However, during the X-ray image imaging process, due to factors such as the quantum noise and scattering phenomenon of X-rays, the ray images contain a large amount of noise. At the same time, due to the absorption difference of X-rays by different materials and the structural complexity of the workpiece to be measured, the spatial contrast and detail contrast of X-ray images are relatively low. In addition, since industrial X-ray images are high dynamic range images, they usually appear as low-light images when directly displayed on a computer monitor, which is not convenient for inspectors to judge. Summary of the Invention
[0004] Aiming at the deficiencies of the prior art, the purpose of the present invention is to provide an X-ray image defect enhancement method, device, equipment and storage medium, so as to solve the problems of low detail display of X-ray images and great difficulty for personnel to judge in the prior art.
[0005] According to one aspect of the present application, an X-ray image defect enhancement method is disclosed. The method includes:
[0006] Obtain an initial ray image, where the initial ray image is a high dynamic range image;
[0007] Perform decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer;
[0008] Determine a compression factor, and adjust the contrast of the decomposed base layer based on the compression factor to obtain a target base layer;
[0009] Based on the target base layer and the decomposed detail layer, determine a detail ray image, where the detail ray image is a low dynamic range image that retains the details of the detail layer;
[0010] Perform detail enhancement on the detail ray image based on the high-frequency emphasis filtering method to obtain a detail-enhanced ray image;
[0011] The contrast of the detailed enhanced ray image is enhanced based on the limited contrast adaptive histogram equalization algorithm to obtain the target ray image.
[0012] In some embodiments, decomposing the initial ray image to obtain a decomposed base layer and a decomposed detail layer includes:
[0013] Performing guided filtering on the initial ray image based on a first formula to determine the guided image of the initial linear image;
[0014] Using the guided image as the input image and inputting it into the linear model of the guided filter for decomposition to output the decomposed base layer;
[0015] Wherein, the first formula is:
[0016] p i =ln(I i + 1);
[0017] In the formula, I i represents the intensity of the i-th pixel of the input image I, and p i is the guided image;
[0018] The output decomposed base layer is:
[0019]
[0020] Wherein, Base i is the decomposed base layer,
[0021] In the formula, a k and b k respectively represent the proportionality factor for transmitting details and the bias factor for adjusting intensity in the window ω k . If it is a rectangular window with a window radius of r, then the size of ω k is (2r + 1)×(2r + 1); μ k and are respectively the average value and variance of the input image in the window ω k ; represents the mean value of p k in the window ω i , |ω| is the number of pixels in the filter window, and ε is the regularization parameter;
[0022] Based on the guided image and the decomposed base layer, determining the decomposed detail layer;
[0023] Wherein, the detail layer is Detail i =p i -Basei ;
[0024] In the formula, Detail i is the decomposed detail layer.
[0025] In some embodiments, determining a compression factor and performing contrast adjustment on the decomposed base layer based on the compression factor to obtain a target base layer includes:
[0026] Determining the compression factor based on a second formula;
[0027] wherein the second formula is:
[0028]
[0029] In the formula, γ is the compression factor, C contrast is the set value of the contrast, and max(Base) and min(Base) respectively represent the maximum value and the minimum value in the reference data;
[0030] Determining the target base layer based on the compression factor and the decomposed base layer;
[0031] wherein the target base layer is the product of the compression factor and the decomposed base layer.
[0032] In some embodiments, determining the detail ray image based on the target base layer and the decomposed detail layer includes:
[0033] Combining the target base layer and the decomposed detail layer with a third formula to determine the detail ray image;
[0034] The third formula is:
[0035] J i = exp(Base i *γ + Detail i - max(Base)*γ);
[0036] In the formula, J i is the detail ray image corresponding to when the pixel is i.
[0037] In some embodiments, performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering method to obtain a detail-enhanced ray image includes:
[0038] Performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering algorithm to obtain a detail-enhanced ray image;
[0039] wherein the expression of the high-frequency emphasis filtering algorithm is:
[0040] I out2 (x, y) = F-1 {[1 + k * H hp (u, v)]F(u, v)};
[0041] In the formula, F(u, v) and F -1 {[1 + k * H hp (u, v)]F are the Fourier transform and the inverse Fourier transform. The value of k controls the degree of detail enhancement. H hp (u, v) is a frequency-domain high-pass filter, a Gaussian high-pass filter, and its expression is as follows:
[0042]
[0043] In the formula, D0 represents the distance from the cut-off frequency to the center of the frequency rectangle.
[0044] In some embodiments, the contrast enhancement of the detail-enhanced radiographic image based on the limited contrast adaptive histogram equalization algorithm to obtain the target radiographic image includes:
[0045] Performing tile segmentation on the detail-enhanced radiographic image to obtain sub-tiles with the number of M×Z matrices, where M represents the number of rows and Z represents the number of columns;
[0046] Determining the initial histogram of each sub-tile;
[0047] Based on the clipping threshold, determining the clipping area and the splicing area of each initial sub-tile. Among them, the part above the clipping threshold T is the clipping area, and the part below the clipping threshold T is the splicing area;
[0048] Clipping the clipping area and splicing it to the splicing area to obtain the transformed histogram of each initial sub-tile;
[0049] Performing equalization operation on the transformed histogram and reconstructing the gray value of pixel points by bilinear interpolation to obtain the target radiographic image.
[0050] In some embodiments, the clipping threshold is determined based on the fourth formula, where the fourth formula is:
[0051]
[0052] In the formula, T is the clipping threshold;
[0053] C Limit is the clipping coefficient; N x and N y are the number of pixels in the x-direction and y-direction of each sub-block respectively, and L is the number of gray levels of each sub-tile.
[0054] According to another aspect of the present application, an X-ray image defect enhancement device is also disclosed. The device includes:
[0055] An initial ray image acquisition module for acquiring an initial ray image, where the initial ray image is a high-dynamic-range image;
[0056] A decomposition processing module for performing decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer;
[0057] A compression factor determination module for determining a compression factor and adjusting the contrast of the decomposed base layer based on the compression factor to obtain a target base layer;
[0058] A detail ray image determination module for determining a detail ray image based on the target base layer and the decomposed detail layer, where the detail ray image is a low-dynamic-range image that retains the details of the detail layer;
[0059] A detail enhancement ray image determination module for enhancing the details of the detail ray image based on a high-frequency emphasis filtering method to obtain a detail enhancement ray image;
[0060] A target ray image determination module for enhancing the contrast of the detail enhancement ray image based on a contrast-limited adaptive histogram equalization algorithm to obtain a target ray image.
[0061] According to another aspect of the present application, an electronic device is also disclosed. The electronic device includes a memory and at least one processor, and instructions are stored in the memory; the at least one processor calls the instructions in the memory to cause the electronic device to execute each step of the X-ray image defect enhancement method described in any one of the above.
[0062] According to another aspect of the present application, a computer-readable storage medium is also disclosed. Instructions are stored on the computer-readable storage medium, and when the instructions are executed by a processor, each step of the X-ray image defect enhancement method described in any one of the above is implemented.
[0063] The present invention includes, but is not limited to, the following beneficial effects: (1) Through the acquisition of high-dynamic-range images, X-ray images with relatively high overall quality can be obtained. Then, the base layer of the high-dynamic-range image is compared and adjusted, while keeping the detail layer unchanged. The initial high-dynamic-range image can be compressed while maintaining details to form a low-dynamic-range image. The low-dynamic-range image can be better displayed based on a computer monitor, facilitating personnel to judge and analyze, and improving the accuracy and efficiency of X-ray image interpretation; (2) By performing guided filtering on the input image according to its characteristics, noise can be effectively removed while retaining the edges and details of the image, improving the clarity of the image. Moreover, it can be adjusted based on parameters such as the intensity bias factor and window size to achieve the purpose of flexible adjustment according to the specific requirements of the image, thereby achieving a better processing effect; (3) By determining the compression factor, the contrast of the image can be effectively adjusted, making the important details in the image more prominent. By determining the formula for the compression factor, the process of contrast adjustment can be simplified, making image processing more efficient; (4) The design of the high-frequency tuning filter allows for adaptive adjustment of different frequency components, thereby optimizing the detail enhancement effect of the image. Through high-frequency enhancement, the information loss caused by blurring in the image can be reduced, improving the clarity of the image. Moreover, it can be adapted to different types of images by adjusting parameters (such as the k value), with good flexibility. Further, through a clear mathematical expression, the processing flow of detail enhancement is simplified, making image processing more efficient; (5) By performing block processing on detail enhancement, the visibility of details in the image can be effectively improved, making important features clearer. Moreover, through cropping and stitching, the non-uniformity caused by edge effects can be reduced, improving the overall quality of the image. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art.
[0065] Figure 1 is a flowchart of a method for enhancing X-ray image defects according to an embodiment of the present application;
[0066] Figure 2 is another flowchart of a method for enhancing X-ray image defects according to an embodiment of the present application;
[0067] Figure 3 is another flowchart of a method for enhancing X-ray image defects according to an embodiment of the present application;
[0068] Figure 4 is a schematic diagram of the histogram of sub-blocks according to an embodiment of the present application;
[0069] Figure 5 is a structural block diagram of a device for enhancing X-ray image defects according to an embodiment of the present application;
[0070] Figure 6 It is a schematic structural diagram of the electronic device provided by an embodiment of the present invention. Specific embodiments
[0071] An embodiment of the present invention provides and discloses an X-ray image defect enhancement method. The method includes: obtaining an initial ray image, where the initial ray image is a high-dynamic range image; performing decomposition processing on the initial ray image to obtain a decomposition base layer and a decomposition detail layer; determining a compression factor, and adjusting the contrast of the decomposition base layer based on the compression factor to obtain a target base layer; based on the target base layer and the decomposition detail layer, determining a detail ray image, where the detail ray image is a low-dynamic range image that retains the details of the detail layer; performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering method to obtain a detail-enhanced ray image; performing contrast enhancement on the detail-enhanced ray image based on a limited contrast adaptive histogram equalization algorithm to obtain a target ray image. Through the acquisition of the high-dynamic range image in this solution, an X-ray image with relatively high overall quality can be obtained. Then, the contrast of the base layer of the high-dynamic range image is adjusted while keeping the detail layer unchanged, and the initial high-dynamic range image can be compressed while keeping the details unchanged to form a low-dynamic range image. The low-dynamic range image can be better displayed based on a computer monitor, which is convenient for personnel to judge and analyze, and improves the interpretation accuracy and efficiency of the X-ray image;
[0072] The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of the present invention and the above drawings are used to distinguish similar objects and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments described here can be implemented in an order different from that shown or described here. In addition, the terms "comprising" or "having" and any variation thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0073] For ease of understanding, the specific process of an embodiment of the present invention is described below. Specifically, Figure 1 It is a flowchart of an X-ray image defect enhancement method, as Figure 1 shown, and includes the following steps:
[0074] S100. Obtain an initial ray image, where the initial ray image is a high-dynamic range image.
[0075] Specifically, when using an X-ray detector for imaging, high-sensitivity detectors and appropriate exposure settings can be employed to ensure that the image covers all details from dark to bright. Preferably, the same scene can be photographed multiple times with different exposure settings to capture details within different brightness ranges. Further, by synthesizing multiple images with different exposures, a high-dynamic-range image, i.e., the initial ray image, is generated. This process typically involves techniques such as image alignment, brightness mapping, and color adjustment to ensure the naturalness and realism of the final image. It can be understood that a high-dynamic-range image (HDR image) can capture details at lower exposures, thereby reducing overexposure in bright regions and noise in dark areas and enhancing the overall image quality.
[0076] S102. Decompose the initial ray image to obtain a decomposed base layer and a decomposed detail layer.
[0077] It can be understood that the purpose of decomposing the initial ray image is to divide the image into two parts: the base layer (low-frequency part) and the detail layer (high-frequency part). The base layer generally represents the overall structure and background of the image, while the detail layer contains the subtle features and high-contrast details in the image. The detail layer retains the high-frequency information in the image, mainly including edges, textures, lesions, defects, and other subtle features. In some examples, the image can be decomposed into components of different frequencies through multi-scale analysis, which is suitable for capturing details. It can also obtain details at different levels through successive downsampling and high-pass filtering, or directly separate the low-frequency and high-frequency components of the image using filters.
[0078] Further, in another example, Figure 2 Another flowchart of the X-ray image defect enhancement method is disclosed. This flowchart is another exemplary illustration of step S102 of decomposing the initial ray image to obtain a decomposed base layer and a decomposed detail layer, as Figure 2 shown, including the following steps:
[0079] S200. Perform guided filtering on the initial ray image based on the first formula to determine the guidance image of the initial linear image.
[0080] S202. Take the guidance image as the input image and input it into the linear model of the guided filter for decomposition to output the decomposed base layer.
[0081] Wherein, the first formula is:
[0082] p i =ln(I i +1);
[0083] In the formula, I i represents the intensity of the i-th pixel of the input image I, and p iFor the guiding image;
[0084] The output decomposed base layer is:
[0085]
[0086] Among them, Base i is the decomposed base layer,
[0087] In the formula, a k and b k respectively represent the scale factor of the transfer details and the bias factor of the adjustment intensity in the window ω k . If it is a rectangular window with a window radius of r, then the size of ω k is (2r + 1)×(2r + 1); μ k and are respectively the average value and variance of the input image in the window ω k ; represents the mean value of p k in the window ω i . |ω| is the number of pixels in the filter window, and ε is the regularization parameter. In one example, the window radius size r = 3 and ε = 0.01 can be taken.
[0088] S204. Determine the decomposed detail layer based on the guiding image and the decomposed base layer.
[0089] Among them, the detail layer is Detail i = p i - Base i ;
[0090] In the formula, Detail i is the decomposed detail layer.
[0091] It can be understood that by performing guided filtering processing according to the characteristics of the input image, noise can be effectively removed, while the edges and details of the image are retained, the clarity of the image is improved, and it can be adjusted based on parameters such as the intensity bias factor and window size to achieve the purpose of flexible adjustment according to the requirements of the specific image, thereby achieving a better processing effect.
[0092] S104. Determine the compression factor, and perform contrast adjustment on the decomposed base layer based on the compression factor to obtain the target base layer.
[0093] Specifically, the compression factor is a parameter used to control the intensity of contrast adjustment, usually a value less than 1. It determines the degree of compression of the luminance values in the base layer, thereby affecting the contrast of the final image. The selection of the compression factor can be based on the characteristics of the image, application requirements, and user preferences. By experimenting with different compression factors and observing their effects on the image contrast, the optimal value can be selected. In some preferred examples, the compression factor can be adjusted between 0.5 and 0.8, and the specific value needs to be fine-tuned according to the actual image effect.
[0094] In another example, the compression factor can be determined based on the second formula, where the second formula is:
[0095]
[0096] In the formula, γ is the compression factor, C contrast is the set value of the contrast, and max(Base) and min(Base) respectively represent the maximum and minimum values in the reference data.
[0097] Among them, the set value of the contrast can be any value within 0 - 100. Specifically, it can be set based on different scenario requirements. The reference data can refer to the pixel values of the image to be processed, or the luminance range of industry standards or reference images can be used as the reference data.
[0098] Furthermore, based on the compression factor and the decomposed base layer, the target base layer is determined, where the target base layer is the product of the compression factor and the decomposed base layer.
[0099] It can be understood that by determining the compression factor, the contrast of the image can be effectively adjusted, so that the important details in the image are more prominent. By determining the formula of the compression factor, the process of contrast adjustment can be simplified, making image processing more efficient.
[0100] S106. Determine the detail ray image based on the target base layer and the decomposed detail layer.
[0101] Specifically, the detail ray image is a low-dynamic-range image that retains the details of the detail layer.
[0102] In one example, the detail ray image can be determined based on the combination of the target base layer and the decomposed detail layer with the third formula.
[0103] Among them, the third formula is:
[0104] J i = exp(Base i *γ + Detail i - max(Base)*γ);
[0105] In the formula, Ji It is the detailed ray image corresponding to pixel i.
[0106] S108. Perform detail enhancement on the detailed ray image based on the high-frequency emphasis filtering method to obtain a detail-enhanced ray image.
[0107] Specifically, the detailed ray image can be detail-enhanced based on the high-frequency emphasis filtering algorithm to obtain a detail-enhanced ray image.
[0108] Among them, the expression of the high-frequency emphasis filtering algorithm is:
[0109] I out2 (x,y) = F -1 {[1 + k * H hp (u,v)]F(u,v)};
[0110] In the formula, F(u, v) and F -1 {[1 + k * H hp (u,v)]F are Fourier transform and inverse Fourier transform. The value of k controls the degree of detail enhancement. H hp (u,v) is a frequency-domain high-pass filter. The Gaussian high-pass filter has the following expression:
[0111]
[0112] In the formula, D0 represents the distance from the cut-off frequency to the center of the frequency rectangle.
[0113] It can be understood that the design of the high-frequency adjustment filter allows for adaptive adjustment of different frequency components, thereby optimizing the detail enhancement effect of the image. Through high-frequency enhancement, the information loss caused by blurring in the image can be reduced, the clarity of the image can be improved, and different types of images can be adapted by adjusting parameters (such as the k value), which has good flexibility. Furthermore, through the explicit mathematical expression, the processing flow of detail enhancement is simplified, making image processing more efficient.
[0114] S110. Perform contrast enhancement on the detail-enhanced ray image based on the contrast-limited adaptive histogram equalization algorithm to obtain the target ray image.
[0115] Specifically, contrast-limited adaptive histogram equalization (CLAHE) is a technique for enhancing image contrast, aiming to improve the local contrast of the image. This method uses the contrast-limited adaptive histogram equalization (CLAHE) algorithm to increase the contrast of the image.
[26] This algorithm, compared with the traditional histogram equalization (HE) algorithm, can suppress the amplification of noise while enhancing the contrast. In CLAHE, the contrast amplification near a given pixel value is given by the slope of the cumulative distribution function (CDF) of the transfer function. CLAHE limits the amplification by clipping the histogram to a predetermined value before calculating the CDF, thereby limiting the slope of the transfer function CDF and achieving the purpose of preventing over-enhancement and limiting noise.
[0116] In one example, Figure 3 Another flowchart of the X-ray image defect enhancement method is given. Figure 3 This is an exemplary illustration of step S110 for enhancing the contrast of a detailed enhanced ray image based on the limited contrast adaptive histogram equalization algorithm to obtain a target ray image. Refer to Figure 3 , including the following steps:
[0117] S300. Divide the detailed enhanced ray image into tiles to obtain sub-tiles with the number of M×Z matrices.
[0118] Among them, M represents the number of rows, and N represents the number of columns. In one example, M and Z can be 4.
[0119] Specifically, according to the resolution and processing requirements of the image, select an appropriate sub-tile size (for example, 8x8, 16x16, or 32x32 pixels). Further, set the number of rows M and the number of columns N of the sub-tiles, so as to determine the total number of sub-tiles as M×Z.
[0120] S302. Determine the initial histogram of each sub-tile.
[0121] Specifically, according to the number of gray levels of the image (usually 256 levels, ranging from 0 to 255), initialize a histogram array with a length of 256, and set all values to 0: histogram = [0]×256; then determine the width and height of the sub-tile, set them as W and H. Further, loop through each pixel, for example, use a double loop to loop through each pixel in the sub-tile: outer loop: from 0 to H - 1 (row index), inner loop: from 0 to W - 1 (column index). Further, in each loop, obtain the value Q of the current pixel: Q = sub-tile[x][y], where x and y are the coordinates of the current pixel in the sub-tile. Further, update the histogram, that is, add 1 to the corresponding histogram value: histogram[Q] += 1.
[0122] S304. Determine the clipping area and stitching area of each initial sub-tile based on the clipping threshold.
[0123] Among them, the part above the clipping threshold T is the clipping area, and the part below the clipping threshold T is the stitching area.
[0124] S306. Crop the cropping area and splice it to the splicing area to obtain the conversion histogram of each initial sub-block.
[0125] Specifically, as Figure 4 shown, Figure (a) is the initial histogram, and Figure (b) is the conversion histogram after cropping and splicing. Assume that the total number of pixels in the initial histogram exceeding the cropping threshold T is S, then we can obtain:
[0126]
[0127] After conversion, the obtained conversion histogram can be expressed as:
[0128]
[0129] where h(x) is the initial histogram, T is the cropping threshold, and L is the number of gray levels of each sub-block;
[0130] The cropping threshold T can be determined based on the fourth formula:
[0131] The fourth formula is:
[0132]
[0133] In the formula, T is the cropping threshold, C Limit is the cropping coefficient; N x and N y are the number of pixels in the x-direction and y-direction of each sub-block respectively, and L is the number of gray levels of each sub-block.
[0134] In one example, C Limit can be taken as 0.02.
[0135] S308. Perform equalization operation on the conversion histogram and use bilinear interpolation to reconstruct the gray value of pixel points to obtain the target ray image.
[0136] It can be understood that by performing block processing on detail enhancement, the visibility of details in the image can be effectively improved, making important features clearer, and by cropping and splicing, the non-uniformity caused by edge effects can be reduced, improving the overall quality of the image.
[0137] Through the acquisition of high-dynamic-range images in this solution, X-ray images with relatively high overall quality can be obtained. Then, by performing contrast adjustment on the basic layer of the high-dynamic-range image and ensuring that the detail layer remains unchanged, the initial high-dynamic-range image can be compressed while maintaining details to form a low-dynamic-range image. The low-dynamic-range image can be better displayed based on a computer monitor, facilitating personnel to judge and analyze, and improving the interpretation accuracy and efficiency of X-ray images.
[0138] Further, Figure 5 is a structural block diagram of an X-ray image defect enhancement device, as Figure 5 shown. The device includes:
[0139] An initial ray image acquisition module for acquiring an initial ray image, where the initial ray image is a high-dynamic range image;
[0140] A decomposition processing module for performing decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer;
[0141] A compression factor determination module for determining a compression factor and adjusting the contrast of the decomposed base layer based on the compression factor to obtain a target base layer;
[0142] A detail ray image determination module for determining a detail ray image based on the target base layer and the decomposed detail layer, where the detail ray image is a low-dynamic range image retaining the details of the detail layer;
[0143] A detail enhancement ray image determination module for enhancing the details of the detail ray image based on the high-frequency emphasis filtering method to obtain a detail enhancement ray image;
[0144] A target ray image determination module for enhancing the contrast of the detail enhancement ray image based on the limited contrast adaptive histogram equalization algorithm to obtain a target ray image.
[0145] The above Figure 5 describes the X-ray image defect enhancement device in the embodiments of the present invention in detail from the perspective of modular functional entities. Next, the electronic device in the embodiments of the present invention will be described in detail from the perspective of hardware processing.
[0146] Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. The electronic device 600 may vary greatly due to different configurations or performances and may include one or more processors (central processing units, CPUs) 610 (for example, one or more processors) and a memory 620, and one or more storage media 630 (for example, one or more mass storage devices) storing application programs 633 or data 632. Among them, the memory 620 and the storage media 630 may be transient storage or persistent storage. The program stored in the storage media 630 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the electronic device 600. Further, the processor 610 may be set to communicate with the storage media 630 and execute a series of instruction operations in the storage media 630 on the electronic device 600.
[0147] The electronic device 600 may further include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input / output interfaces 660, and / or one or more operating systems 631, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, and so on. Those skilled in the art can understand that Figure 6 The illustrated structure of the electronic device does not constitute a limitation on the electronic device, and it may include more or fewer components than shown, or combine certain components, or have a different component arrangement.
[0148] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions run on a computer, the computer is caused to execute the steps of the X-ray image defect enhancement method.
[0149] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described systems, devices, or units can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0150] If the integrated unit is implemented in the form of 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 the present invention, 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. The computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0151] In the above, the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. An X-ray image defect enhancement method, characterized in that, The method includes: Obtaining an initial ray image, where the initial ray image is a high-dynamic-range image; Performing decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer; Determining a compression factor, and adjusting the contrast of the decomposed base layer based on the compression factor to obtain a target base layer; Based on the target base layer and the decomposed detail layer, determining a detail ray image, where the detail ray image is a low-dynamic-range image that retains the details of the detail layer; Performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering method to obtain a detail-enhanced ray image; Performing contrast enhancement on the detail-enhanced ray image based on a contrast-limited adaptive histogram equalization algorithm to obtain a target ray image.
2. The X-ray image defect enhancement method according to claim 1, wherein Performing decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer includes: Performing guided filtering processing on the initial ray image based on a first formula to determine a guided image of the initial linear image; Taking the guided image as an input image and inputting it into a linear model of a guided filter for decomposition to output the decomposed base layer; Wherein, the first formula is: p i = ln(I i + 1); where I i represents the intensity of the i-th pixel of the input image I, and p i is the guidance image; The output decomposed base layer is: Among them, Base i is the decomposition base layer, where a k and b k represent the scale factor of the transmission details and the bias factor of the adjustment strength in the window ω k respectively. For a rectangular window with a radius of r, the size of ω k is (2r + 1)×(2r + 1); μ k and are the mean and variance of the input image in the window ω k respectively; represents the mean of p k in the window ω i , |ω| is the number of pixels in the filter window, and ε is the regularization parameter; Based on the guided image and the decomposed base layer, determining the decomposed detail layer; Among them, the detail layer is Detail i = p i -Base i ; In the formula, Detail i is the decomposition detail layer.
3. The X-ray image defect enhancement method according to claim 2, characterized in that, Determining a compression factor, and adjusting the contrast of the decomposed base layer based on the compression factor to obtain a target base layer includes: Determining the compression factor based on a second formula; Wherein, the second formula is: where γ is the compression factor, C contrast is the set value of the contrast, and max(Base) and min(Base) respectively represent the maximum and minimum values in the reference data; Based on the compression factor and the decomposed base layer, determining the target base layer; Wherein, the target base layer is the product of the compression factor and the decomposed base layer.
4. The X-ray image defect enhancement method according to claim 1, wherein The determining the detail ray image based on the target base layer and the decomposed detail layer includes: Combining the target base layer and the decomposed detail layer with a third formula to determine the detail ray image; The third formula is: J i = exp(Base i * γ + Detail i - max(Base) * γ); where J i is the corresponding detail ray image when the pixel is i.
5. The X-ray image defect enhancement method according to claim 1, wherein The performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering method to obtain a detail-enhanced ray image includes: Performing detail enhancement on the detail ray image based on a high-frequency emphasis filtering algorithm to obtain a detail-enhanced ray image; Wherein, the expression of the high-frequency emphasis filtering algorithm is: I out2 (x, y) = F -1 {[1 + k * H hp (u, v)]F(u, v)}; Wherein, F(u, v) and F -1 {[1 + k * H hp (u, v)]F is the Fourier transform and the inverse Fourier transform, where the value of k controls the degree of detail enhancement, and H hp (u, v) is a frequency-domain high-pass filter. The Gaussian high-pass filter has the following expression: In the formula, D0 represents the distance from the cut-off frequency to the center of the frequency rectangle.
6. The X-ray image defect enhancement method according to claim 1, characterized in that The performing contrast enhancement on the detail-enhanced ray image based on a contrast-limited adaptive histogram equalization algorithm to obtain a target ray image includes: Performing tile segmentation on the detail-enhanced ray image to obtain sub-tiles with the number of M×Z matrices, where M represents the number of rows and Z represents the number of columns; Determining an initial histogram of each sub-tile; Determining a cropping area and a stitching area of each initial sub-tile based on a cropping threshold, where the part above the cropping threshold T is the cropping area, and the part below the cropping threshold T is the stitching area; Cropping the cropping area and stitching it to the stitching area to obtain a transformed histogram of each initial sub-tile; Performing equalization operation on the transformed histogram and reconstructing the gray values of pixel points by using bilinear interpolation to obtain the target ray image.
7. The X-ray image defect enhancement method according to claim 1, characterized in that, The cropping threshold is determined based on a fourth formula, where the fourth formula is: Wherein, T is the clipping threshold; C Limit is the clipping coefficient; N x and N y are the number of pixels in the x - direction and y - direction of each sub - block respectively, and L is the number of gray levels of each sub - block.
8. An X-ray image defect enhancement device, characterized in that, The device includes: An initial ray image acquisition module, configured to acquire an initial ray image, where the initial ray image is a high-dynamic-range image; A decomposition processing module, configured to perform decomposition processing on the initial ray image to obtain a decomposed base layer and a decomposed detail layer; A compression factor determination module, configured to determine a compression factor, and perform contrast adjustment on the decomposed base layer based on the compression factor to obtain a target base layer; A detail ray image determination module, configured to determine a detail ray image based on the target base layer and the decomposed detail layer, where the detail ray image is a low-dynamic-range image that retains the details of the detail layer; A detail enhancement ray image determination module, configured to perform detail enhancement on the detail ray image based on a high-frequency emphasis filtering method to obtain a detail enhancement ray image; A target ray image determination module, configured to perform contrast enhancement on the detail enhancement ray image based on a limited contrast adaptive histogram equalization algorithm to obtain a target ray image.
9. An electronic device, characterized in that, The electronic device includes a memory and at least one processor, and instructions are stored in the memory; the at least one processor invokes the instructions in the memory so that the electronic device executes each step of the X-ray image defect enhancement method according to any one of claims 1-7.
10. A computer-readable storage medium having instructions stored thereon, characterized in that, When the instructions are executed by the processor, each step of the X-ray image defect enhancement method according to any one of claims 1-7 is implemented.